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

Remove events in the latest leaflet build #112

Merged
merged 3 commits into from
Apr 3, 2013
Merged

Remove events in the latest leaflet build #112

merged 3 commits into from
Apr 3, 2013

Conversation

koppelbakje
Copy link
Contributor

Since Leaflet/Leaflet@a1acaff there are two more conditions added in the last if-statement removeEventListener function. When the contextId is undefined the events won't be removed. It should be solved by passing the marker its context to the off calls in the removeHooks.

removeHooks: function () {
        L.Draw.Feature.prototype.removeHooks.call(this);

        if (this._map) {
            if (this._marker) {
                this._marker.off('click', this._onClick, this);
                this._map
                    .off('click', this._onClick, this)
                    .removeLayer(this._marker);
                delete this._marker;
            }

            this._mouseMarker.off('click', this._onClick, this);
            this._map.removeLayer(this._mouseMarker);
            delete this._mouseMarker;

            this._map.off('mousemove', this._onMouseMove, this);
        }
    }

EDIT: besides Draw.Marker the similar problem also existed in Draw.PolyLine, EditToolbar.Delete and EditToolbar.Edit

@jacobtoye
Copy link
Member

Nice, thanks!

jacobtoye added a commit that referenced this pull request Apr 3, 2013
Remove events in the latest leaflet build
@jacobtoye jacobtoye merged commit a39cdfb into Leaflet:master Apr 3, 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.

2 participants