Leaflet.contextmenu icon indicating copy to clipboard operation
Leaflet.contextmenu copied to clipboard

Show latlng of the right-clicked point

Open Java-Jim opened this issue 7 years ago • 1 comments

I have the problem that when a contextmenu item is clicked and in the corresponding callback function alert(e.latlng); is used, the resulting coordinate does not belong to the origin of the mouseclick event but rather to the point where the mousepointer is after selecting the contextmenu item. So the latlng is slightly offset to lower right of the click point. The lower the zoomlevel is the higher is the deviation between the clickpoint and reported coordinate.

How can i access the latlng coordinate of the mouseclick position independent how far i travel in the contextmenu with the mouse after right clicking on the map?

Java-Jim avatar Dec 08 '17 15:12 Java-Jim

in this file: https://github.com/aratcliffe/Leaflet.contextmenu/blob/master/dist/leaflet.contextmenu.js

                containerPoint = me._showLocation.containerPoint,
                layerPoint = map.containerPointToLayerPoint(containerPoint),
                latlng = map.layerPointToLatLng(layerPoint),
                relatedTarget = me._showLocation.relatedTarget,

maybe the errors caused by multiple conversions

Wnbo avatar Oct 26 '22 12:10 Wnbo