[Libreoffice-commits] online.git: loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 12 08:16:26 UTC 2019


 loleaflet/src/layer/tile/TileLayer.js |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 04597b4ec1affc1d5bc57ba2e4e1a3844615a136
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Feb 11 13:55:06 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Feb 12 09:16:06 2019 +0100

    Hack to make it easier to drag selection handles vertically on touch devices
    
    Change-Id: I33d03d1378ff5bbce094d5de30ab8d51d38efe0d
    Reviewed-on: https://gerrit.libreoffice.org/67685
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 7c23669ed..853d7e7be 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1976,18 +1976,21 @@ L.TileLayer = L.GridLayer.extend({
 
 			var expectedPos = L.point(e.originalEvent.pageX, e.originalEvent.pageY).subtract(e.target.dragging._draggable.startOffset);
 
-			// If the map has been scrolled, but the cursor hasn't been updated yet, then
-			// the current mouse position differs.
-			if (!expectedPos.equals(cursorPos)) {
-				var correction = expectedPos.subtract(cursorPos);
-
-				e.target.dragging._draggable._startPoint = e.target.dragging._draggable._startPoint.add(correction);
-				e.target.dragging._draggable._startPos = e.target.dragging._draggable._startPos.add(correction);
-				e.target.dragging._draggable._newPos = e.target.dragging._draggable._newPos.add(correction);
-
-				e.target.dragging._draggable._updatePosition();
+			// Dragging the selection handles vertically more than one line on a touch
+			// device is more or less impossible without this hack.
+			if (!(typeof e.originalEvent.type === 'string' && e.originalEvent.type === 'touchmove')) {
+				// If the map has been scrolled, but the cursor hasn't been updated yet, then
+				// the current mouse position differs.
+				if (!expectedPos.equals(cursorPos)) {
+					var correction = expectedPos.subtract(cursorPos);
+
+					e.target.dragging._draggable._startPoint = e.target.dragging._draggable._startPoint.add(correction);
+					e.target.dragging._draggable._startPos = e.target.dragging._draggable._startPos.add(correction);
+					e.target.dragging._draggable._newPos = e.target.dragging._draggable._newPos.add(correction);
+
+					e.target.dragging._draggable._updatePosition();
+				}
 			}
-
 			var containerPos = new L.Point(expectedPos.x - this._map._container.getBoundingClientRect().left,
 				expectedPos.y - this._map._container.getBoundingClientRect().top);
 


More information about the Libreoffice-commits mailing list