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

Only check for moving draggable in canvas renderer when map is draggable #3942

Merged
merged 3 commits into from
Oct 15, 2015

Conversation

klaftertief
Copy link
Contributor

This is a fix for #3941

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

_onMouseMove: function (e) {
if (!this._map || this._map.dragging._draggable._moving || this._map._animatingZoom) { return; }
if (!this._map || (this._map.dragging._enabled && this._map.dragging._draggable._moving) || this._map._animatingZoom) { return; }
Copy link
Member

Choose a reason for hiding this comment

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

This becomes a bit hard to follow, I wonder if we should not have a method on the L.Draggable object to make this more readable.
Something like this._map.dragging.moving() that would do both checks.

Copy link
Member

Choose a reason for hiding this comment

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

Also, this._map._dragging, inheriting from L.Handler has a enabled() method that should be used here instead of private property.

Copy link
Member

Choose a reason for hiding this comment

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

I agree. Should be a simple change, but let's look if we can update similar places to use the new method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. I'm happy to update the pull request later.

@yohanboniface
Copy link
Member

Good catch! See code comments :)

@yohanboniface yohanboniface added this to the 1.0-beta3 milestone Oct 15, 2015
@klaftertief
Copy link
Contributor Author

Ok, I just added a moving() method to the MapDrag handler, just like the moved() method there.
I didn't find any other occurrences of the _moving property, except in the Draggable class itself.

yohanboniface added a commit that referenced this pull request Oct 15, 2015
Only check for moving draggable in canvas renderer when map is draggable
@yohanboniface yohanboniface merged commit c2a3dc9 into Leaflet:master Oct 15, 2015
@klaftertief klaftertief deleted the fix-canvas-move branch October 15, 2015 19: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.

3 participants