MapDrag optimization

This commit is contained in:
mourner 2010-09-21 18:36:52 +03:00
parent 1844c1156d
commit db14ecaa7e

View File

@ -8,7 +8,14 @@ L.Handler.MapDrag = L.Handler.extend({
if (!this._draggable) {
this._draggable = new L.Draggable(this._map._mapPane, this._map._container);
this._fireViewLoad = L.Util.limitExecByInterval(this._fireViewLoad, 200, this, true);
//optimizes map dragging in FF on big screens
var size = this._map.getSize();
if (size.x * size.y >= 7e5 && L.Browser.gecko) {
this._draggable._updatePosition = L.Util.deferExecByInterval(
this._draggable._updatePosition, 0, this._draggable);
}
this._deferredFireViewLoad = L.Util.deferExecByInterval(this._fireViewLoad, 200, this);
this._draggable.on('dragstart', this._onDragStart, this);
this._draggable.on('drag', this._onDrag, this);
@ -36,7 +43,7 @@ L.Handler.MapDrag = L.Handler.extend({
_onDrag: function() {
this._map.fire('move');
this._map.fire('drag');
if (!this._map.options.viewLoadOnDragEnd) { this._fireViewLoad(); }
if (!this._map.options.viewLoadOnDragEnd) { this._deferredFireViewLoad(); }
},
_onDragEnd: function() {