]> git.proxmox.com Git - mirror_novnc.git/commitdiff
* Changed the trigger distance between touches from 50 to 20.
authorsamhed <samuel@cendio.se>
Mon, 8 Jul 2013 15:10:04 +0000 (17:10 +0200)
committersamhed <samuel@cendio.se>
Mon, 8 Jul 2013 15:14:50 +0000 (17:14 +0200)
* The trigger distance now takes devicePixelRatio into account.

include/input.js

index b286a4963eb7b922f73618919c1040f6f496cefd..dd16fa51f98ac9db0305433dafe6a426ede24a65 100644 (file)
@@ -541,20 +541,25 @@ function onMouseButton(e, down) {
         // Touch device
 
         // When two touches occur within 500 ms of each other and are
-        // closer than 50 pixels together a double click is triggered.
+        // closer than 20 pixels together a double click is triggered.
         if (down == 1) {
             if (doubleClickTimer == null) {
                 lastTouchPos = pos;
             } else {
                 clearTimeout(doubleClickTimer); 
 
+                // When the distance between the two touches is less than
+                // 20 physical pixels force the position of the latter touch 
+                // to the position of the first.
+
                 var xs = lastTouchPos.x - pos.x;
                 var ys = lastTouchPos.y - pos.y;
                 var d = Math.sqrt((xs * xs) + (ys * ys));
 
-                // When the distance between the two touches is less than 50 pixels
-                // force the position of the latter touch to the position of the first
-                if (d < 50) {
+                // The devicePixelRatio is the ratio between logical pixels and
+                // physical pixels. A devicePixelRatio of 2 means that the
+                // physical linear resolution is double the logical resolution.
+                if (d < 20 * window.devicePixelRatio) {
                     pos = lastTouchPos;
                 }
             }