From c16d1e3dff7bf6c299eb67b2a758903ae1926f1b Mon Sep 17 00:00:00 2001 From: jonasengelmann <40031476+jonasengelmann@users.noreply.github.com> Date: Fri, 1 Apr 2022 10:06:18 +0200 Subject: [PATCH] ensure backward compatibility --- src/viewer.js | 2 +- src/viewport.js | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 2b6a6b4a..0778e1e0 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -378,7 +378,7 @@ $.Viewer = function( options ) { minZoomLevel: this.minZoomLevel, maxZoomLevel: this.maxZoomLevel, viewer: this, - degrees: this.degrees, + initialDegrees: this.degrees, flipped: this.flipped, navigatorRotate: this.navigatorRotate, homeFillsViewer: this.homeFillsViewer, diff --git a/src/viewport.js b/src/viewport.js index 122708b1..dffad0f1 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -107,7 +107,7 @@ $.Viewport = function( options ) { defaultZoomLevel: $.DEFAULT_SETTINGS.defaultZoomLevel, minZoomLevel: $.DEFAULT_SETTINGS.minZoomLevel, maxZoomLevel: $.DEFAULT_SETTINGS.maxZoomLevel, - degrees: $.DEFAULT_SETTINGS.degrees, + initialDegrees: $.DEFAULT_SETTINGS.degrees, flipped: $.DEFAULT_SETTINGS.flipped, homeFillsViewer: $.DEFAULT_SETTINGS.homeFillsViewer, silenceMultiImageWarnings: $.DEFAULT_SETTINGS.silenceMultiImageWarnings @@ -134,11 +134,10 @@ $.Viewport = function( options ) { }); this.degreesSpring = new $.Spring({ - initial: options.degrees, + initial: options.initialDegrees, springStiffness: this.springStiffness, animationTime: this.animationTime }); - delete options.degrees; this._oldCenterX = this.centerSpringX.current.value; this._oldCenterY = this.centerSpringY.current.value; @@ -153,6 +152,19 @@ $.Viewport = function( options ) { /** @lends OpenSeadragon.Viewport.prototype */ $.Viewport.prototype = { + + // deprecated + get degrees () { + $.console.warn('Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead.'); + return this.getRotation(); + }, + + // deprecated + set degrees (degrees) { + $.console.warn('Setting [Viewport.degrees] is deprecated. Use viewport.setRotation instead.'); + this.setRotation(degrees); + }, + /** * Updates the viewport's home bounds and constraints for the given content size. * @function