mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Fix navigator flip transformation
Flip transformation wasn't correctly applied on navigator for all images when its tileSource is flipped by default.
This commit is contained in:
parent
132c68c8bb
commit
2670f62892
@ -509,7 +509,7 @@ $.Drawer.prototype = {
|
||||
});
|
||||
}
|
||||
if((this.viewport.degrees == 0 && tiledImage.getRotation(true) % 360 !== 0) || (this.viewport.degrees !== 0 && tiledImage.getRotation(true) % 360 == 0)){
|
||||
if((this.viewport.getFlip() && !tiledImage.flipped) || (!this.viewport.getFlip() && tiledImage.flipped) ) {
|
||||
if((this.viewport.getFlip() && !tiledImage.getFlip()) || (!this.viewport.getFlip() && tiledImage.getFlip()) ) {
|
||||
this._flip();
|
||||
}
|
||||
}
|
||||
@ -648,7 +648,7 @@ $.Drawer.prototype = {
|
||||
context.translate(point.x, point.y);
|
||||
// If viewport and tiledImage are flipped, it would draw the image without flipping
|
||||
// This if sentence is intended to represent a logical XOR
|
||||
if((!this.viewer.viewport.getFlip() && this.viewer.world._items[0].flipped) || (this.viewer.viewport.getFlip() && !this.viewer.world._items[0].flipped)){
|
||||
if((!this.viewer.viewport.getFlip() && this.viewer.world._items[0].getFlip()) || (this.viewer.viewport.getFlip() && !this.viewer.world._items[0].getFlip())){
|
||||
context.rotate(Math.PI / 180 * -options.degrees);
|
||||
context.scale(-1, 1);
|
||||
} else{
|
||||
|
@ -351,8 +351,6 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
style.height = Math.round( Math.max( height, 0 ) ) + 'px';
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
// overrides Viewer.addTiledImage
|
||||
@ -456,6 +454,7 @@ function onCanvasClick( event ) {
|
||||
*/
|
||||
|
||||
this.viewer.raiseEvent('navigator-click', canvasClickEventArgs);
|
||||
|
||||
if ( !canvasClickEventArgs.preventDefaultAction && event.quick && this.viewer.viewport && (this.panVertical || this.panHorizontal)) {
|
||||
if((this.viewer.viewport.getFlip() && !this.world._items[0].getFlip()) || (!this.viewer.viewport.getFlip() && this.world._items[0].getFlip())) {
|
||||
event.position.x = this.viewport.getContainerSize().x - event.position.x;
|
||||
|
@ -271,7 +271,7 @@
|
||||
* events between different devices, causing the faster devices to slow down enough to make the zoom control
|
||||
* more manageable.
|
||||
*
|
||||
* @property {Number} [rotationIncrement=10]
|
||||
* @property {Number} [rotationIncrement=90]
|
||||
* The number of degrees to rotate right or left when the rotate buttons or keyboard shortcuts are activated.
|
||||
*
|
||||
* @property {Number} [pixelsPerWheelLine=40]
|
||||
|
@ -1902,6 +1902,7 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
}
|
||||
tiledImage._drawer._clear(true, bounds);
|
||||
}
|
||||
|
||||
// When scaling, we must rotate only when blending the sketch canvas to
|
||||
// avoid interpolation
|
||||
if (!sketchScale) {
|
||||
@ -2044,7 +2045,6 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
drawDebugInfo( tiledImage, lastDrawn );
|
||||
}
|
||||
|
||||
|
@ -2679,7 +2679,6 @@ function onCanvasClick( event ) {
|
||||
this.canvas.focus();
|
||||
}
|
||||
if((this.viewport.getFlip() && !this.world._items[0].getFlip()) || (!this.viewport.getFlip() && this.world._items[0].getFlip())){
|
||||
console.log("FLipped Click");
|
||||
event.position.x = this.viewport.getContainerSize().x - event.position.x;
|
||||
}
|
||||
|
||||
@ -3367,6 +3366,10 @@ function updateOnce( viewer ) {
|
||||
|
||||
THIS[ viewer.hash ].animating = animated;
|
||||
|
||||
// Update navigator flip transformation
|
||||
if (viewer.navigator && viewer.viewport != "undefined"){
|
||||
viewer.navigator.setFlip(viewer.viewport.getFlip());
|
||||
}
|
||||
//viewer.profiler.endUpdate();
|
||||
}
|
||||
|
||||
|
@ -1552,7 +1552,8 @@ $.Viewport.prototype = {
|
||||
|
||||
this.flipped = state;
|
||||
if(this.viewer.navigator){
|
||||
this.viewer.navigator.setFlip(this.getFlip());
|
||||
var flip = ((this.getFlip() || !this.viewer.world._items[0].getFlip()) || (!this.getFlip() || this.viewer.world._items[0].getFlip()));
|
||||
this.viewer.navigator.setFlip(flip);
|
||||
}
|
||||
this.viewer.forceRedraw();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user