aratcliffe / Leaflet.contextmenu

A context menu for Leaflet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show latlng of the right-clicked point

Java-Jim opened this issue · 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?

commented

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