From fe7e9a3315b308ce96f1fa6f92e58144ad2b9487 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:29:14 +0000 Subject: [PATCH 01/13] Bump serve-static from 1.14.2 to 1.16.2 Bumps [serve-static](https://github.com/expressjs/serve-static) from 1.14.2 to 1.16.2. - [Release notes](https://github.com/expressjs/serve-static/releases) - [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md) - [Commits](https://github.com/expressjs/serve-static/compare/v1.14.2...v1.16.2) --- updated-dependencies: - dependency-name: serve-static dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 107 +++++++++++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed1e1e9a..c92de879 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "openseadragon", - "version": "4.1.1", + "version": "5.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openseadragon", - "version": "4.1.1", + "version": "5.0.0", "license": "BSD-3-Clause", "devDependencies": { "eslint-plugin-compat": "^4.1.2", @@ -998,9 +998,14 @@ } }, "node_modules/destroy": { - "version": "1.0.4", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "dev": true, - "license": "MIT" + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } }, "node_modules/detect-file": { "version": "1.0.0", @@ -1600,8 +1605,9 @@ }, "node_modules/etag": { "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1873,8 +1879,9 @@ }, "node_modules/fresh": { "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3512,8 +3519,9 @@ }, "node_modules/mime": { "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true, - "license": "MIT", "bin": { "mime": "cli.js" }, @@ -4202,8 +4210,9 @@ }, "node_modules/range-parser": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -4357,60 +4366,77 @@ } }, "node_modules/send": { - "version": "0.17.2", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dev": true, - "license": "MIT", "dependencies": { "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", + "depd": "2.0.0", + "destroy": "1.2.0", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "1.8.1", + "http-errors": "2.0.0", "mime": "1.6.0", "ms": "2.1.3", - "on-finished": "~2.3.0", + "on-finished": "2.4.1", "range-parser": "~1.2.1", - "statuses": "~1.5.0" + "statuses": "2.0.1" }, "engines": { "node": ">= 0.8.0" } }, - "node_modules/send/node_modules/depd": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/send/node_modules/http-errors": { - "version": "1.8.1", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "dev": true, - "license": "MIT", "dependencies": { - "depd": "~1.1.2", + "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", + "statuses": "2.0.1", "toidentifier": "1.0.1" }, "engines": { - "node": ">= 0.6" + "node": ">= 0.8" } }, "node_modules/send/node_modules/ms": { "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/send/node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, - "license": "MIT" + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } }, "node_modules/send/node_modules/setprototypeof": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "node_modules/send/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true, - "license": "ISC" + "engines": { + "node": ">= 0.8" + } }, "node_modules/serve-index": { "version": "1.9.1", @@ -4430,19 +4456,29 @@ } }, "node_modules/serve-static": { - "version": "1.14.2", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dev": true, - "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.2" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" } }, + "node_modules/serve-static/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/setimmediate": { "version": "1.0.5", "dev": true, @@ -4731,8 +4767,9 @@ }, "node_modules/toidentifier": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.6" } From 3b99665b3210ae0dccae762fddeef0e25ca44309 Mon Sep 17 00:00:00 2001 From: Richard Benjamin Allen Date: Tue, 17 Sep 2024 12:16:00 +0100 Subject: [PATCH 02/13] Fixed: removeChild on Node The overlay.js code has been changed to apply a div wrapper to the overlay element as opposed to its innerHTML. --- src/overlay.js | 33 +++++++++++----- test/modules/overlays.js | 83 +++++++++++++++++++++++++--------------- 2 files changed, 76 insertions(+), 40 deletions(-) diff --git a/src/overlay.js b/src/overlay.js index 7d485d42..6bec18cf 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -128,9 +128,22 @@ }; } + this.elementWrapper = document.createElement('div'); this.element = options.element; - this.element.innerHTML = "
" + this.element.innerHTML + "
"; - this.style = options.element.style; + this.elementWrapper.appendChild(this.element); + + if (this.element.id) { + this.elementWrapper.id = "overlay-wrapper-" + this.element.id; + } else { + this.elementWrapper.id = "overlay-wrapper"; + } + + const overlayStyles = window.getComputedStyle(this.element); + + for (let style of overlayStyles) { + this.elementWrapper.style[style] = overlayStyles.getPropertyValue(style); + } + this.style = this.elementWrapper.style; this._init(options); }; @@ -197,7 +210,7 @@ * @function */ destroy: function() { - var element = this.element; + var element = this.elementWrapper; var style = this.style; if (element.parentNode) { @@ -242,7 +255,7 @@ * @param {Element} container */ drawHTML: function(container, viewport) { - var element = this.element; + var element = this.elementWrapper; if (element.parentNode !== container) { //save the source parent for later if we need it element.prevElementParent = element.parentNode; @@ -253,7 +266,7 @@ this.style.position = "absolute"; // this.size is used by overlays which don't get scaled in at // least one direction when this.checkResize is set to false. - this.size = $.getElementSize(element); + this.size = $.getElementSize(this.elementWrapper); } var positionAndSize = this._getOverlayPositionAndSize(viewport); var position = positionAndSize.position; @@ -270,15 +283,17 @@ this.onDraw(position, size, this.element); } else { var style = this.style; - var innerElement = element.firstChild; - var innerStyle = innerElement.style; + var innerStyle = this.element.style; + innerStyle.display = "block"; style.left = position.x + "px"; style.top = position.y + "px"; if (this.width !== null) { style.width = size.x + "px"; + innerStyle.width = size.x + "px"; } if (this.height !== null) { style.height = size.y + "px"; + innerStyle.height = size.y + "px"; } var transformOriginProp = $.getCssPropertyWithVendorPrefix( 'transformOrigin'); @@ -303,7 +318,7 @@ style[transformProp] = ""; } } - style.display = 'block'; + style.display = 'flex'; } }, @@ -355,7 +370,7 @@ } if (this.checkResize && (this.width === null || this.height === null)) { - var eltSize = this.size = $.getElementSize(this.element); + var eltSize = this.size = $.getElementSize(this.elementWrapper); if (this.width === null) { width = eltSize.x; } diff --git a/test/modules/overlays.js b/test/modules/overlays.js index 8b9cd58f..2b988acb 100644 --- a/test/modules/overlays.js +++ b/test/modules/overlays.js @@ -254,7 +254,7 @@ var expPosition = viewport.imageToViewerElementCoordinates( new OpenSeadragon.Point(13, 120)); - var actPosition = $("#overlay").position(); + var actPosition = $("#overlay-wrapper-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, @@ -263,23 +263,23 @@ var zoom = viewport.viewportToImageZoom(viewport.getZoom(true)); var expectedWidth = 124 * zoom; var expectedHeight = 132 * zoom; - Util.assessNumericValue(assert, $("#overlay").width(), expectedWidth, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").width(), expectedWidth, epsilon, "Width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay").height(), expectedHeight, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").height(), expectedHeight, epsilon, "Height mismatch " + contextMessage); expPosition = viewport.imageToViewerElementCoordinates( new OpenSeadragon.Point(400, 500)); - actPosition = $("#fixed-overlay").position(); + actPosition = $("#overlay-wrapper-fixed-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#fixed-overlay").width(), 70, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").width(), 70, epsilon, "Fixed overlay width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#fixed-overlay").height(), 60, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").height(), 60, epsilon, "Fixed overlay height mismatch " + contextMessage); } @@ -326,7 +326,7 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.2, 0.1)); - var actPosition = $("#overlay").position(); + var actPosition = $("#overlay-wrapper-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, @@ -334,23 +334,23 @@ var expectedSize = viewport.deltaPixelsFromPoints( new OpenSeadragon.Point(0.5, 0.1)); - Util.assessNumericValue(assert, $("#overlay").width(), expectedSize.x, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").width(), expectedSize.x, epsilon, "Width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay").height(), expectedSize.y, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").height(), expectedSize.y, epsilon, "Height mismatch " + contextMessage); expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)); - actPosition = $("#fixed-overlay").position(); + actPosition = $("#overlay-wrapper-fixed-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#fixed-overlay").width(), 70, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").width(), 70, epsilon, "Fixed overlay width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#fixed-overlay").height(), 60, epsilon, + Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").height(), 60, epsilon, "Fixed overlay height mismatch " + contextMessage); } @@ -402,7 +402,7 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.2, 0.1)); - var actPosition = $("#overlay").position(); + var actPosition = $("#overlay-wrapper-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, @@ -415,7 +415,7 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)) .plus(expectedOffset); - var actPosition = $("#fixed-overlay").position(); + var actPosition = $("#overlay-wrapper-fixed-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, @@ -481,7 +481,7 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)) .plus(expectedOffset); - var actPosition = $("#fixed-overlay").position(); + var actPosition = $("#overlay-wrapper-fixed-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, @@ -492,8 +492,8 @@ checkFixedOverlayPosition(new OpenSeadragon.Point(-35, -30), "with overlay of size 70,60."); - $("#fixed-overlay").width(50); - $("#fixed-overlay").height(40); + $("#overlay-wrapper-fixed-overlay").width(50); + $("#overlay-wrapper-fixed-overlay").height(40); // The resizing of the overlays is not detected by the viewer's loop. viewer.forceRedraw(); @@ -503,8 +503,8 @@ "with overlay of size 50,40."); // Restore original size - $("#fixed-overlay").width(70); - $("#fixed-overlay").height(60); + $("#overlay-wrapper-fixed-overlay").width(70); + $("#overlay-wrapper-fixed-overlay").height(60); done(); }, 100); @@ -536,7 +536,7 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)) .plus(expectedOffset); - var actPosition = $("#fixed-overlay").position(); + var actPosition = $("#overlay-wrapper-fixed-overlay").position(); Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, @@ -547,8 +547,8 @@ checkFixedOverlayPosition(new OpenSeadragon.Point(-35, -30), "with overlay of size 70,60."); - $("#fixed-overlay").width(50); - $("#fixed-overlay").height(40); + $("#overlay-wrapper-fixed-overlay").width(50); + $("#overlay-wrapper-fixed-overlay").height(40); // The resizing of the overlays is not detected by the viewer's loop. viewer.forceRedraw(); @@ -558,8 +558,8 @@ "with overlay of size 50,40."); // Restore original size - $("#fixed-overlay").width(70); - $("#fixed-overlay").height(60); + $("#overlay-wrapper-fixed-overlay").width(70); + $("#overlay-wrapper-fixed-overlay").height(60); done(); }, 100); @@ -783,7 +783,7 @@ viewer.addOnceHandler('open', function() { var viewport = viewer.viewport; - var $overlay = $("#fully-scaled-overlay"); + var $overlay = $("#overlay-wrapper-fully-scaled-overlay"); var expectedSize = viewport.deltaPixelsFromPointsNoRotate( new OpenSeadragon.Point(1, 1)); var expectedPosition = viewport.viewportToViewerElementCoordinates( @@ -834,7 +834,7 @@ }); viewer.addOnceHandler('open', function() { - var $overlay = $("#horizontally-scaled-overlay"); + var $overlay = $("#overlay-wrapper-horizontally-scaled-overlay"); var notScaledWidth = 100; var notScaledHeight = 100; $overlay.get(0).style.height = notScaledHeight + "px"; @@ -897,7 +897,7 @@ }); viewer.addOnceHandler('open', function() { - var $overlay = $("#vertically-scaled-overlay"); + var $overlay = $("#overlay-wrapper-vertically-scaled-overlay"); var notScaledWidth = 100; var notScaledHeight = 100; $overlay.get(0).style.width = notScaledWidth + "px"; @@ -959,7 +959,7 @@ }); viewer.addOnceHandler('open', function() { - var $overlay = $("#not-scaled-overlay"); + var $overlay = $("#overlay-wrapper-not-scaled-overlay"); var notScaledWidth = 100; var notScaledHeight = 100; $overlay.get(0).style.width = notScaledWidth + "px"; @@ -1024,7 +1024,7 @@ viewer.addOnceHandler('open', function() { var viewport = viewer.viewport; - var $overlay = $("#fully-scaled-overlay"); + var $overlay = $("#overlay-wrapper-fully-scaled-overlay"); var expectedRect = viewport.viewportToViewerElementRectangle( new OpenSeadragon.Rect(0, 0, 1, 1)).getBoundingBox(); var actualPosition = $overlay.position(); @@ -1060,6 +1060,28 @@ }); }); + + // ---------- + QUnit.test('Remove Child from Overlay', function(assert){ + var done = assert.async(); + viewer = OpenSeadragon({ + id: 'example-overlays', + prefixUrl: '/build/openseadragon/images/', + tileSources: '/test/data/testpattern.dzi' + }); + + viewer.addOnceHandler('open', function() { + var $overlay = document.createElement("div"); + var something = document.createElement("p"); + $overlay.appendChild(something); + viewer.addOverlay($overlay); + $overlay.removeChild(something); + something.innerHTML = '...'; + assert.equal(something.innerHTML, '...'); + done(); + }); + }); + // ---------- QUnit.test('Fully scaled overlay rotation mode EXACT', function(assert) { var done = assert.async(); @@ -1082,8 +1104,7 @@ viewer.addOnceHandler('open', function() { var viewport = viewer.viewport; - - var $overlay = $("#fully-scaled-overlay"); + var $overlay = $("#overlay-wrapper-fully-scaled-overlay"); var expectedSize = viewport.deltaPixelsFromPointsNoRotate( new OpenSeadragon.Point(1, 1)); var expectedPosition = viewport.pixelFromPoint( From b28b77fdbd58d4952f97fc2efff81f50b3451791 Mon Sep 17 00:00:00 2001 From: Richard Benjamin Allen Date: Tue, 17 Sep 2024 23:30:06 +0100 Subject: [PATCH 03/13] FIxed: Removed unnecessary references in selectors We can test the overlay dimensions still --- test/modules/overlays.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/modules/overlays.js b/test/modules/overlays.js index 2b988acb..df0e799a 100644 --- a/test/modules/overlays.js +++ b/test/modules/overlays.js @@ -263,9 +263,9 @@ var zoom = viewport.viewportToImageZoom(viewport.getZoom(true)); var expectedWidth = 124 * zoom; var expectedHeight = 132 * zoom; - Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").width(), expectedWidth, epsilon, + Util.assessNumericValue(assert, $("#overlay").width(), expectedWidth, epsilon, "Width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").height(), expectedHeight, epsilon, + Util.assessNumericValue(assert, $("#overlay").height(), expectedHeight, epsilon, "Height mismatch " + contextMessage); @@ -277,9 +277,9 @@ Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").width(), 70, epsilon, + Util.assessNumericValue(assert, $("#fixed-overlay").width(), 70, epsilon, "Fixed overlay width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").height(), 60, epsilon, + Util.assessNumericValue(assert, $("#fixed-overlay").height(), 60, epsilon, "Fixed overlay height mismatch " + contextMessage); } @@ -334,9 +334,9 @@ var expectedSize = viewport.deltaPixelsFromPoints( new OpenSeadragon.Point(0.5, 0.1)); - Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").width(), expectedSize.x, epsilon, + Util.assessNumericValue(assert, $("#overlay").width(), expectedSize.x, epsilon, "Width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay-wrapper-overlay").height(), expectedSize.y, epsilon, + Util.assessNumericValue(assert, $("#overlay").height(), expectedSize.y, epsilon, "Height mismatch " + contextMessage); @@ -348,9 +348,9 @@ Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").width(), 70, epsilon, + Util.assessNumericValue(assert, $("#fixed-overlay").width(), 70, epsilon, "Fixed overlay width mismatch " + contextMessage); - Util.assessNumericValue(assert, $("#overlay-wrapper-fixed-overlay").height(), 60, epsilon, + Util.assessNumericValue(assert, $("#fixed-overlay").height(), 60, epsilon, "Fixed overlay height mismatch " + contextMessage); } @@ -492,8 +492,8 @@ checkFixedOverlayPosition(new OpenSeadragon.Point(-35, -30), "with overlay of size 70,60."); - $("#overlay-wrapper-fixed-overlay").width(50); - $("#overlay-wrapper-fixed-overlay").height(40); + $("#fixed-overlay").width(50); + $("#fixed-overlay").height(40); // The resizing of the overlays is not detected by the viewer's loop. viewer.forceRedraw(); @@ -503,8 +503,8 @@ "with overlay of size 50,40."); // Restore original size - $("#overlay-wrapper-fixed-overlay").width(70); - $("#overlay-wrapper-fixed-overlay").height(60); + $("#fixed-overlay").width(70); + $("#fixed-overlay").height(60); done(); }, 100); @@ -547,8 +547,8 @@ checkFixedOverlayPosition(new OpenSeadragon.Point(-35, -30), "with overlay of size 70,60."); - $("#overlay-wrapper-fixed-overlay").width(50); - $("#overlay-wrapper-fixed-overlay").height(40); + $("#fixed-overlay").width(50); + $("#fixed-overlay").height(40); // The resizing of the overlays is not detected by the viewer's loop. viewer.forceRedraw(); @@ -558,8 +558,8 @@ "with overlay of size 50,40."); // Restore original size - $("#overlay-wrapper-fixed-overlay").width(70); - $("#overlay-wrapper-fixed-overlay").height(60); + $("#fixed-overlay").width(70); + $("#fixed-overlay").height(60); done(); }, 100); From c0eae951c6e038ae514b7b5d9b0aa562954d05a7 Mon Sep 17 00:00:00 2001 From: Richard Benjamin Allen Date: Tue, 17 Sep 2024 23:38:48 +0100 Subject: [PATCH 04/13] Fixed: Removed unnecessary complexity --- src/overlay.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/overlay.js b/src/overlay.js index 6bec18cf..bc903659 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -138,11 +138,6 @@ this.elementWrapper.id = "overlay-wrapper"; } - const overlayStyles = window.getComputedStyle(this.element); - - for (let style of overlayStyles) { - this.elementWrapper.style[style] = overlayStyles.getPropertyValue(style); - } this.style = this.elementWrapper.style; this._init(options); }; From 4d4ccb99baa1c8dcb6a0226031fcafd28466f7d3 Mon Sep 17 00:00:00 2001 From: Richard Benjamin Allen Date: Wed, 18 Sep 2024 00:16:41 +0100 Subject: [PATCH 05/13] Fixed: Removed unused style attributes --- src/overlay.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/overlay.js b/src/overlay.js index bc903659..61f5fa88 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -283,11 +283,9 @@ style.left = position.x + "px"; style.top = position.y + "px"; if (this.width !== null) { - style.width = size.x + "px"; innerStyle.width = size.x + "px"; } if (this.height !== null) { - style.height = size.y + "px"; innerStyle.height = size.y + "px"; } var transformOriginProp = $.getCssPropertyWithVendorPrefix( From 2b010a9a597f39368c8dc662e35d5bc0f1a79ee1 Mon Sep 17 00:00:00 2001 From: Richard Benjamin Allen Date: Thu, 19 Sep 2024 21:13:28 +0100 Subject: [PATCH 06/13] Fixed: JQuery cannot be used to get position with wrapper --- test/modules/overlays.js | 87 ++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/test/modules/overlays.js b/test/modules/overlays.js index df0e799a..a328f50b 100644 --- a/test/modules/overlays.js +++ b/test/modules/overlays.js @@ -254,10 +254,10 @@ var expPosition = viewport.imageToViewerElementCoordinates( new OpenSeadragon.Point(13, 120)); - var actPosition = $("#overlay-wrapper-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + var actPosition = viewport.pixelFromPoint(viewer.getOverlayById("overlay").position, true); + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Y position mismatch " + contextMessage); var zoom = viewport.viewportToImageZoom(viewport.getZoom(true)); @@ -271,10 +271,10 @@ expPosition = viewport.imageToViewerElementCoordinates( new OpenSeadragon.Point(400, 500)); - actPosition = $("#overlay-wrapper-fixed-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + actPosition = viewport.pixelFromPoint(viewer.getOverlayById("fixed-overlay").position, true);; + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); Util.assessNumericValue(assert, $("#fixed-overlay").width(), 70, epsilon, @@ -326,10 +326,10 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.2, 0.1)); - var actPosition = $("#overlay-wrapper-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + var actPosition = viewport.pixelFromPoint(viewer.getOverlayById("overlay").position, true); + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Y position mismatch " + contextMessage); var expectedSize = viewport.deltaPixelsFromPoints( @@ -342,10 +342,10 @@ expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)); - actPosition = $("#overlay-wrapper-fixed-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + actPosition = viewport.pixelFromPoint(viewer.getOverlayById("fixed-overlay").position, true); + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); Util.assessNumericValue(assert, $("#fixed-overlay").width(), 70, epsilon, @@ -402,10 +402,10 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.2, 0.1)); - var actPosition = $("#overlay-wrapper-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + var actPosition = viewport.pixelFromPoint(viewer.getOverlayById("overlay").position, true); + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Y position mismatch " + contextMessage); } @@ -415,10 +415,11 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)) .plus(expectedOffset); - var actPosition = $("#overlay-wrapper-fixed-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + + var actPosition = viewport.pixelFromPoint(viewer.getOverlayById("fixed-overlay").position, true).plus(expectedOffset); + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); } @@ -481,10 +482,10 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)) .plus(expectedOffset); - var actPosition = $("#overlay-wrapper-fixed-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + var actPosition = viewport.pixelFromPoint(viewer.getOverlayById("fixed-overlay").position, true).plus(expectedOffset); + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); } @@ -536,10 +537,10 @@ var expPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.6)) .plus(expectedOffset); - var actPosition = $("#overlay-wrapper-fixed-overlay").position(); - Util.assessNumericValue(assert, actPosition.left, expPosition.x, epsilon, + var actPosition = viewport.pixelFromPoint(viewer.getOverlayById("fixed-overlay").position, true).plus(expectedOffset); + Util.assessNumericValue(assert, actPosition.x, expPosition.x, epsilon, "Fixed overlay X position mismatch " + contextMessage); - Util.assessNumericValue(assert, actPosition.top, expPosition.y, epsilon, + Util.assessNumericValue(assert, actPosition.y, expPosition.y, epsilon, "Fixed overlay Y position mismatch " + contextMessage); } @@ -783,16 +784,16 @@ viewer.addOnceHandler('open', function() { var viewport = viewer.viewport; - var $overlay = $("#overlay-wrapper-fully-scaled-overlay"); + var $overlay = $("#fully-scaled-overlay"); var expectedSize = viewport.deltaPixelsFromPointsNoRotate( new OpenSeadragon.Point(1, 1)); var expectedPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(1, 1)) .minus(expectedSize); - var actualPosition = $overlay.position(); - Util.assessNumericValue(assert, actualPosition.left, expectedPosition.x, epsilon, + var actualPosition = viewport.pixelFromPoint(viewer.getOverlayById("fully-scaled-overlay").position, true).minus(expectedSize); + Util.assessNumericValue(assert, actualPosition.x, expectedPosition.x, epsilon, "Scaled overlay position.x should adjust to rotation."); - Util.assessNumericValue(assert, actualPosition.top, expectedPosition.y, epsilon, + Util.assessNumericValue(assert, actualPosition.y, expectedPosition.y, epsilon, "Scaled overlay position.y should adjust to rotation."); var actualWidth = $overlay.width(); @@ -834,7 +835,7 @@ }); viewer.addOnceHandler('open', function() { - var $overlay = $("#overlay-wrapper-horizontally-scaled-overlay"); + var $overlay = $("#horizontally-scaled-overlay"); var notScaledWidth = 100; var notScaledHeight = 100; $overlay.get(0).style.height = notScaledHeight + "px"; @@ -851,10 +852,10 @@ var expectedPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0.5, 0.5)) .minus(new OpenSeadragon.Point(expectedWidth / 2, notScaledHeight / 2)); - var actualPosition = $overlay.position(); - Util.assessNumericValue(assert, actualPosition.left, expectedPosition.x, epsilon, + var actualPosition = viewport.pixelFromPoint(viewer.getOverlayById("horizontally-scaled-overlay").position, true).minus(new OpenSeadragon.Point(expectedWidth / 2, notScaledHeight / 2)); + Util.assessNumericValue(assert, actualPosition.x, expectedPosition.x, epsilon, "Horizontally scaled overlay position.x should adjust to rotation."); - Util.assessNumericValue(assert, actualPosition.top, expectedPosition.y, epsilon, + Util.assessNumericValue(assert, actualPosition.y, expectedPosition.y, epsilon, "Horizontally scaled overlay position.y should adjust to rotation."); var actualWidth = $overlay.width(); @@ -897,7 +898,7 @@ }); viewer.addOnceHandler('open', function() { - var $overlay = $("#overlay-wrapper-vertically-scaled-overlay"); + var $overlay = $("#vertically-scaled-overlay"); var notScaledWidth = 100; var notScaledHeight = 100; $overlay.get(0).style.width = notScaledWidth + "px"; @@ -914,10 +915,10 @@ var expectedPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(0, 0.5)) .minus(new OpenSeadragon.Point(0, expectedHeight / 2)); - var actualPosition = $overlay.position(); - Util.assessNumericValue(assert, actualPosition.left, expectedPosition.x, epsilon, + var actualPosition= viewport.pixelFromPoint(viewer.getOverlayById("vertically-scaled-overlay").position).minus(new OpenSeadragon.Point(0, expectedHeight / 2)); + Util.assessNumericValue(assert, actualPosition.x, expectedPosition.x, epsilon, "Vertically scaled overlay position.x should adjust to rotation."); - Util.assessNumericValue(assert, actualPosition.top, expectedPosition.y, epsilon, + Util.assessNumericValue(assert, actualPosition.y, expectedPosition.y, epsilon, "Vertically scaled overlay position.y should adjust to rotation."); var actualWidth = $overlay.width(); @@ -959,7 +960,7 @@ }); viewer.addOnceHandler('open', function() { - var $overlay = $("#overlay-wrapper-not-scaled-overlay"); + var $overlay = $("#not-scaled-overlay"); var notScaledWidth = 100; var notScaledHeight = 100; $overlay.get(0).style.width = notScaledWidth + "px"; @@ -975,10 +976,10 @@ var expectedPosition = viewport.viewportToViewerElementCoordinates( new OpenSeadragon.Point(1, 0)) .minus(new OpenSeadragon.Point(notScaledWidth, 0)); - var actualPosition = $overlay.position(); - Util.assessNumericValue(assert, actualPosition.left, expectedPosition.x, epsilon, + var actualPosition= viewport.pixelFromPoint(viewer.getOverlayById("not-scaled-overlay").position).minus(new OpenSeadragon.Point(notScaledWidth, 0)); + Util.assessNumericValue(assert, actualPosition.x, expectedPosition.x, epsilon, "Not scaled overlay position.x should adjust to rotation."); - Util.assessNumericValue(assert, actualPosition.top, expectedPosition.y, epsilon, + Util.assessNumericValue(assert, actualPosition.y, expectedPosition.y, epsilon, "Not scaled overlay position.y should adjust to rotation."); var actualWidth = $overlay.width(); @@ -1024,7 +1025,7 @@ viewer.addOnceHandler('open', function() { var viewport = viewer.viewport; - var $overlay = $("#overlay-wrapper-fully-scaled-overlay"); + var $overlay = $("#fully-scaled-overlay"); var expectedRect = viewport.viewportToViewerElementRectangle( new OpenSeadragon.Rect(0, 0, 1, 1)).getBoundingBox(); var actualPosition = $overlay.position(); @@ -1104,14 +1105,14 @@ viewer.addOnceHandler('open', function() { var viewport = viewer.viewport; - var $overlay = $("#overlay-wrapper-fully-scaled-overlay"); + var $overlay = $("#fully-scaled-overlay"); var expectedSize = viewport.deltaPixelsFromPointsNoRotate( new OpenSeadragon.Point(1, 1)); var expectedPosition = viewport.pixelFromPoint( new OpenSeadragon.Point(1, 1)) .minus(expectedSize); // We can't rely on jQuery.position with transforms. - var actualStyle = $overlay.get(0).style; + var actualStyle= viewer.getOverlayById("fully-scaled-overlay").style; var left = Number(actualStyle.left.replace("px", "")); var top = Number(actualStyle.top.replace("px", "")); Util.assessNumericValue(assert, left, expectedPosition.x, epsilon, From 17c34a7985e674379bb1ca819916bd032abdd8e1 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 24 Sep 2024 09:50:10 -0700 Subject: [PATCH 07/13] Changelog for #2582 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 27c5e976..108d3e3b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ OPENSEADRAGON CHANGELOG 5.0.1: (in progress...) +* Improved overlay handling so it plays better with other libraries (#2582 @BeebBenjamin) * Fixed: If you switched from WebGL drawer to canvas drawer, it didn't clean up properly (#2570 @pearcetm) 5.0.0: From 263a664e589da0f9e0e8c5accfd1bde5c67ad13d Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 7 Oct 2024 18:19:38 -0400 Subject: [PATCH 08/13] add _needsUpdate during tiledImage.setClip() --- src/tiledimage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tiledimage.js b/src/tiledimage.js index 76a4f226..17a7abcf 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -878,6 +878,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag this._clip = null; } + this._needsUpdate = true; this._needsDraw = true; /** * Raised when the TiledImage's clip is changed. From 8bdc0a414649ba7085ea3f9bdf7c932a705196d0 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 8 Oct 2024 09:26:56 -0700 Subject: [PATCH 09/13] Changelog for #2590 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 108d3e3b..2b3306e2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ OPENSEADRAGON CHANGELOG * Improved overlay handling so it plays better with other libraries (#2582 @BeebBenjamin) * Fixed: If you switched from WebGL drawer to canvas drawer, it didn't clean up properly (#2570 @pearcetm) +* Fixed: TiledImage.setClip would sometimes leave tiles unloaded (#2590 @pearcetm) 5.0.0: From 6c20101c8be2e5952b45831658f7df79325db309 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 17 Oct 2024 15:06:04 -0400 Subject: [PATCH 10/13] make webgl drawer account for viewport margins --- src/webgldrawer.js | 2 +- test/demo/drawercomparison.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/webgldrawer.js b/src/webgldrawer.js index cf489661..a102ce31 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -256,7 +256,7 @@ draw(tiledImages){ let gl = this._gl; let view = { - bounds: this.viewport.getBoundsNoRotate(true), + bounds: this.viewport.getBoundsNoRotateWithMargins(true), center: this.viewport.getCenter(true), rotation: this.viewport.getRotation(true) * Math.PI / 180 }; diff --git a/test/demo/drawercomparison.js b/test/demo/drawercomparison.js index 96793915..9b1bf6a7 100644 --- a/test/demo/drawercomparison.js +++ b/test/demo/drawercomparison.js @@ -18,6 +18,13 @@ const drawers = { webgl: "New WebGL drawer" } +const viewportMargins = { + left: 25, + top: 25, + right: 25, + bottom: 25, +}; + //Support drawer type from the url const url = new URL(window.location.href); const drawer1 = url.searchParams.get("left") || 'canvas'; @@ -40,6 +47,7 @@ let viewer1 = window.viewer1 = OpenSeadragon({ drawer:drawer1, blendTime:0, showNavigator:true, + viewportMargins, }); // viewer2: webgl drawer @@ -55,6 +63,7 @@ let viewer2 = window.viewer2 = OpenSeadragon({ drawer:drawer2, blendTime:0, showNavigator:true, + viewportMargins, }); // // viewer3: html drawer, unused From 82314dd4bf6c6d08c93a00da1f0492bad15e3b5e Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 22 Oct 2024 09:43:43 -0700 Subject: [PATCH 11/13] Changelog for #2600 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 2b3306e2..b0dadbcc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ OPENSEADRAGON CHANGELOG * Improved overlay handling so it plays better with other libraries (#2582 @BeebBenjamin) * Fixed: If you switched from WebGL drawer to canvas drawer, it didn't clean up properly (#2570 @pearcetm) * Fixed: TiledImage.setClip would sometimes leave tiles unloaded (#2590 @pearcetm) +* Fixed: The WebGL drawer didn't support viewportMargins (#2600 @pearcetm) 5.0.0: From fab607584c677a709184489e8bc7ba0e9f2aea3d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 25 Oct 2024 11:15:52 -0600 Subject: [PATCH 12/13] fix problem with asymmetric viewport margins --- src/webgldrawer.js | 5 +++-- test/demo/drawercomparison.js | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/webgldrawer.js b/src/webgldrawer.js index a102ce31..0489eecb 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -255,9 +255,10 @@ */ draw(tiledImages){ let gl = this._gl; + const bounds = this.viewport.getBoundsNoRotateWithMargins(true); let view = { - bounds: this.viewport.getBoundsNoRotateWithMargins(true), - center: this.viewport.getCenter(true), + bounds: bounds, + center: new OpenSeadragon.Point(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2), rotation: this.viewport.getRotation(true) * Math.PI / 180 }; diff --git a/test/demo/drawercomparison.js b/test/demo/drawercomparison.js index 9b1bf6a7..bb96219b 100644 --- a/test/demo/drawercomparison.js +++ b/test/demo/drawercomparison.js @@ -19,10 +19,10 @@ const drawers = { } const viewportMargins = { - left: 25, - top: 25, - right: 25, - bottom: 25, + left: 100, + top: 0, + right: 0, + bottom: 50, }; //Support drawer type from the url From e1e0ec6b241e11baec873a024ddf6a7e59834647 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 28 Oct 2024 09:17:59 -0700 Subject: [PATCH 13/13] Changelog for #2606 --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index b0dadbcc..e8778d25 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,7 +6,7 @@ OPENSEADRAGON CHANGELOG * Improved overlay handling so it plays better with other libraries (#2582 @BeebBenjamin) * Fixed: If you switched from WebGL drawer to canvas drawer, it didn't clean up properly (#2570 @pearcetm) * Fixed: TiledImage.setClip would sometimes leave tiles unloaded (#2590 @pearcetm) -* Fixed: The WebGL drawer didn't support viewportMargins (#2600 @pearcetm) +* Fixed: The WebGL drawer didn't support viewportMargins (#2600, #2606 @pearcetm) 5.0.0: