diff --git a/src/draw/handler/Draw.Marker.js b/src/draw/handler/Draw.Marker.js index e8fdc711a..239bce229 100644 --- a/src/draw/handler/Draw.Marker.js +++ b/src/draw/handler/Draw.Marker.js @@ -47,18 +47,18 @@ L.Draw.Marker = L.Draw.Feature.extend({ if (this._map) { if (this._marker) { - this._marker.off('click', this._onClick); + this._marker.off('click', this._onClick, this); this._map - .off('click', this._onClick) + .off('click', this._onClick, this) .removeLayer(this._marker); delete this._marker; } - this._mouseMarker.off('click', this._onClick); + this._mouseMarker.off('click', this._onClick, this); this._map.removeLayer(this._mouseMarker); delete this._mouseMarker; - this._map.off('mousemove', this._onMouseMove); + this._map.off('mousemove', this._onMouseMove, this); } }, 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); } }, diff --git a/src/edit/handler/EditToolbar.Delete.js b/src/edit/handler/EditToolbar.Delete.js index fe79ebf73..9db851432 100644 --- a/src/edit/handler/EditToolbar.Delete.js +++ b/src/edit/handler/EditToolbar.Delete.js @@ -39,8 +39,8 @@ L.EditToolbar.Delete = L.Handler.extend({ L.Handler.prototype.disable.call(this); this._deletableLayers - .off('layeradd', this._enableLayerDelete) - .off('layerremove', this._disableLayerDelete); + .off('layeradd', this._enableLayerDelete, this) + .off('layerremove', this._disableLayerDelete, this); this.fire('disabled', { handler: this.type}); }, @@ -65,7 +65,7 @@ L.EditToolbar.Delete = L.Handler.extend({ this._tooltip.dispose(); this._tooltip = null; - this._map.off('mousemove', this._onMouseMove); + this._map.off('mousemove', this._onMouseMove, this); } }, @@ -89,7 +89,7 @@ L.EditToolbar.Delete = L.Handler.extend({ _disableLayerDelete: function (e) { var layer = e.layer || e.target || e; - layer.off('click', this._removeLayer); + layer.off('click', this._removeLayer, this); // Remove from the deleted layers so we can't accidently revert if the user presses cancel this._deletedLayers.removeLayer(layer); diff --git a/src/edit/handler/EditToolbar.Edit.js b/src/edit/handler/EditToolbar.Edit.js index 2d28f8c6f..3d04f2612 100644 --- a/src/edit/handler/EditToolbar.Edit.js +++ b/src/edit/handler/EditToolbar.Edit.js @@ -56,8 +56,8 @@ L.EditToolbar.Edit = L.Handler.extend({ this.fire('disabled', {handler: this.type}); this._featureGroup - .off('layeradd', this._enableLayerEdit) - .off('layerremove', this._disableLayerEdit); + .off('layeradd', this._enableLayerEdit, this) + .off('layerremove', this._disableLayerEdit, this); L.Handler.prototype.disable.call(this); }, @@ -84,7 +84,7 @@ L.EditToolbar.Edit = L.Handler.extend({ this._tooltip.dispose(); this._tooltip = null; - this._map.off('mousemove', this._onMouseMove); + this._map.off('mousemove', this._onMouseMove, this); } }, @@ -216,7 +216,7 @@ L.EditToolbar.Edit = L.Handler.extend({ if (layer instanceof L.Marker) { layer.dragging.disable(); - layer.off('dragend', this._onMarkerDragEnd); + layer.off('dragend', this._onMarkerDragEnd, this); } else { layer.editing.disable(); }