Closed lthurner closed 3 years ago
If you change the Lines JS to (with latitudeKey: 1, longitudeKey: 0), the line is flipped but then the click event works.
lineLayer = L.glify.lines({
map: map,
opacity: 1.0,
weight: 1,
latitudeKey: 1,
longitudeKey: 0,
click: function (e, feature) {
L.popup()
.setLatLng(e.latlng)
.setContent("CLICKED LINE")
.openOn(map);
},
data: line_collection
});
Very interesting, thanks for this hint! When I change the line to lat=1, lon=0, the position of the line changes, and there is a popup. When I change it back to lat=0, lon=1, the line changes back to the old position, but the popup still opens when I click at the line position with lat=1, long=0.
So it seems the popup is always registered at lat/lon 0/1 even if the line is plotted at 1/0.
When I find the time I will look into the code to find the bug.
Thanks for this great package @robertleeplummerjr, makes it really easy to use WebGL with Leaflet! Much appreciated!
One issue I am struggling with though are line click events. Here is a small jsfiddle that plots one line and one point with a popup for both:
https://jsfiddle.net/4xdg1s7z/8/
I set up the click event for points and lines in the same way. The point click event works as expected and the popup appears when clicking the point. But nothing happens when clicking on the line. Am I setting something up wrong or is this a bug?
Thanks a lot for your help!
edit: not sure if this is related to #39. I added a console.log in the click event function that never prints, so it seems the click event never triggers. I don't think this is related to the popup, but somehow a problem with the event handler itself.