Skip to content

Conversation

snkashis
Copy link
Member

Unsubscribe to drag events properly on marker removal.

Debug page included, code taken from @aparshin's fiddle. (http://jsfiddle.net/gpWQH/)

Fixes #1464


this.off('dragstart', this._onDragStart)
.off('drag', this._onDrag)
.off('dragend', this._onDragEnd);
Copy link
Member

Choose a reason for hiding this comment

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

Something's not right here... There are no such listeners on the draggable itself. Perhaps you wanted to do this on Map.Drag handlers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, I see. Looking into this.

@snkashis
Copy link
Member Author

How does this look @mourner? Debug page is running cleanly.

@mourner
Copy link
Member

mourner commented Feb 28, 2013

Looks good, thanks!

mourner added a commit that referenced this pull request Feb 28, 2013
handle drag listeners properly to avoid errors on marker removal
@mourner mourner merged commit b993f1f into Leaflet:master Feb 28, 2013
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.

Errors when remove draggable markers during drag
3 participants