New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canvas circleMarker fires 'click' after being dragged #4458
Comments
http://playground-leaflet.rhcloud.com/tij/1/edit?html,js,output Maybe this can fix it: I've found in an older version ( Leaflet 1.0.0-beta.2 (55fe462))
in So i added it back in the actual rc1 and the bug seems fixed. |
@balciseri That code was changed in 64484d5 by @yohanboniface , as a fix for #3971. It is important to not introduce that bug back. |
http://playground-leaflet.rhcloud.com/pav/1/edit?html,js,console,output I'm trying to reproduce that bug but it's seems to not happen ( i made the marker draggable and with no popup and the map click event is not firing after dragging it) Edit: wrong link. |
But i see there is this new bug: When you click on the markers the Map click event will trigger.. |
Event delegation is a feature in 1.0.0, not a bug ;-) |
Sweet so now if you guys find an elegant way of implementing this double check fix would be awesome :D |
@IvanSanchez after looking better into it i see what you mean. |
That needs a decision ;) By default, in 1.0.0 version, an event that is not stopped should bubble to the map. But we have made an exception for marker, in the hope of making the life of the Leaflet user easier, see #3605 (comment) for context. Now, CircleMarker is a Path descendant, so it does not inherit this hack. I'm unsure if we should add the same hack here. BTW, given there is not this behaviour when using SVG instead, this seems to mean that the problem is elsewhere. I'll work on this asap (but at the office right now). |
* Fix preclick not fired in canvas * Do not add canvas layers to click event targets if just dragged (fix #4458)
https://playground-leaflet.rhcloud.com/yaq/edit
Scenario:
Map initialized with
preferCanvas: true
.Added a circleMarker
Bug: if you start the drag of the map while having the cursor ontop of the circlemarker and you stop the drag with the cursor still on the circleMarker the click event will fire ( i'm just assuming it's a click event) and the popup will open.
This is not the default behaviour, if you set
preferCanvas: false
this will not happen.I've found an intresting piece of code https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L969 but i don't know how to fix this for canvas markers.
EDit: the bug occurs also if you don't actually start the drag with the cursor ontop of the marker, it has just to be ontop of the marker when you end the drag
The text was updated successfully, but these errors were encountered: