Add rotateBy and rotateTo to the API

This commit is contained in:
Tom 2022-11-12 18:18:25 -05:00
parent 51807a77f0
commit bfddf7355b

View File

@ -1007,6 +1007,34 @@ $.Viewport.prototype = {
this.degreesSpring.target.value; this.degreesSpring.target.value;
}, },
/**
* Rotates this viewport to the angle specified. Alias for setRotation to be consistent with with pan and zoom API
* @function
* @param {Number} degrees The degrees to set the rotation to.
* @param {Boolean} [immediately=false] Whether to animate to the new angle
* or rotate immediately.
* @param {OpenSeadragon.Point} [pivot=false] (Optional) point in viewport coordinates
* around which the rotation should be performed. Defaults to the center of the viewport.
* @returns {OpenSeadragon.Viewport} Chainable.
*/
rotateTo: function(degrees, immediately, pivot){
return this.setRotation(degrees, immediately, pivot);
},
/**
* Rotates this viewport by the angle specified. Alias for setRotation to be consistent with with pan and zoom API
* @function
* @param {Number} degrees The degrees by which to rotate the viewport.
* @param {Boolean} [immediately=false] Whether to animate to the new angle
* or rotate immediately.
* @param {OpenSeadragon.Point} [pivot=false] (Optional) point in viewport coordinates
* around which the rotation should be performed. Defaults to the center of the viewport.
* @returns {OpenSeadragon.Viewport} Chainable.
*/
rotateBy: function(degrees, immediately, pivot){
return this.setRotation(this.degreesSpring.target.value + degrees, immediately, pivot);
},
/** /**
* @function * @function
* @returns {OpenSeadragon.Viewport} Chainable. * @returns {OpenSeadragon.Viewport} Chainable.