From f8a6435b224787232295e961103d855c0238b2c5 Mon Sep 17 00:00:00 2001 From: Johnathan Nightingale Date: Thu, 17 Jul 2008 15:37:15 +0200 Subject: [PATCH] Vertical and horizontal panning should "snap to" the appropriate axis. b=445716, r=gavin --- mobile/chrome/content/deckbrowser.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mobile/chrome/content/deckbrowser.xml b/mobile/chrome/content/deckbrowser.xml index bee24ae8f98e..3c649e769f7c 100644 --- a/mobile/chrome/content/deckbrowser.xml +++ b/mobile/chrome/content/deckbrowser.xml @@ -520,6 +520,16 @@ var dx = this.deckbrowser.dragData.sX - aEvent.screenX; var dy = this.deckbrowser.dragData.sY - aEvent.screenY; + // Filter out noise in big panning operations which are + // almost certainly intended to be on-axis horizontal or + // vertical pans. + if (Math.abs(dx) > 40 || Math.abs(dy) > 40) { + if (Math.abs(dx/dy) < 0.3) // dx is a lot less than dy, probably a vertical drag + dx = 0; + else if (Math.abs(dy/dx) < 0.3) // probably a horizontal drag + dy = 0; + } + this.deckbrowser._moveCanvas(dx, dy); if (Date.now() - this.deckbrowser.dragData.lastMouseEvent < 75) { // FIXME: make this a constant