loleaflet/src/map/handler/Map.Drag.js | 40 ++++------------------------------ 1 file changed, 5 insertions(+), 35 deletions(-)
New commits: commit fdfd67c8c30ea8e616bfda0b9f82e248b69842b0 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Wed Aug 1 21:14:02 2018 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Wed Aug 1 21:22:20 2018 -0400 loleaflet: mobile: fix dragging the document layer Change-Id: I7047781926581c84ea8f1cb6576799d91099f6b5 diff --git a/loleaflet/src/map/handler/Map.Drag.js b/loleaflet/src/map/handler/Map.Drag.js index 9a54c7060..191516f50 100644 --- a/loleaflet/src/map/handler/Map.Drag.js +++ b/loleaflet/src/map/handler/Map.Drag.js @@ -10,9 +10,6 @@ L.Map.mergeOptions({ inertiaDeceleration: 3400, // px/s^2 inertiaMaxSpeed: Infinity, // px/s easeLinearity: 0.2, - - // TODO refactor, move to CRS - worldCopyJump: false }); L.Map.Drag = L.Handler.extend({ @@ -26,16 +23,10 @@ L.Map.Drag = L.Handler.extend({ this._draggable.on({ down: this._onDown, dragstart: this._onDragStart, + predrag: this._onPreDrag, drag: this._onDrag, dragend: this._onDragEnd }, this); - - if (map.options.worldCopyJump) { - this._draggable.on('predrag', this._onPreDrag, this); - map.on('viewreset', this._onViewReset, this); - - map.whenReady(this._onViewReset, this); - } } this._draggable.enable(); }, @@ -93,17 +84,10 @@ L.Map.Drag = L.Handler.extend({ }, _onPreDrag: function () { - // TODO refactor to be able to adjust map pane position after zoom - var worldWidth = this._worldWidth, - halfWidth = Math.round(worldWidth / 2), - dx = this._initialWorldOffset, - x = this._draggable._newPos.x, - newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx, - newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx, - newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2; - - this._draggable._absPos = this._draggable._newPos.clone(); - this._draggable._newPos.x = newX; + var org = this._map.getPixelOrigin(); + var size = this._map.getLayerMaxBounds().getSize().subtract(this._map.getSize()); + this._draggable._newPos.x = Math.max(Math.min(org.x, this._draggable._newPos.x), org.x - size.x); + this._draggable._newPos.y = Math.max(Math.min(org.y, this._draggable._newPos.y), org.y - size.y); }, _onDragEnd: function (e) { @@ -116,9 +100,7 @@ L.Map.Drag = L.Handler.extend({ if (noInertia) { map.fire('moveend'); - } else { - var direction = this._lastPos.subtract(this._positions[0]), duration = (this._lastTime - this._times[0]) / 1000, ease = options.easeLinearity, @@ -134,18 +116,6 @@ L.Map.Drag = L.Handler.extend({ if (!offset.x || !offset.y) { map.fire('moveend'); - - } else { - offset = map._limitOffset(offset, map.options.maxBounds); - - L.Util.requestAnimFrame(function () { - map.panBy(offset, { - duration: decelerationDuration, - easeLinearity: ease, - noMoveStart: true, - animate: true - }); - }); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits