move logic about zero opacity case into getDrawArea

This commit is contained in:
Tom 2024-02-01 08:47:03 -05:00
parent 84a55968ee
commit 921171ed2b
2 changed files with 7 additions and 2 deletions

View File

@ -1020,9 +1020,14 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
/** /**
* Get the region of this tiled image that falls within the viewport. * 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 {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(){ getDrawArea: function(){
if( this._opacity === 0 && !this._preload){
return false;
}
var drawArea = this._viewportToTiledImageRectangle( var drawArea = this._viewportToTiledImageRectangle(
this.viewport.getBoundsWithMargins(true)); this.viewport.getBoundsWithMargins(true));
@ -1434,7 +1439,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
let lowestLevel = tiles.length ? tiles[0].level : 0; let lowestLevel = tiles.length ? tiles[0].level : 0;
let drawArea = this.getDrawArea(); let drawArea = this.getDrawArea();
if(!drawArea || (this._opacity === 0 && !this._preload)){ if(!drawArea){
return; return;
} }

View File

@ -1,5 +1,5 @@
const sources = { const sources = {
"rainbow":"../data/testpattern.dzi", "rainbow": "../data/testpattern.dzi",
"leaves":"../data/iiif_2_0_sizes/info.json", "leaves":"../data/iiif_2_0_sizes/info.json",
"bblue":{ "bblue":{
type:'image', type:'image',