diff --git a/src/canvasdrawer.js b/src/canvasdrawer.js index a637fb39..37b8c3bb 100644 --- a/src/canvasdrawer.js +++ b/src/canvasdrawer.js @@ -102,7 +102,7 @@ class CanvasDrawer extends $.DrawerBase{ this._prepareNewFrame(); // prepare to draw a new frame for(const tiledImage of tiledImages){ - if (tiledImage.opacity !== 0 || tiledImage._preload) { + if (tiledImage.opacity !== 0) { this._drawTiles(tiledImage); } } diff --git a/src/htmldrawer.js b/src/htmldrawer.js index a9030702..6e154095 100644 --- a/src/htmldrawer.js +++ b/src/htmldrawer.js @@ -89,7 +89,7 @@ class HTMLDrawer extends $.DrawerBase{ var _this = this; this._prepareNewFrame(); // prepare to draw a new frame tiledImages.forEach(function(tiledImage){ - if (tiledImage.opacity !== 0 || tiledImage._preload) { + if (tiledImage.opacity !== 0) { _this._drawTiles(tiledImage); } }); diff --git a/src/tiledimage.js b/src/tiledimage.js index 0b1862a7..a1c3054b 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1020,9 +1020,14 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag /** * Get the region of this tiled image that falls within the viewport. * @returns {OpenSeadragon.Rect} the region of this tiled image that falls within the viewport. + * Returns false for images with opacity==0 unless preload==true */ getDrawArea: function(){ + if( this._opacity === 0 && !this._preload){ + return false; + } + var drawArea = this._viewportToTiledImageRectangle( this.viewport.getBoundsWithMargins(true)); diff --git a/src/webgldrawer.js b/src/webgldrawer.js index a3cda706..046c33e4 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -222,7 +222,7 @@ let tilesToDraw = tiledImage.getTilesToDraw(); - if(tilesToDraw.length === 0){ + if(tilesToDraw.length === 0 || tiledImage.getOpacity() === 0){ return; } let firstTile = tilesToDraw[0];