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.
* @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;
}

View File

@ -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',