Compare commits

...

6 Commits

Author SHA1 Message Date
Ian Gilman
c5c1fd156f Changelog for #2253 2022-12-06 13:54:38 -08:00
Ian Gilman
4f990c74b7
Merge pull request #2253 from pearcetm/rotation-api-reconciliation
Rotation api reconciliation
2022-12-06 13:52:40 -08:00
Tom
845cbced69 reverted Viewport.setRotation, created Viewport.setRotationWithPivot 2022-12-05 19:40:30 -05:00
Tom
05997d359c reverted Viewport.setRotation, created Viewport.setRotationWithPivot 2022-12-05 19:38:46 -05:00
Ian Gilman
f85c8ca4e9
Merge pull request #2251 from openseadragon/dependabot/npm_and_yarn/decode-uri-component-0.2.2
Bump decode-uri-component from 0.2.0 to 0.2.2
2022-12-05 13:51:19 -08:00
dependabot[bot]
5a11784173
Bump decode-uri-component from 0.2.0 to 0.2.2
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-04 03:42:28 +00:00
6 changed files with 38 additions and 23 deletions

View File

@ -6,7 +6,7 @@ OPENSEADRAGON CHANGELOG
* NEW BEHAVIOR: Setting the viewport rotation now animates by default (pass false for the new immediately parameter to disable) (#2136 @jonasengelmann)
* DEPRECATION: Don't access the viewport's degrees property directly anymore; instead use setRotation and getRotation (#2136 @jonasengelmann)
* New gesture: Double-click and drag to zoom (on by default for touch) (#2225 @HamzaTatheer)
* You can now provide a pivot point when rotating the viewport (#2233 @ pearcetm)
* You can now provide a pivot point when rotating the viewport (#2233 #2253 @pearcetm)
* Improved the constraints that keep the image in the viewer, specifically when zoomed out a lot (#2160 @joedf, #2246 @pearcetm)
* You can now provide an element for the navigator (as an alternative to an ID) (#1303 @cameronbaney, #2166 #2175 @joedf)
* Now supporting IIIF "id" and "identifier" in addition to "@id" (#2173 @ahankinson)

9
package-lock.json generated
View File

@ -1011,9 +1011,10 @@
}
},
"node_modules/decode-uri-component": {
"version": "0.2.0",
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
"integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10"
}
@ -7121,7 +7122,9 @@
}
},
"decode-uri-component": {
"version": "0.2.0",
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
"integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==",
"dev": true
},
"deep-is": {

View File

@ -913,17 +913,15 @@ $.Viewport.prototype = {
},
/**
* Rotates this viewport to the angle specified. Alias for rotateTo.
* Rotates this viewport to the angle specified.
* @function
* @param {Number} degrees The degrees to set the rotation to.
* @param {OpenSeadragon.Point} [pivot] (Optional) point in viewport coordinates
* around which the rotation should be performed. Defaults to the center of the viewport.
* @param {Boolean} [immediately=false] Whether to animate to the new angle
* or rotate immediately.
* * @returns {OpenSeadragon.Viewport} Chainable.
*/
setRotation: function(degrees, pivot, immediately) {
return this.rotateTo(degrees, pivot, immediately);
setRotation: function(degrees, immediately) {
return this.rotateTo(degrees, null, immediately);
},
/**
@ -938,6 +936,20 @@ $.Viewport.prototype = {
this.degreesSpring.target.value;
},
/**
* Rotates this viewport to the angle specified around a pivot point. Alias for rotateTo.
* @function
* @param {Number} degrees The degrees to set the rotation to.
* @param {OpenSeadragon.Point} [pivot] (Optional) point in viewport coordinates
* around which the rotation should be performed. Defaults to the center of the viewport.
* @param {Boolean} [immediately=false] Whether to animate to the new angle
* or rotate immediately.
* * @returns {OpenSeadragon.Viewport} Chainable.
*/
setRotationWithPivot: function(degrees, pivot, immediately) {
return this.rotateTo(degrees, pivot, immediately);
},
/**
* Rotates this viewport to the angle specified.
* @function

View File

@ -46,7 +46,7 @@
});
viewer.addHandler('open', function handler(event) {
viewer.viewport.setRotation(30, null, true);
viewer.viewport.setRotation(30, true);
Util.spyOnce(viewer.drawer.context, 'rotate', function() {
assert.ok(true, 'drawing with new rotation');
done();

View File

@ -212,13 +212,13 @@
checkPoint(assert, ' after zoom and pan');
//Restore rotation
viewer.viewport.setRotation(0, null, true);
viewer.viewport.setRotation(0, true);
done();
});
viewer.viewport.zoomTo(0.8).panTo(new OpenSeadragon.Point(0.1, 0.2));
});
viewer.viewport.setRotation(45, null, true);
viewer.viewport.setRotation(45, true);
viewer.open([{
tileSource: "/test/data/testpattern.dzi"
}, {

View File

@ -247,7 +247,7 @@
function openHandler() {
viewer.removeHandler('open', openHandler);
var viewport = viewer.viewport;
viewport.setRotation(-675, null, true);
viewport.setRotation(-675, true);
Util.assertRectangleEquals(
assert,
viewport.getHomeBoundsNoRotate(),
@ -269,7 +269,7 @@
function openHandler() {
viewer.removeHandler('open', openHandler);
var viewport = viewer.viewport;
viewport.setRotation(-675, null, true);
viewport.setRotation(-675, true);
Util.assertRectangleEquals(
assert,
viewport.getHomeBounds(),
@ -533,7 +533,7 @@
var openHandler = function() {
viewer.removeHandler('open', openHandler);
var viewport = viewer.viewport;
viewport.setRotation(45, null, true);
viewport.setRotation(45, true);
viewport.fitBounds(new OpenSeadragon.Rect(1, 1, 1, 1), true);
viewport.applyConstraints(true);
var bounds = viewport.getBounds();
@ -557,7 +557,7 @@
var viewport = viewer.viewport;
viewport.setFlip(true);
viewport.setRotation(45, null, true);
viewport.setRotation(45, true);
viewport.fitBounds(new OpenSeadragon.Rect(1, 1, 1, 1), true);
viewport.applyConstraints(true);
@ -659,7 +659,7 @@
var openHandler = function(event) {
viewer.removeHandler('open', openHandler);
var viewport = viewer.viewport;
viewport.setRotation(45, null, true);
viewport.setRotation(45, true);
for(var i = 0; i < testRectsFitBounds.length; i++){
var rect = testRectsFitBounds[i];
@ -1066,12 +1066,12 @@
var viewport = viewer.viewport;
assert.propEqual(viewport.getRotation, 0, "Original rotation should be 0 degrees");
viewport.setRotation(90, null, true);
viewport.setRotation(90, true);
assert.propEqual(viewport.getRotation, 90, "Rotation should be 90 degrees");
viewport.setRotation(-75, null, true);
viewport.setRotation(-75, true);
assert.propEqual(viewport.getRotation, -75, "Rotation should be -75 degrees");
viewport.setRotation(0, null, true);
viewport.setRotation(0, true);
assert.strictEqual(viewport.getRotation(true), 0, 'viewport has default current rotation');
assert.strictEqual(viewport.getRotation(false), 0, 'viewport has default target rotation');
@ -1079,7 +1079,7 @@
assert.strictEqual(viewport.getRotation(true), 0, 'current rotation is not changed');
assert.strictEqual(viewport.getRotation(false), 33, 'target rotation is set correctly');
viewport.setRotation(200, null, true);
viewport.setRotation(200, true);
assert.strictEqual(viewport.getRotation(true), 200, 'current rotation is set correctly');
assert.strictEqual(viewport.getRotation(false), 200, 'target rotation is set correctly');
@ -1099,9 +1099,9 @@
viewport.setFlip(true);
assert.propEqual(viewport.getRotation, 0, "Original flipped rotation should be 0 degrees");
viewport.setRotation(90, null, true);
viewport.setRotation(90, true);
assert.propEqual(viewport.getRotation, 90, "Flipped rotation should be 90 degrees");
viewport.setRotation(-75, null, true);
viewport.setRotation(-75, true);
assert.propEqual(viewport.getRotation, -75, "Flipped rotation should be -75 degrees");
done();