Merge pull request #2462 from pearcetm/fix-zero-opacity-case

Fix zero opacity case
This commit is contained in:
Ian Gilman 2024-02-01 09:33:04 -08:00 committed by GitHub
commit 98769af678
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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);
}
});

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));

View File

@ -222,7 +222,7 @@
let tilesToDraw = tiledImage.getTilesToDraw();
if(tilesToDraw.length === 0){
if(tilesToDraw.length === 0 || tiledImage.getOpacity() === 0){
return;
}
let firstTile = tilesToDraw[0];