mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
navigato minimap onClick vertical/horizontal pan fix
This commit is contained in:
parent
784f470744
commit
027dac0d8e
@ -405,10 +405,26 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
* @function
|
||||
*/
|
||||
function onCanvasClick( event ) {
|
||||
if ( event.quick && this.viewer.viewport ) {
|
||||
this.viewer.viewport.panTo(this.viewport.pointFromPixel(event.position));
|
||||
this.viewer.viewport.applyConstraints();
|
||||
if (event.quick && this.viewer.viewport && (this.panVertical || this.panHorizontal)) {
|
||||
var target,
|
||||
posX,
|
||||
posY;
|
||||
if (!this.panVertical) {
|
||||
// perform only horizonal pan
|
||||
posX = this.viewport.pointFromPixel(event.position).x;
|
||||
posY = this.viewport.getCenter().y;
|
||||
target = new $.Point(posX, posY);
|
||||
} 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);
|
||||
}
|
||||
this.viewer.viewport.panTo(target);
|
||||
this.viewer.viewport.applyConstraints();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user