From 921171ed2bb1afe3529426a7cdc8b7a73e62636b Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 1 Feb 2024 08:47:03 -0500 Subject: [PATCH] move logic about zero opacity case into getDrawArea --- src/tiledimage.js | 7 ++++++- test/demo/drawercomparison.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index 9b202819..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)); @@ -1434,7 +1439,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag let lowestLevel = tiles.length ? tiles[0].level : 0; let drawArea = this.getDrawArea(); - if(!drawArea || (this._opacity === 0 && !this._preload)){ + if(!drawArea){ return; } diff --git a/test/demo/drawercomparison.js b/test/demo/drawercomparison.js index 96793915..bd95deaa 100644 --- a/test/demo/drawercomparison.js +++ b/test/demo/drawercomparison.js @@ -1,5 +1,5 @@ const sources = { - "rainbow":"../data/testpattern.dzi", + "rainbow": "../data/testpattern.dzi", "leaves":"../data/iiif_2_0_sizes/info.json", "bblue":{ type:'image',