Vertical and horizontal panning should "snap to" the appropriate axis. b=445716, r=gavin

This commit is contained in:
Johnathan Nightingale 2008-07-17 15:37:15 +02:00
Родитель 49f59656e9
Коммит f8a6435b22
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -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