diff --git a/src/handler/Handler.js b/src/handler/Handler.js index 3d6bf4f0..73c93c09 100644 --- a/src/handler/Handler.js +++ b/src/handler/Handler.js @@ -6,5 +6,9 @@ L.Handler = L.Class.extend({ initialize: function(map, enabled) { this._map = map; if (enabled) { this.enable(); } - } + }, + + enabled: function() { + return !!this._enabled; + } }); \ No newline at end of file diff --git a/src/handler/MapDrag.js b/src/handler/MapDrag.js index 392314e1..5277a75f 100644 --- a/src/handler/MapDrag.js +++ b/src/handler/MapDrag.js @@ -1,9 +1,10 @@ /* - * L.Handler.MapDrag makes the map draggable + * L.Handler.MapDrag is used internally by L.Map to make the map draggable. */ L.Handler.MapDrag = L.Handler.extend({ enable: function() { + if (this._enabled) { return; } if (!this._draggable) { this._draggable = new L.Draggable(this._map._mapPane, this._map._container); @@ -14,10 +15,13 @@ L.Handler.MapDrag = L.Handler.extend({ this._draggable.on('dragend', this._onDragEnd, this); } this._draggable.enable(); + this._enabled = true; }, disable: function() { + if (!this._enabled) { return; } this._draggable.disable(); + this._enabled = false; }, _fireViewLoad: function() { diff --git a/src/handler/TouchZoom.js b/src/handler/TouchZoom.js index e671d47e..6f028978 100644 --- a/src/handler/TouchZoom.js +++ b/src/handler/TouchZoom.js @@ -1,3 +1,7 @@ +/* + * L.Handler.TouchZoom is used internally by L.Map to add touch-zooming on Webkit-powered mobile browsers. + */ + L.Handler.TouchZoom = L.Handler.extend({ enable: function() { @@ -12,10 +16,6 @@ L.Handler.TouchZoom = L.Handler.extend({ this._enabled = false; }, - enabled: function() { - return !!this._enabled; - }, - _getClientPoint: function(e) { return new L.Point(e.clientX, e.clientY); },