From 92bcfa5416b1603bedd6b8a9ad2cc7ae0514c858 Mon Sep 17 00:00:00 2001 From: superbland Date: Sat, 30 Oct 2021 15:01:17 +0100 Subject: [PATCH] Rename method, update logic --- src/tiledimage.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index d6e8025b..8145a4d3 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -420,10 +420,12 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag }, /** - * @returns {OpenSeadragon.Point} The dimensions of the image as it would be currently rendered in the viewport + * @returns {OpenSeadragon.Point} The TiledImage's content size, in window coordinates. */ - getRelativeSize: function() { - return this.getContentSize().times(this.viewport.getZoom()); + getSizeInWindowCoordinates: function() { + var topLeft = this.viewport.imageToWindowCoordinates(new $.Point(0, 0)); + var bottomRight = this.viewport.imageToWindowCoordinates(this.getContentSize()); + return new $.Point(bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); }, // private