mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 08:36:10 +03:00
Merge branch 'openseadragon:master' into cache-overhaul-reviewed
This commit is contained in:
commit
cc7474ec9b
@ -3,7 +3,10 @@ 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)
|
||||
* Fixed: TiledImage.setClip would sometimes leave tiles unloaded (#2590 @pearcetm)
|
||||
* Fixed: The WebGL drawer didn't support viewportMargins (#2600, #2606 @pearcetm)
|
||||
|
||||
5.0.0:
|
||||
|
||||
|
107
package-lock.json
generated
107
package-lock.json
generated
@ -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"
|
||||
}
|
||||
|
@ -128,9 +128,17 @@
|
||||
};
|
||||
}
|
||||
|
||||
this.elementWrapper = document.createElement('div');
|
||||
this.element = options.element;
|
||||
this.element.innerHTML = "<div>" + this.element.innerHTML + "</div>";
|
||||
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";
|
||||
}
|
||||
|
||||
this.style = this.elementWrapper.style;
|
||||
this._init(options);
|
||||
};
|
||||
|
||||
@ -197,7 +205,7 @@
|
||||
* @function
|
||||
*/
|
||||
destroy: function() {
|
||||
var element = this.element;
|
||||
var element = this.elementWrapper;
|
||||
var style = this.style;
|
||||
|
||||
if (element.parentNode) {
|
||||
@ -242,7 +250,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 +261,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 +278,15 @@
|
||||
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 +311,7 @@
|
||||
style[transformProp] = "";
|
||||
}
|
||||
}
|
||||
style.display = 'block';
|
||||
style.display = 'flex';
|
||||
}
|
||||
},
|
||||
|
||||
@ -355,7 +363,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;
|
||||
}
|
||||
|
@ -895,6 +895,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.
|
||||
|
@ -250,9 +250,10 @@
|
||||
*/
|
||||
draw(tiledImages){
|
||||
let gl = this._gl;
|
||||
const bounds = this.viewport.getBoundsNoRotateWithMargins(true);
|
||||
let view = {
|
||||
bounds: this.viewport.getBoundsNoRotate(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
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,13 @@ const drawers = {
|
||||
webgl: "New WebGL drawer"
|
||||
}
|
||||
|
||||
const viewportMargins = {
|
||||
left: 100,
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 50,
|
||||
};
|
||||
|
||||
//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
|
||||
|
@ -254,10 +254,10 @@
|
||||
|
||||
var expPosition = viewport.imageToViewerElementCoordinates(
|
||||
new OpenSeadragon.Point(13, 120));
|
||||
var actPosition = $("#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 = $("#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").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 = $("#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").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 = $("#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 = $("#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 = $("#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);
|
||||
}
|
||||
|
||||
@ -789,10 +790,10 @@
|
||||
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();
|
||||
@ -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();
|
||||
@ -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();
|
||||
@ -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();
|
||||
@ -1060,6 +1061,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,7 +1105,6 @@
|
||||
|
||||
viewer.addOnceHandler('open', function() {
|
||||
var viewport = viewer.viewport;
|
||||
|
||||
var $overlay = $("#fully-scaled-overlay");
|
||||
var expectedSize = viewport.deltaPixelsFromPointsNoRotate(
|
||||
new OpenSeadragon.Point(1, 1));
|
||||
@ -1090,7 +1112,7 @@
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user