Skip to content

Commit

Permalink
include details on where the default marker offset number came from
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey committed Jan 24, 2018
1 parent f1761b2 commit 8c75c46
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ui/marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ class Marker {
element.appendChild(svg);

// if no element and no offset option given apply an offset for the default marker
// -14 is used as the default marker offset since, the offset relative to center of the marker
//
// the marker tip is at the center of the shadow ellipse from the default svg
// the y value of the center of the shadow ellipse relative to the svg top left is "shadow transform translate-y (29.0) + ellipse cy (5.80029008)"
// offset to the svg center "height (41 / 2)" gives (29.0 + 5.80029008) - (41 / 2) and rounded for an integer pixel offset gives 14
// negative is used to move the marker up from the center so the tip is at the Marker lngLat
const defaultMarkerOffset = [0, -14];
if (!(options && options.offset)) {
if (!options) {
Expand Down

0 comments on commit 8c75c46

Please sign in to comment.