Merge pull request #1549 from nelsonn3c/fix-flip-slides-when-using-opacity-and-multiple-slides

Fix flip slides when using opacity and multiple slides
This commit is contained in:
Ian Gilman 2018-10-22 11:18:39 -07:00 committed by GitHub
commit 65c8ff71a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 14 deletions

View File

@ -500,10 +500,6 @@ $.Drawer.prototype = {
if ( this.viewport.degrees !== 0 ) { if ( this.viewport.degrees !== 0 ) {
this._offsetForRotation({degrees: this.viewport.degrees}); this._offsetForRotation({degrees: this.viewport.degrees});
} else{
if(this.viewer.viewport.flipped) {
this._flip();
}
} }
if (tiledImage.getRotation(true) % 360 !== 0) { if (tiledImage.getRotation(true) % 360 !== 0) {
this._offsetForRotation({ this._offsetForRotation({
@ -512,6 +508,11 @@ $.Drawer.prototype = {
tiledImage._getRotationPoint(true), true) 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( context.strokeRect(
tile.position.x * $.pixelDensityRatio, tile.position.x * $.pixelDensityRatio,
@ -577,6 +578,13 @@ $.Drawer.prototype = {
if (tiledImage.getRotation(true) % 360 !== 0) { if (tiledImage.getRotation(true) % 360 !== 0) {
this._restoreRotationChanges(); this._restoreRotationChanges();
} }
if (tiledImage.viewport.degrees === 0 && tiledImage.getRotation(true) % 360 === 0){
if(tiledImage._drawer.viewer.viewport.getFlip()) {
tiledImage._drawer._flip();
}
}
context.restore(); context.restore();
}, },

View File

@ -1675,7 +1675,7 @@ function blendTile( tiledImage, tile, x, y, level, levelOpacity, currentTime ){
tiledImage.lastDrawn.push( tile ); tiledImage.lastDrawn.push( tile );
if ( opacity == 1 ) { if ( opacity === 1 ) {
setCoverage( tiledImage.coverage, level, x, y, true ); setCoverage( tiledImage.coverage, level, x, y, true );
tiledImage._hasOpaqueTile = true; tiledImage._hasOpaqueTile = true;
} else if ( deltaTime < blendTimeMillis ) { } else if ( deltaTime < blendTimeMillis ) {
@ -1879,6 +1879,12 @@ function drawTiles( tiledImage, lastDrawn ) {
tiledImage.getClippedBounds(true)) tiledImage.getClippedBounds(true))
.getIntegerBoundingBox() .getIntegerBoundingBox()
.times($.pixelDensityRatio); .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); tiledImage._drawer._clear(true, bounds);
} }
@ -1891,10 +1897,6 @@ function drawTiles( tiledImage, lastDrawn ) {
degrees: tiledImage.viewport.degrees, degrees: tiledImage.viewport.degrees,
useSketch: useSketch useSketch: useSketch
}); });
} else {
if(tiledImage._drawer.viewer.viewport.flipped) {
tiledImage._drawer._flip({});
}
} }
if (tiledImage.getRotation(true) % 360 !== 0) { if (tiledImage.getRotation(true) % 360 !== 0) {
tiledImage._drawer._offsetForRotation({ tiledImage._drawer._offsetForRotation({
@ -1904,6 +1906,12 @@ function drawTiles( tiledImage, lastDrawn ) {
useSketch: useSketch useSketch: useSketch
}); });
} }
if (tiledImage.viewport.degrees === 0 && tiledImage.getRotation(true) % 360 === 0){
if(tiledImage._drawer.viewer.viewport.getFlip()) {
tiledImage._drawer._flip();
}
}
} }
var usedClip = false; var usedClip = false;
@ -1978,10 +1986,6 @@ function drawTiles( tiledImage, lastDrawn ) {
} }
if (tiledImage.viewport.degrees !== 0) { if (tiledImage.viewport.degrees !== 0) {
tiledImage._drawer._restoreRotationChanges(useSketch); 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 ); drawDebugInfo( tiledImage, lastDrawn );
} }

View File

@ -1531,7 +1531,7 @@ $.Viewport.prototype = {
}, },
/** /**
* Gets flip state stored on viewport. * Get flip state stored on viewport.
* @function * @function
* @return {Boolean} Flip state. * @return {Boolean} Flip state.
*/ */