From b3aae18a24a05f50a58f4585fa671ef3ec64fcbf Mon Sep 17 00:00:00 2001 From: Leon Koppel Date: Mon, 25 Mar 2013 14:13:59 +0100 Subject: [PATCH] Pass the polyline's context to the off function so the events will be removed in the latest leaflet build --- src/draw/handler/Draw.Polyline.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/draw/handler/Draw.Polyline.js b/src/draw/handler/Draw.Polyline.js index 959856f18..c3a1c21ae 100644 --- a/src/draw/handler/Draw.Polyline.js +++ b/src/draw/handler/Draw.Polyline.js @@ -94,7 +94,7 @@ L.Draw.Polyline = L.Draw.Feature.extend({ this._map.removeLayer(this._poly); delete this._poly; - this._mouseMarker.off('click', this._onClick); + this._mouseMarker.off('click', this._onClick, this); this._map.removeLayer(this._mouseMarker); delete this._mouseMarker; @@ -102,8 +102,8 @@ L.Draw.Polyline = L.Draw.Feature.extend({ this._clearGuides(); this._map - .off('mousemove', this._onMouseMove) - .off('zoomend', this._onZoomEnd); + .off('mousemove', this._onMouseMove, this) + .off('zoomend', this._onZoomEnd, this); }, _finishShape: function () { @@ -183,7 +183,7 @@ L.Draw.Polyline = L.Draw.Feature.extend({ // Remove the old marker click handler (as only the last point should close the polyline) if (this._markers.length > 2) { - this._markers[this._markers.length - 2].off('click', this._finishShape); + this._markers[this._markers.length - 2].off('click', this._finishShape, this); } }, @@ -348,7 +348,7 @@ L.Draw.Polyline = L.Draw.Feature.extend({ _cleanUpShape: function () { if (this._markers.length > 0) { - this._markers[this._markers.length - 1].off('click', this._finishShape); + this._markers[this._markers.length - 1].off('click', this._finishShape, this); } },