danzel / Leaflet.utfgrid

A UTFGrid implementation for leaflet that is super small.
MIT License
131 stars 51 forks source link

get pixel coordinates for mouse events #18

Open mwallisch opened 11 years ago

mwallisch commented 11 years ago

so this is more of a question than a real issue. Is it possible to get Screen coordinates for mouse events e.g. mouseover/mousemove? The only thing that I saw that might help me was the latlng Object that contains the map coordinates of the event. Is there any map-coordinates-to-pixel-coordinates conversion available for leaflet?

Regards, Markus

danzel commented 11 years ago

Right now we don't pass through the original mouse event or any of those bits, looks like it should be easy to add if you check out the _move function, probably just add the original event in there. (Would gladly accept a PR for this)

Otherwise in leaflet there is map.latLngToLayerPoint (and many other methods) that convert a latlng into pixels. See: http://leafletjs.com/reference.html#map-class and scroll down to "Conversion Methods"