none
none

Reputation: 1807

Strange behavior leaflet when adding a marker

Working example: http://markercluster.meteor.com/

If you double click on the map to add a marker, then this place will be the upper left corner marker, not pin. The coordinates of the mouse pointer and marker coordinates coincide: it can be seen in the browser console.

Actually the question: What am I doing wrong? How to make a marker added correctly?

Upvotes: 0

Views: 196

Answers (1)

none
none

Reputation: 1807

Solved by adding option iconAnchor

EDIT:

myIcon = L.icon(
      iconUrl: "packages/leaflet/images/marker-icon.png"
      shadowUrl: "packages/leaflet/images/marker-shadow.png"
      iconAnchor: [12, 41] #[iconWidth/2, iconHeight]
    )

Upvotes: 2

Related Questions