Merge pull request #727 from TMUND/toni

Fixed placeholderFillStyle flicker
This commit is contained in:
Ian Gilman 2015-09-16 09:34:46 -07:00
commit 0003b1c193
2 changed files with 7 additions and 1 deletions

View File

@ -265,6 +265,8 @@ $.Tile.prototype = /** @lends OpenSeadragon.Tile.prototype */{
return; return;
} }
context.save();
context.globalAlpha = this.opacity; context.globalAlpha = this.opacity;
//if we are supposed to be rendering fully opaque rectangle, //if we are supposed to be rendering fully opaque rectangle,
@ -298,6 +300,8 @@ $.Tile.prototype = /** @lends OpenSeadragon.Tile.prototype */{
size.x * $.pixelDensityRatio, size.x * $.pixelDensityRatio,
size.y * $.pixelDensityRatio size.y * $.pixelDensityRatio
); );
context.restore();
}, },
/** /**

View File

@ -130,6 +130,7 @@ $.TiledImage = function( options ) {
lastResetTime: 0, // Last time for which the tiledImage was reset. lastResetTime: 0, // Last time for which the tiledImage was reset.
_midDraw: false, // Is the tiledImage currently updating the viewport? _midDraw: false, // Is the tiledImage currently updating the viewport?
_needsDraw: true, // Does the tiledImage need to update the viewport again? _needsDraw: true, // Does the tiledImage need to update the viewport again?
_hasOpaqueTile: false, // Do we have even one fully opaque tile?
//configurable settings //configurable settings
springStiffness: $.DEFAULT_SETTINGS.springStiffness, springStiffness: $.DEFAULT_SETTINGS.springStiffness,
@ -1163,6 +1164,7 @@ function blendTile( tiledImage, tile, x, y, level, levelOpacity, currentTime ){
if ( opacity == 1 ) { if ( opacity == 1 ) {
setCoverage( tiledImage.coverage, level, x, y, true ); setCoverage( tiledImage.coverage, level, x, y, true );
tiledImage._hasOpaqueTile = true;
} else if ( deltaTime < blendTimeMillis ) { } else if ( deltaTime < blendTimeMillis ) {
return true; return true;
} }
@ -1311,7 +1313,7 @@ function drawTiles( tiledImage, lastDrawn ) {
usedClip = true; usedClip = true;
} }
if ( tiledImage.placeholderFillStyle && lastDrawn.length === 0 ) { if ( tiledImage.placeholderFillStyle && tiledImage._hasOpaqueTile === false ) {
var placeholderRect = tiledImage._drawer.viewportToDrawerRectangle(tiledImage.getBounds(true)); var placeholderRect = tiledImage._drawer.viewportToDrawerRectangle(tiledImage.getBounds(true));
var fillStyle = null; var fillStyle = null;