From 11ef3fcfbb29052a9f67ddd5493c9252c7924091 Mon Sep 17 00:00:00 2001 From: superbland Date: Sat, 9 Oct 2021 15:45:19 +0100 Subject: [PATCH] Add utility method for getting relative size --- src/tiledimage.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tiledimage.js b/src/tiledimage.js index 82e35ed7..d6e8025b 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -419,6 +419,13 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag return new $.Point(this.source.dimensions.x, this.source.dimensions.y); }, + /** + * @returns {OpenSeadragon.Point} The dimensions of the image as it would be currently rendered in the viewport + */ + getRelativeSize: function() { + return this.getContentSize().times(this.viewport.getZoom()); + }, + // private _viewportToImageDelta: function( viewerX, viewerY, current ) { var scale = (current ? this._scaleSpring.current.value : this._scaleSpring.target.value);