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

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Sun Feb 23 21:04:47 UTC 2020


 loleaflet/src/map/handler/Map.TouchGesture.js |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit ecab3d959854f5955d165f8a6b9b8ea01447f1d7
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Feb 22 11:26:14 2020 -0500
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Sun Feb 23 22:04:30 2020 +0100

    leaflet: tolerate larger multi-tap threshold
    
    When double-tapping (or tripple) the user is almost
    always going to place their finger at different
    coordinates for each of the taps. There is a default
    threshold of 10 units between the taps in Hammer
    to tolerate for this error when detecting multiple
    taps, rather than individual taps.
    
    This threshold of 10 is really small and unrealistic
    for our needs, as in most cases double-tapping (which
    we use very often to select words and begin editing
    in Impress) is not detected (single-taps are issued
    instead). This makes interaction/usability very hard.
    
    Here we increase the threshold to a comfortable 100.
    If this causes any other usability issues, we can
    lower it acccordingly, but so far it only improved
    the experience for me.
    
    Change-Id: I3fee43c3efaa4507cae09b7c564cb4c0c1b5384e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89310
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 3259f94d5..c0d4bb4ce 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -48,7 +48,14 @@ L.Map.TouchGesture = L.Handler.extend({
 
 			var singleTap = this._hammer.get('tap');
 			var doubleTap = this._hammer.get('doubletap');
-			var tripleTap = new Hammer.Tap({event: 'tripletap', taps: 3 });
+
+			// Multi-tap detection tolerates a slight change in coordinates
+			// between the taps. The default of 10 is too small for our needs.
+			// So we use something more sensible to make it easier for users.
+			var posThreshold = 100;
+			doubleTap.options.posThreshold = posThreshold;
+
+			var tripleTap = new Hammer.Tap({event: 'tripletap', taps: 3, posThreshold: posThreshold });
 			this._hammer.add(tripleTap);
 			tripleTap.recognizeWith([doubleTap, singleTap]);
 


More information about the Libreoffice-commits mailing list