Cleaner code for L.Map._onMoveEnd

This commit is contained in:
Yohan Boniface 2015-09-11 12:20:51 +02:00
parent c5172f3088
commit 5f1b230bda

View File

@ -613,7 +613,9 @@ L.Map = L.Evented.extend({
L.DomEvent[onOff](window, 'resize', this._onResize, this); L.DomEvent[onOff](window, 'resize', this._onResize, this);
} }
if (L.Browser.any3d && this.options.transform3DLimit) {
this[onOff]('moveend', this._onMoveEnd); this[onOff]('moveend', this._onMoveEnd);
}
}, },
_onResize: function () { _onResize: function () {
@ -628,9 +630,8 @@ L.Map = L.Evented.extend({
}, },
_onMoveEnd: function () { _onMoveEnd: function () {
if (L.Browser.any3d && this.options.transform3DLimit && var pos = this._getMapPanePos();
(Math.abs(this._mapPane._leaflet_pos.x) >= this.options.transform3DLimit if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {
|| Math.abs(this._mapPane._leaflet_pos.y) >= this.options.transform3DLimit)) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have
// a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/ // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/
this._resetView(this.getCenter(), this.getZoom()); this._resetView(this.getCenter(), this.getZoom());