Permalink
Browse files

Cleanup code

  • Loading branch information...
1 parent 6d38bfc commit 9ae1ebaf44275704382352cc0b2f61a1d6c2b4fa @jacobtoye jacobtoye committed Jan 12, 2014
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/edit/handler/EditToolbar.Delete.js
View
7 src/edit/handler/EditToolbar.Delete.js
@@ -26,24 +26,27 @@ L.EditToolbar.Delete = L.Handler.extend({
return;
}
this.fire('enabled', { handler: this.type});
- //this disable other handlers
this._map.fire('draw:deletestart', { handler: this.type });
- //allow drawLayer to be updated before beginning deletion.
L.Handler.prototype.enable.call(this);
+
this._deletableLayers
.on('layeradd', this._enableLayerDelete, this)
.on('layerremove', this._disableLayerDelete, this);
},
disable: function () {
if (!this._enabled) { return; }
+
this._deletableLayers
.off('layeradd', this._enableLayerDelete, this)
.off('layerremove', this._disableLayerDelete, this);
+
L.Handler.prototype.disable.call(this);
+
this._map.fire('draw:deletestop', { handler: this.type });
+
this.fire('disabled', { handler: this.type});
},

0 comments on commit 9ae1eba

Please sign in to comment.