From 0111025cd1cae749d82b876082d7d4e9a40cb41c Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Sun, 5 Sep 2010 07:23:01 -0700 Subject: [PATCH] Bug 593499 - Increase the double-tap thresholds [r=mfinkle] --- mobile/chrome/content/InputHandler.js | 2 +- mobile/chrome/content/browser.js | 8 +++++--- mobile/chrome/content/content.js | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mobile/chrome/content/InputHandler.js b/mobile/chrome/content/InputHandler.js index 7f2fdebec711..6695e16e5f50 100644 --- a/mobile/chrome/content/InputHandler.js +++ b/mobile/chrome/content/InputHandler.js @@ -46,7 +46,7 @@ const kDoubleClickInterval = 400; // threshold in ms to detect if the click is possibly a dblClick -const kDoubleClickThreshold = 200; +const kDoubleClickThreshold = 300; // threshold in pixels for sensing a tap as opposed to a pan const kTapRadius = 25; diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 310c80a6f770..4c3bac39fdf7 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -1632,11 +1632,13 @@ ContentCustomClicker.prototype = { this._dispatchMouseEvent("Browser:MouseCancel"); - const kDoubleClickRadius = 32; + const kDoubleClickRadius = 100; let maxRadius = kDoubleClickRadius * Browser._browserView.getZoomLevel(); - let isClickInRadius = (Math.abs(aX1 - aX2) < maxRadius && Math.abs(aY1 - aY2) < maxRadius); - if (isClickInRadius) + let dx = aX2 - aX1; + let dy = aY1 - aY2; + + if (dx*dx + dy*dy < maxRadius*maxRadius) this._dispatchMouseEvent("Browser:ZoomToPoint", aX1, aY1); }, diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js index a88182d5b84b..0520ac7c9390 100644 --- a/mobile/chrome/content/content.js +++ b/mobile/chrome/content/content.js @@ -2,7 +2,7 @@ dump("###################################### content loaded\n"); // how many milliseconds before the mousedown and the overlay of an element -const kTapOverlayTimeout = 200; +const kTapOverlayTimeout = 300; let Cc = Components.classes; let Ci = Components.interfaces; @@ -501,7 +501,7 @@ Content.prototype = { // We add a few milliseconds because of how the InputHandler wait before // dispatching a single click (default: 500) - this._contextTimeout.once(500 + 200, function() { + this._contextTimeout.once(500 + kTapOverlayTimeout, function() { let event = content.document.createEvent("PopupEvents"); event.initEvent("contextmenu", true, true); element.dispatchEvent(event);