Skip to content
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

Fix canvas not filtering click event after drag #4493

Merged
merged 2 commits into from
Jun 1, 2016
Merged

Conversation

yohanboniface
Copy link
Member

Fix #4458

The issue come from the fact that we compute targets in a different way while in canvas or vector DOM, but we were now checking for drag only in the DOM scenario.
I've tried to refactor a bit to get the check only once, but I think this is not doable given that we are computing the targets in two totally distinct ways.
Note to @IvanSanchez I've added a happen.click on the test to simulate the click event after down/up, I'm open to a better suggestion :)

This PR also fixes preclick not being fired by canvas layers. It's in a separate commit and I think it should stay separate and not be rebased.

@balciseri
Copy link

balciseri commented Apr 23, 2016

great work, i tried this fix and it works like a charm

@@ -253,7 +253,7 @@ L.Canvas = L.Renderer.extend({

for (var id in this._layers) {
layer = this._layers[id];
if (layer.options.interactive && layer._containsPoint(point)) {
if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might it be possible to just remove the click listener while the map is dragged? I guess that would make it a bit clearer what's going on, and make it less coupled with Map's internals.

@mourner mourner merged commit 95d5b59 into master Jun 1, 2016
@mourner
Copy link
Member

mourner commented Jun 1, 2016

Damn, squashed accidentally — sorry! The commit has a link to PR and a summary though.

@perliedman this may be a better approach — let's follow up if necessary.

@mourner mourner deleted the canvas-preclick branch June 1, 2016 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canvas circleMarker fires 'click' after being dragged
4 participants