From 53d1534cc220a39f046c746c96fd6f38fd71c73f Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Tue, 5 Apr 2016 13:05:32 -0400 Subject: [PATCH] Add old properties for backward compatibility. --- changelog.txt | 8 +++++--- src/overlay.js | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8fe8397d..8829d474 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,9 +5,11 @@ OPENSEADRAGON CHANGELOG * BREAKING CHANGE: Viewport.homeBounds, Viewport.contentSize, Viewport.contentAspectX and Viewport.contentAspectY have been removed. (#846) -* BREAKING CHANGE: Overlay.scales, Overlay.bounds and Overlay.position have been removed. (#896) - * Overlay.scales can be replaced by Overlay.width !== null && Overlay.height !== null - * The Overlay.getBounds method can be used to get the bounds of the overlay in viewport coordinates +* BREAKING CHANGE: The Overlay.getBounds method now takes the viewport as parameter. (#896) +* DEPRECATION: Overlay.scales, Overlay.bounds and Overlay.position have been deprecated. (#896) + * Overlay.width !== null should be used to test whether the overlay scales horizontally + * Overlay.height !== null should be used to test whether the overlay scales vertically + * The Overlay.getBounds method should be used to get the bounds of the overlay in viewport coordinates * Overlay.location replaces Overlay.position * DEPRECATION: Viewport.setHomeBounds has been deprecated (#846) * DEPRECATION: the Viewport constructor is now ignoring the contentSize option (#846) diff --git a/src/overlay.js b/src/overlay.js index 7465d573..9c7b4d93 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -156,6 +156,12 @@ this.location = this.location.getTopLeft(); this.placement = $.Placement.TOP_LEFT; } + + // Deprecated properties kept for backward compatibility. + this.scales = this.width !== null && this.height !== null; + this.bounds = new $.Rect( + this.location.x, this.location.y, this.width, this.height); + this.position = this.location; }, /**