diff --git a/src/drawer.js b/src/drawer.js index 7c4852cb..614e6cbe 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -500,10 +500,6 @@ $.Drawer.prototype = { if ( this.viewport.degrees !== 0 ) { this._offsetForRotation({degrees: this.viewport.degrees}); - } else{ - if(this.viewer.viewport.flipped) { - this._flip(); - } } if (tiledImage.getRotation(true) % 360 !== 0) { this._offsetForRotation({ @@ -512,6 +508,11 @@ $.Drawer.prototype = { tiledImage._getRotationPoint(true), true) }); } + if (tiledImage.viewport.degrees === 0 && tiledImage.getRotation(true) % 360 === 0){ + if(tiledImage._drawer.viewer.viewport.getFlip()) { + tiledImage._drawer._flip(); + } + } context.strokeRect( tile.position.x * $.pixelDensityRatio, @@ -577,6 +578,13 @@ $.Drawer.prototype = { if (tiledImage.getRotation(true) % 360 !== 0) { this._restoreRotationChanges(); } + + if (tiledImage.viewport.degrees === 0 && tiledImage.getRotation(true) % 360 === 0){ + if(tiledImage._drawer.viewer.viewport.getFlip()) { + tiledImage._drawer._flip(); + } + } + context.restore(); }, diff --git a/src/tiledimage.js b/src/tiledimage.js index 52012071..abe8c2da 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1675,7 +1675,7 @@ function blendTile( tiledImage, tile, x, y, level, levelOpacity, currentTime ){ tiledImage.lastDrawn.push( tile ); - if ( opacity == 1 ) { + if ( opacity === 1 ) { setCoverage( tiledImage.coverage, level, x, y, true ); tiledImage._hasOpaqueTile = true; } else if ( deltaTime < blendTimeMillis ) { @@ -1879,6 +1879,12 @@ function drawTiles( tiledImage, lastDrawn ) { tiledImage.getClippedBounds(true)) .getIntegerBoundingBox() .times($.pixelDensityRatio); + + if(tiledImage._drawer.viewer.viewport.getFlip()) { + 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); } @@ -1891,10 +1897,6 @@ function drawTiles( tiledImage, lastDrawn ) { degrees: tiledImage.viewport.degrees, useSketch: useSketch }); - } else { - if(tiledImage._drawer.viewer.viewport.flipped) { - tiledImage._drawer._flip({}); - } } if (tiledImage.getRotation(true) % 360 !== 0) { tiledImage._drawer._offsetForRotation({ @@ -1904,6 +1906,12 @@ function drawTiles( tiledImage, lastDrawn ) { useSketch: useSketch }); } + + if (tiledImage.viewport.degrees === 0 && tiledImage.getRotation(true) % 360 === 0){ + if(tiledImage._drawer.viewer.viewport.getFlip()) { + tiledImage._drawer._flip(); + } + } } var usedClip = false; @@ -1978,10 +1986,6 @@ function drawTiles( tiledImage, lastDrawn ) { } if (tiledImage.viewport.degrees !== 0) { tiledImage._drawer._restoreRotationChanges(useSketch); - } else{ - if(tiledImage._drawer.viewer.viewport.flipped) { - tiledImage._drawer._flip({}); - } } } @@ -2018,6 +2022,15 @@ function drawTiles( tiledImage, lastDrawn ) { } } } + + if (!sketchScale) { + if (tiledImage.viewport.degrees === 0 && tiledImage.getRotation(true) % 360 === 0){ + if(tiledImage._drawer.viewer.viewport.getFlip()) { + tiledImage._drawer._flip(); + } + } + } + drawDebugInfo( tiledImage, lastDrawn ); } diff --git a/src/viewport.js b/src/viewport.js index 3413dbc1..07c941c6 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -1531,7 +1531,7 @@ $.Viewport.prototype = { }, /** - * Gets flip state stored on viewport. + * Get flip state stored on viewport. * @function * @return {Boolean} Flip state. */