From 4d26c800baf2af9deff4a72e3bdd9d9557cf8586 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Fri, 1 Mar 2024 09:25:16 -0800 Subject: [PATCH 1/7] Changelog for #2488 --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 13ee1015..7285e5b0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,7 +5,7 @@ OPENSEADRAGON CHANGELOG * BREAKING CHANGE: Dropped support for IE11 (#2300, #2361 @AndrewADev) * DEPRECATION: The OpenSeadragon.createCallback function is no longer recommended (#2367 @akansjain) -* The viewer now uses WebGL when available (#2310, #2462, #2466, #2468, #2469, #2472, #2478 @pearcetm, @Aiosa, @thec0keman) +* The viewer now uses WebGL when available (#2310, #2462, #2466, #2468, #2469, #2472, #2478, #2488 @pearcetm, @Aiosa, @thec0keman) * Added webp to supported image formats (#2455 @BeebBenjamin) * Introduced maxTilesPerFrame option to allow loading more tiles simultaneously (#2387 @jetic83) * Now when creating a viewer or navigator, we leave its position style alone if possible (#2393 @VIRAT9358) From c1772466758c0184059df411069caa955e8d9f9c Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 4 Mar 2024 21:28:12 -0500 Subject: [PATCH 2/7] fix #2490 --- src/navigator.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/navigator.js b/src/navigator.js index 6a213624..9dafde3e 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -309,6 +309,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* this.oldContainerSize = containerSize; this.world.update(); this.world.draw(); + this.update(this.viewer.viewport); } } }, From 2cb1835533ac7e77efafcb89cab6352a37d6b216 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 4 Mar 2024 21:32:14 -0500 Subject: [PATCH 3/7] fix docs --- src/navigator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/navigator.js b/src/navigator.js index 9dafde3e..32868d07 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -356,7 +356,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* /** * Used to update the navigator minimap's viewport rectangle when a change in the viewer's viewport occurs. * @function - * @param {OpenSeadragon.Viewport} The viewport this navigator is tracking. + * @param {OpenSeadragon.Viewport} viewport The viewport this navigator is tracking. */ update: function( viewport ) { From 3e04c8854e110c9ea525c18097506a9da512a390 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 5 Mar 2024 13:01:42 -0500 Subject: [PATCH 4/7] make navigator.update's parameter optional, default to navigator.viewer.viewport --- src/navigator.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/navigator.js b/src/navigator.js index 32868d07..fb95e4b1 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -356,7 +356,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* /** * Used to update the navigator minimap's viewport rectangle when a change in the viewer's viewport occurs. * @function - * @param {OpenSeadragon.Viewport} viewport The viewport this navigator is tracking. + * @param {OpenSeadragon.Viewport} [viewport] The viewport to display. Default: the viewport this navigator is tracking. */ update: function( viewport ) { @@ -367,6 +367,10 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* topleft, bottomright; + if(!viewport){ + viewport = this.viewer.viewport; + } + viewerSize = $.getElementSize( this.viewer.element ); if ( this._resizeWithViewer && viewerSize.x && viewerSize.y && !viewerSize.equals( this.oldViewerSize ) ) { this.oldViewerSize = viewerSize; From 029a40aa21e55d3e57ae22a549402727622a4012 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 5 Mar 2024 15:39:54 -0500 Subject: [PATCH 5/7] deal with tiles that have padding --- src/webgldrawer.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/webgldrawer.js b/src/webgldrawer.js index 5d121e6f..f0b69d00 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -897,19 +897,32 @@ let texture = gl.createTexture(); let position; let overlap = tiledImage.source.tileOverlap; + + // deal with tiles where there is padding, i.e. the pixel data doesn't take up the entire provided canvas + let sourceWidthFraction, sourceHeightFraction; + if (tile.sourceBounds) { + sourceWidthFraction = Math.min(tile.sourceBounds.width, canvas.width) / canvas.width; + sourceHeightFraction = Math.min(tile.sourceBounds.height, canvas.height) / canvas.height; + } else { + sourceWidthFraction = 1; + sourceHeightFraction = 1; + } + if( overlap > 0){ // calculate the normalized position of the rect to actually draw // discarding overlap. let overlapFraction = this._calculateOverlapFraction(tile, tiledImage); - let left = tile.x === 0 ? 0 : overlapFraction.x; - let top = tile.y === 0 ? 0 : overlapFraction.y; - let right = tile.isRightMost ? 1 : 1 - overlapFraction.x; - let bottom = tile.isBottomMost ? 1 : 1 - overlapFraction.y; + let left = (tile.x === 0 ? 0 : overlapFraction.x) * sourceWidthFraction; + let top = (tile.y === 0 ? 0 : overlapFraction.y) * sourceHeightFraction; + let right = (tile.isRightMost ? 1 : 1 - overlapFraction.x) * sourceWidthFraction; + let bottom = (tile.isBottomMost ? 1 : 1 - overlapFraction.y) * sourceHeightFraction; position = this._makeQuadVertexBuffer(left, right, top, bottom); - } else { - // no overlap: this texture can use the unit quad as its position data + } else if (sourceWidthFraction === 1 && sourceHeightFraction === 1) { + // no overlap and no padding: this texture can use the unit quad as its position data position = this._unitQuad; + } else { + position = this._makeQuadVertexBuffer(0, sourceWidthFraction, 0, sourceHeightFraction); } let textureInfo = { From 9a92d9e9ad915ef54d02034b4f9fb1efa222b8a2 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 7 Mar 2024 09:24:47 -0800 Subject: [PATCH 6/7] Changelog for #2491 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 7285e5b0..d48e2980 100644 --- a/changelog.txt +++ b/changelog.txt @@ -17,6 +17,7 @@ OPENSEADRAGON CHANGELOG * Fixed: dragToPan gesture could not be disabled when flickEnabled was activated (#2464 @jonasengelmann) * Fixed: placeholderFillStyle didn't work properly when the image was rotated (#2469 @pearcetm) * Fixed: Sometimes exponential springs wouldn't ever settle (#2469 @pearcetm) +* Fixed: The navigator wouldn't update its tracking rectangle when the navigator was resized (#2491 @pearcetm) 4.1.0: From 9b7fc464ca3ae3fdd9f981b64aea5d8348021616 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 7 Mar 2024 09:30:00 -0800 Subject: [PATCH 7/7] Changelog for #2492 --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index d48e2980..d01aecfb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,7 +5,7 @@ OPENSEADRAGON CHANGELOG * BREAKING CHANGE: Dropped support for IE11 (#2300, #2361 @AndrewADev) * DEPRECATION: The OpenSeadragon.createCallback function is no longer recommended (#2367 @akansjain) -* The viewer now uses WebGL when available (#2310, #2462, #2466, #2468, #2469, #2472, #2478, #2488 @pearcetm, @Aiosa, @thec0keman) +* The viewer now uses WebGL when available (#2310, #2462, #2466, #2468, #2469, #2472, #2478, #2488, #2492 @pearcetm, @Aiosa, @thec0keman) * Added webp to supported image formats (#2455 @BeebBenjamin) * Introduced maxTilesPerFrame option to allow loading more tiles simultaneously (#2387 @jetic83) * Now when creating a viewer or navigator, we leave its position style alone if possible (#2393 @VIRAT9358)