diff --git a/src/viewport.js b/src/viewport.js index e93d9e7e..5e9fd8a9 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -1007,6 +1007,34 @@ $.Viewport.prototype = { 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 * @returns {OpenSeadragon.Viewport} Chainable.