From 12be95c8c3526f99717dba728a347826da613fcd Mon Sep 17 00:00:00 2001 From: Francesco Cretti Date: Sun, 11 Mar 2018 13:05:19 +0100 Subject: [PATCH] getCenter fixed when clicking on minimap --- src/navigator.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/navigator.js b/src/navigator.js index 45b56b6c..84e3ad51 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -406,21 +406,13 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* */ function onCanvasClick( event ) { if (event.quick && this.viewer.viewport && (this.panVertical || this.panHorizontal)) { - var target, - posX, - posY; + var target = this.viewport.pointFromPixel(event.position); if (!this.panVertical) { // perform only horizonal pan - posX = this.viewport.pointFromPixel(event.position).x; - posY = this.viewport.getCenter().y; - target = new $.Point(posX, posY); + target.y = this.viewer.viewport.getCenter(true).y; } else if (!this.panHorizontal) { // perform only vertical pan - posX = this.viewport.getCenter().x; - posY = this.viewport.pointFromPixel(event.position).y; - target = new $.Point(posX, posY); - } else { - target = this.viewport.pointFromPixel(event.position); + target.x = this.viewer.viewport.getCenter(true).x; } this.viewer.viewport.panTo(target); this.viewer.viewport.applyConstraints();