From cf20d9fb43bb6f301ebc368ea1c025c19335641c Mon Sep 17 00:00:00 2001 From: Nelson Campos Date: Tue, 16 Oct 2018 17:24:26 +0100 Subject: [PATCH] Fix drawer clearance bounds --- src/openseadragon.js | 4 ++-- src/tiledimage.js | 35 +++++++++++------------------------ 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 784d3e78..30cf6ed3 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -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=90] + * @property {Number} [rotationIncrement=10] * The number of degrees to rotate right or left when the rotate buttons or keyboard shortcuts are activated. * * @property {Number} [pixelsPerWheelLine=40] @@ -1140,7 +1140,7 @@ function OpenSeadragon( options ){ autoResize: true, preserveImageSizeOnResize: false, // requires autoResize=true minScrollDeltaTime: 50, - rotationIncrement: 10, + rotationIncrement: 90, //DEFAULT CONTROL SETTINGS showSequenceControl: true, //SEQUENCE diff --git a/src/tiledimage.js b/src/tiledimage.js index eeb5a686..d09b8857 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1884,21 +1884,14 @@ function drawTiles( tiledImage, lastDrawn ) { .getIntegerBoundingBox() .times($.pixelDensityRatio); - // if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) { - // tiledImage._drawer._flip({}); - // bounds.width = bounds.width - bounds.x; - // bounds.width = tiledImage._drawer.viewer.viewport.getContainerSize().width - bounds.x; - // console.log("BOUNDS before: ", bounds); - - // bounds.width = bounds.width + bounds.x; - // bounds.x = -bounds.x; - // console.log("Bounds Image: ", tiledImage._drawer.viewer.viewport.getContainerSize()); - // } + if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) { + if (tiledImage.viewport.degrees !== 0 || tiledImage.getRotation(true) % 360 !== 0){ + bounds.x = tiledImage._drawer.viewer.container.clientWidth - (bounds.x + bounds.width); + } + } } tiledImage._drawer._clear(true, bounds); } - console.log("BOUNDS after: ", bounds); - // When scaling, we must rotate only when blending the sketch canvas to // avoid interpolation if (!sketchScale) { @@ -1919,7 +1912,6 @@ function drawTiles( tiledImage, lastDrawn ) { if (tiledImage.viewport.degrees == 0 && tiledImage.getRotation(true) % 360 == 0){ if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) { - console.log("FLIP1"); tiledImage._drawer._flip({}); } } @@ -1998,13 +1990,6 @@ function drawTiles( tiledImage, lastDrawn ) { if (tiledImage.viewport.degrees !== 0) { tiledImage._drawer._restoreRotationChanges(useSketch); } - - // if (tiledImage.viewport.degrees == 0 && tiledImage.getRotation(true) % 360 == 0){ - // if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) { - // console.log("FLIP2"); - // tiledImage._drawer._flip({}); - // } - // } } if (useSketch) { @@ -2041,13 +2026,15 @@ function drawTiles( tiledImage, lastDrawn ) { } } - if (tiledImage.viewport.degrees == 0 && tiledImage.getRotation(true) % 360 == 0){ - if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) { - console.log("FLIP3"); - tiledImage._drawer._flip({}); + if (!sketchScale) { + if (tiledImage.viewport.degrees == 0 && tiledImage.getRotation(true) % 360 == 0){ + if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) { + tiledImage._drawer._flip({}); + } } } + drawDebugInfo( tiledImage, lastDrawn ); }