Add utility method for getting relative size

This commit is contained in:
superbland 2021-10-09 15:45:19 +01:00
parent d1a5e926c6
commit 11ef3fcfbb

View File

@ -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);