Skip to content

Commit

Permalink
Merge pull request #112 from koppelbakje/upstream/master
Browse files Browse the repository at this point in the history
Remove events in the latest leaflet build
  • Loading branch information
jacobtoye committed Apr 3, 2013
2 parents 493b5b5 + b3aae18 commit a39cdfb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/draw/handler/Draw.Marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},

Expand Down
10 changes: 5 additions & 5 deletions src/draw/handler/Draw.Polyline.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ 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;

// clean up DOM
this._clearGuides();

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

_finishShape: function () {
Expand Down Expand Up @@ -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);
}
},

Expand Down Expand Up @@ -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);
}
},

Expand Down
8 changes: 4 additions & 4 deletions src/edit/handler/EditToolbar.Delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
},
Expand All @@ -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);
}
},

Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/edit/handler/EditToolbar.Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand All @@ -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);
}
},

Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit a39cdfb

Please sign in to comment.