From efa8ccff35da1dc6878b75e7fb7307dce20b8b5a Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 5 May 2015 17:20:20 -0700 Subject: [PATCH] * Keyboard pan speed is now the same regardless of zoom level (#645) --- changelog.txt | 1 + src/viewer.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index d5f3f231..9b79f56a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -60,6 +60,7 @@ OPENSEADRAGON CHANGELOG * Optimized tile loading by clearing the queue on a re-draw when imageLoaderLimit is set (#616) * Now animating zoom spring exponentially (#631) * Added http://editorconfig.org/ config file (#637) +* Keyboard pan speed is now the same regardless of zoom level (#645) 1.2.1: diff --git a/src/viewer.js b/src/viewer.js index 2be3786e..c8de84f3 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2216,7 +2216,7 @@ function onCanvasKeyDown( event ) { if ( event.shift ) { this.viewport.zoomBy(1.1); } else { - this.viewport.panBy(new $.Point(0, -0.05)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, -40))); } this.viewport.applyConstraints(); return false; @@ -2224,16 +2224,16 @@ function onCanvasKeyDown( event ) { if ( event.shift ) { this.viewport.zoomBy(0.9); } else { - this.viewport.panBy(new $.Point(0, 0.05)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, 40))); } this.viewport.applyConstraints(); return false; case 37://left arrow - this.viewport.panBy(new $.Point(-0.05, 0)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-40, 0))); this.viewport.applyConstraints(); return false; case 39://right arrow - this.viewport.panBy(new $.Point(0.05, 0)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(40, 0))); this.viewport.applyConstraints(); return false; default: @@ -2265,7 +2265,7 @@ function onCanvasKeyPress( event ) { if ( event.shift ) { this.viewport.zoomBy(1.1); } else { - this.viewport.panBy(new $.Point(0, -0.05)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, -40))); } this.viewport.applyConstraints(); return false; @@ -2274,16 +2274,16 @@ function onCanvasKeyPress( event ) { if ( event.shift ) { this.viewport.zoomBy(0.9); } else { - this.viewport.panBy(new $.Point(0, 0.05)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, 40))); } this.viewport.applyConstraints(); return false; case 97://a - this.viewport.panBy(new $.Point(-0.05, 0)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-40, 0))); this.viewport.applyConstraints(); return false; case 100://d - this.viewport.panBy(new $.Point(0.05, 0)); + this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(40, 0))); this.viewport.applyConstraints(); return false; default: