Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openseadragon-imaging/openseadragon-imaginghelper

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openseadragon-imaging/openseadragon-imaginghelper - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

6

CHANGELOG.md

@@ -1,3 +0,7 @@

## 2.2.0:
## 2.2.2:
* Fixed loading via HTML script tag
## 2.2.1:
* Updated README and docs

@@ -4,0 +8,0 @@

4

dist/openseadragon-imaginghelper.js

@@ -1,3 +0,3 @@

/*! @openseadragon-imaging/openseadragon-imaginghelper 2.2.1 80b24bd (clean) @license MIT */
!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("openseadragon")):"function"==typeof define&&define.amd?define(["openseadragon"],i):"object"==typeof exports?exports["openseadragon-imaginghelper"]=i(require("openseadragon")):e["openseadragon-imaginghelper"]=i(e.openseadragon)}(window,(function(e){return function(e){function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}var t={};return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(i){return e[i]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},i.p="",i(i.s=1)}([function(i){i.exports=e},function(e,i,t){"use strict";t.r(i);var o=t(0),n=t.n(o);i.default=function(e,i){if(!e.version||2>e.version.major)throw new Error("OpenSeadragonImagingHelper requires OpenSeadragon version 2.0.0+");return e.Viewer.prototype.activateImagingHelper=function(e){return this.imagingHelper||((e=e||{}).viewer=this,this.imagingHelper=new i.ImagingHelper(e)),this.imagingHelper},i.ImagingHelper=function(i){if(e.EventSource.call(this),!(i=i||{}).viewer)throw new Error("A viewer must be specified.");if(i.viewer.imagingHelper)throw new Error("Viewer already has an ImagingHelper.");this._viewer=i.viewer,this._worldIndex="number"==typeof i.worldIndex?i.worldIndex:0,this._viewer.imagingHelper=this,this.options=i,this.imgWidth=0,this.imgHeight=0,this.imgAspectRatio=0,this._zoomFactor=1,this._minZoom=.001,this._maxZoom=10,this._zoomStepPercent=30,this._haveImage=!1,this._viewerSize=null,this._viewportWidth=0,this._viewportHeight=0,this._viewportOrigin=new n.a.Point(0,0),this._viewportCenter=new n.a.Point(0,0),this._onOpen=e.delegate(this,this.onOpen),this._onClose=e.delegate(this,this.onClose),this._onAnimation=e.delegate(this,this.onAnimation),this._onAnimationFinish=e.delegate(this,this.onAnimationFinish),this._onResize=e.delegate(this,this.onResize),this._onFullPage=e.delegate(this,this.onFullPage),this._onFullScreen=e.delegate(this,this.onFullScreen),this._onWorldAddItem=e.delegate(this,this.onWorldAddItem),this._onWorldRemoveItem=e.delegate(this,this.onWorldRemoveItem),this._onWorldItemIndexChange=e.delegate(this,this.onWorldItemIndexChange),this._onWorldMetricsChange=e.delegate(this,this.onWorldMetricsChange),i.onImageViewChanged&&this.addHandler("image-view-changed",i.onImageViewChanged),this._viewer.addHandler("open",this._onOpen),this._viewer.addHandler("close",this._onClose),this._viewer.addHandler("animation",this._onAnimation),this._viewer.addHandler("animation-finish",this._onAnimationFinish),this._viewer.addHandler("resize",this._onResize),this._viewer.addHandler("full-page",this._onFullPage),this._viewer.addHandler("full-screen",this._onFullScreen)},i.ImagingHelper.prototype=Object.create(e.EventSource.prototype),i.ImagingHelper.version={versionStr:"2.2.1",major:2,minor:2,revision:1},Object.defineProperty(i.ImagingHelper.prototype,"constructor",{enumerable:!1,value:i.ImagingHelper}),i.ImagingHelper.prototype.destroy=function(){this.options.onImageViewChanged&&this.removeHandler("image-view-changed",this.options.onImageViewChanged),this._viewer.removeHandler("open",this._onOpen),this._viewer.removeHandler("close",this._onClose),this._viewer.removeHandler("animation",this._onAnimation),this._viewer.removeHandler("animation-finish",this._onAnimationFinish),this._viewer.removeHandler("resize",this._onResize),this._viewer.removeHandler("full-page",this._onFullPage),this._viewer.removeHandler("full-screen",this._onFullScreen),this._viewer.imagingHelper=null,this._viewer.destroy(),this._viewer=null,this.options.viewer=null},i.ImagingHelper.prototype._raiseImageViewChanged=function(){this.raiseEvent("image-view-changed",{viewportWidth:this._viewportWidth,viewportHeight:this._viewportHeight,viewportOrigin:this._viewportOrigin,viewportCenter:this._viewportCenter,zoomFactor:this._zoomFactor})},i.ImagingHelper.prototype._trackZoomPan=function(){var e=this._viewer.viewport.getBounds(!0);this._viewportOrigin.x=e.x,this._viewportOrigin.y=e.y*this.imgAspectRatio,this._viewportWidth=e.width,this._viewportHeight=e.height*this.imgAspectRatio,this._viewportCenter.x=this._viewportOrigin.x+this._viewportWidth/2,this._viewportCenter.y=this._viewportOrigin.y+this._viewportHeight/2,this._zoomFactor=this.getViewerContainerSize().x/(this._viewportWidth*this.imgWidth),this._raiseImageViewChanged()},i.ImagingHelper.prototype.getViewerContainerSize=function(){var i=this._viewer.container;return new e.Point(i.clientWidth,i.clientHeight)},i.ImagingHelper.prototype.notifyResize=function(){var e,i,t;this._haveImage&&(!(e=this.getViewerContainerSize()).equals(this._viewerSize)&&(this._viewerSize=e,i=new n.a.Point(this._viewportCenter.x,this._viewportCenter.y/this.imgAspectRatio),t=this._zoomFactor,this._viewer.viewport.resize(e,!1),this._viewer.viewport.zoomTo(t*this.imgWidth/e.x,null,!0),this._viewer.viewport.panTo(i,!0),this._raiseImageViewChanged()))},i.ImagingHelper.prototype.getMinZoom=function(){return this._minZoom},i.ImagingHelper.prototype.setMinZoom=function(e){this._minZoom=e,this._viewer.minZoomLevel=e*this.imgWidth/this.getViewerContainerSize().x},i.ImagingHelper.prototype.getMaxZoom=function(){return this._maxZoom},i.ImagingHelper.prototype.setMaxZoom=function(e){this._maxZoom=e,this._viewer.maxZoomLevel=e*this.imgWidth/this.getViewerContainerSize().x},i.ImagingHelper.prototype.getZoomStepPercent=function(){return this._zoomStepPercent},i.ImagingHelper.prototype.setZoomStepPercent=function(e){this._zoomStepPercent=e},i.ImagingHelper.prototype.setView=function(e,i,t,o){this._haveImage&&((this._viewportWidth!==e||this._viewportHeight!==i)&&this._viewer.viewport.zoomTo(1/e,null,o),(this._viewportCenter.x!==t.x||this._viewportCenter.y!==t.y)&&this._viewer.viewport.panTo(new n.a.Point(t.x,t.y/this.imgAspectRatio),o))},i.ImagingHelper.prototype.getZoomFactor=function(){return this._zoomFactor},i.ImagingHelper.prototype.setZoomFactor=function(e,i){this._haveImage&&e!==this._zoomFactor&&0<e&&this._viewer.viewport.zoomTo(e*this.imgWidth/this.getViewerContainerSize().x,new n.a.Point(this._viewportCenter.x,this._viewportCenter.y/this.imgAspectRatio),i)},i.ImagingHelper.prototype.zoomIn=function(e){var i=this._zoomFactor;(i*=1+this._zoomStepPercent/100)>this._maxZoom&&(i=this._maxZoom),this.setZoomFactor(i,e)},i.ImagingHelper.prototype.zoomOut=function(e){var i=this._zoomFactor;(i/=1+this._zoomStepPercent/100)<this._minZoom&&(i=this._minZoom),this.setZoomFactor(i,e)},i.ImagingHelper.prototype.zoomAboutLogicalPoint=function(e,i,t){this._haveImage&&e!==this._zoomFactor&&0<e&&this._viewer.viewport.zoomTo(e*this.imgWidth/this.getViewerContainerSize().x,new n.a.Point(i.x,i.y/this.imgAspectRatio),t)},i.ImagingHelper.prototype.zoomInAboutLogicalPoint=function(e,i){var t=this._zoomFactor;(t*=1+this._zoomStepPercent/100)>this._maxZoom&&(t=this._maxZoom),this.zoomAboutLogicalPoint(t,e,i)},i.ImagingHelper.prototype.zoomOutAboutLogicalPoint=function(e,i){var t=this._zoomFactor;(t/=1+this._zoomStepPercent/100)<this._minZoom&&(t=this._minZoom),this.zoomAboutLogicalPoint(t,e,i)},i.ImagingHelper.prototype.centerAboutLogicalPoint=function(e,i){this._haveImage&&(this._viewportCenter.x!==e.x||this._viewportCenter.y!==e.y)&&this._viewer.viewport.panTo(new n.a.Point(e.x,e.y/this.imgAspectRatio),i)},i.ImagingHelper.prototype.physicalToLogicalPoint=function(e){return new n.a.Point(this.physicalToLogicalX(e.x),this.physicalToLogicalY(e.y))},i.ImagingHelper.prototype.logicalToPhysicalPoint=function(e){return new n.a.Point(this.logicalToPhysicalX(e.x),this.logicalToPhysicalY(e.y))},i.ImagingHelper.prototype.physicalToLogicalX=function(e){return this._haveImage?this._viewportOrigin.x+e/this.getViewerContainerSize().x*this._viewportWidth:0},i.ImagingHelper.prototype.physicalToLogicalY=function(e){return this._haveImage?this._viewportOrigin.y+e/this.getViewerContainerSize().y*this._viewportHeight:0},i.ImagingHelper.prototype.logicalToPhysicalX=function(e){return this._haveImage?(e-this._viewportOrigin.x)/this._viewportWidth*this.getViewerContainerSize().x:0},i.ImagingHelper.prototype.logicalToPhysicalY=function(e){return this._haveImage?(e-this._viewportOrigin.y)/this._viewportHeight*this.getViewerContainerSize().y:0},i.ImagingHelper.prototype.physicalToLogicalDistance=function(e){return this._haveImage?e/this.getViewerContainerSize().x*this._viewportWidth:0},i.ImagingHelper.prototype.logicalToPhysicalDistance=function(e){return this._haveImage?e/this._viewportWidth*this.getViewerContainerSize().x:0},i.ImagingHelper.prototype.logicalToDataPoint=function(e){return new n.a.Point(this.logicalToDataX(e.x),this.logicalToDataY(e.y))},i.ImagingHelper.prototype.dataToLogicalPoint=function(e){return new n.a.Point(this.dataToLogicalX(e.x),this.dataToLogicalY(e.y))},i.ImagingHelper.prototype.physicalToDataPoint=function(e){return 1===this._viewer.world.getItemCount()?new n.a.Point(this.physicalToDataX(e.x),this.physicalToDataY(e.y)):this._viewer.world.getItemAt(this._worldIndex).viewerElementToImageCoordinates(e)},i.ImagingHelper.prototype.dataToPhysicalPoint=function(e){return new n.a.Point(this.dataToPhysicalX(e.x),this.dataToPhysicalY(e.y))},i.ImagingHelper.prototype.logicalToDataX=function(e){return this._haveImage?e*this.imgWidth:0},i.ImagingHelper.prototype.logicalToDataY=function(e){return this._haveImage?e*this.imgHeight:0},i.ImagingHelper.prototype.dataToLogicalX=function(e){return this._haveImage&&0<this.imgWidth?e/this.imgWidth:0},i.ImagingHelper.prototype.dataToLogicalY=function(e){return this._haveImage&&0<this.imgHeight?e/this.imgHeight:0},i.ImagingHelper.prototype.physicalToDataX=function(e){return 1===this._viewer.world.getItemCount()?this._haveImage&&0<this.getViewerContainerSize().x?(this._viewportOrigin.x+e/this.getViewerContainerSize().x*this._viewportWidth)*this.imgWidth:0:this._viewer.world.getItemAt(this._worldIndex).viewerElementToImageCoordinates(new n.a.Point(e,0)).x},i.ImagingHelper.prototype.physicalToDataY=function(e){return 1===this._viewer.world.getItemCount()?this._haveImage&&0<this.getViewerContainerSize().y?(this._viewportOrigin.y+e/this.getViewerContainerSize().y*this._viewportHeight)*this.imgHeight:0:this._viewer.world.getItemAt(this._worldIndex).viewerElementToImageCoordinates(new n.a.Point(0,e)).y},i.ImagingHelper.prototype.dataToPhysicalX=function(e){return this._haveImage&&0<this.imgWidth?(e/this.imgWidth-this._viewportOrigin.x)/this._viewportWidth*this.getViewerContainerSize().x:0},i.ImagingHelper.prototype.dataToPhysicalY=function(e){return this._haveImage&&0<this.imgHeight?(e/this.imgHeight-this._viewportOrigin.y)/this._viewportHeight*this.getViewerContainerSize().y:0},i.ImagingHelper.prototype.onOpen=function(){var e=this._viewer.world.getItemAt(this._worldIndex);this._haveImage=!0,this.imgWidth=e.source.dimensions.x,this.imgHeight=e.source.dimensions.y,this.imgAspectRatio=this.imgWidth/this.imgHeight,this._trackZoomPan()},i.ImagingHelper.prototype.onClose=function(){this._haveImage=!1,this.imgWidth=0,this.imgHeight=0,this.imgAspectRatio=0},i.ImagingHelper.prototype.onAnimation=function(){this._trackZoomPan()},i.ImagingHelper.prototype.onAnimationFinish=function(){this._trackZoomPan()},i.ImagingHelper.prototype.onResize=function(){this._viewer.autoResize&&this._trackZoomPan()},i.ImagingHelper.prototype.onFullPage=function(){this._trackZoomPan()},i.ImagingHelper.prototype.onFullScreen=function(){this._trackZoomPan()},i.ImagingHelper}(n.a||window.OpenSeadragon,window.OpenSeadragonImaging=window.OpenSeadragonImaging||{})}]).default}));
/*! @openseadragon-imaging/openseadragon-imaginghelper 2.2.2 1a579f4 (clean) @license MIT */
!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("openseadragon")):"function"==typeof define&&define.amd?define(["openseadragon"],i):"object"==typeof exports?exports["openseadragon-imaginghelper"]=i(require("openseadragon")):e["openseadragon-imaginghelper"]=i(e.openseadragon)}(window,(function(e){return function(e){function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}var t={};return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(i){return e[i]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},i.p="",i(i.s=1)}([function(i){i.exports=e},function(e,i,t){"use strict";t.r(i);var o=t(0),n=t.n(o);i.default=function(e,i){if(!e.version||2>e.version.major)throw new Error("OpenSeadragonImagingHelper requires OpenSeadragon version 2.0.0+");return e.Viewer.prototype.activateImagingHelper=function(e){return this.imagingHelper||((e=e||{}).viewer=this,this.imagingHelper=new i.ImagingHelper(e)),this.imagingHelper},i.ImagingHelper=function(i){if(e.EventSource.call(this),!(i=i||{}).viewer)throw new Error("A viewer must be specified.");if(i.viewer.imagingHelper)throw new Error("Viewer already has an ImagingHelper.");this._viewer=i.viewer,this._worldIndex="number"==typeof i.worldIndex?i.worldIndex:0,this._viewer.imagingHelper=this,this.options=i,this.imgWidth=0,this.imgHeight=0,this.imgAspectRatio=0,this._zoomFactor=1,this._minZoom=.001,this._maxZoom=10,this._zoomStepPercent=30,this._haveImage=!1,this._viewerSize=null,this._viewportWidth=0,this._viewportHeight=0,this._viewportOrigin=new e.Point(0,0),this._viewportCenter=new e.Point(0,0),this._onOpen=e.delegate(this,this.onOpen),this._onClose=e.delegate(this,this.onClose),this._onAnimation=e.delegate(this,this.onAnimation),this._onAnimationFinish=e.delegate(this,this.onAnimationFinish),this._onResize=e.delegate(this,this.onResize),this._onFullPage=e.delegate(this,this.onFullPage),this._onFullScreen=e.delegate(this,this.onFullScreen),this._onWorldAddItem=e.delegate(this,this.onWorldAddItem),this._onWorldRemoveItem=e.delegate(this,this.onWorldRemoveItem),this._onWorldItemIndexChange=e.delegate(this,this.onWorldItemIndexChange),this._onWorldMetricsChange=e.delegate(this,this.onWorldMetricsChange),i.onImageViewChanged&&this.addHandler("image-view-changed",i.onImageViewChanged),this._viewer.addHandler("open",this._onOpen),this._viewer.addHandler("close",this._onClose),this._viewer.addHandler("animation",this._onAnimation),this._viewer.addHandler("animation-finish",this._onAnimationFinish),this._viewer.addHandler("resize",this._onResize),this._viewer.addHandler("full-page",this._onFullPage),this._viewer.addHandler("full-screen",this._onFullScreen)},i.ImagingHelper.prototype=Object.create(e.EventSource.prototype),i.ImagingHelper.version={versionStr:"2.2.2",major:2,minor:2,revision:2},Object.defineProperty(i.ImagingHelper.prototype,"constructor",{enumerable:!1,value:i.ImagingHelper}),i.ImagingHelper.prototype.destroy=function(){this.options.onImageViewChanged&&this.removeHandler("image-view-changed",this.options.onImageViewChanged),this._viewer.removeHandler("open",this._onOpen),this._viewer.removeHandler("close",this._onClose),this._viewer.removeHandler("animation",this._onAnimation),this._viewer.removeHandler("animation-finish",this._onAnimationFinish),this._viewer.removeHandler("resize",this._onResize),this._viewer.removeHandler("full-page",this._onFullPage),this._viewer.removeHandler("full-screen",this._onFullScreen),this._viewer.imagingHelper=null,this._viewer.destroy(),this._viewer=null,this.options.viewer=null},i.ImagingHelper.prototype._raiseImageViewChanged=function(){this.raiseEvent("image-view-changed",{viewportWidth:this._viewportWidth,viewportHeight:this._viewportHeight,viewportOrigin:this._viewportOrigin,viewportCenter:this._viewportCenter,zoomFactor:this._zoomFactor})},i.ImagingHelper.prototype._trackZoomPan=function(){var e=this._viewer.viewport.getBounds(!0);this._viewportOrigin.x=e.x,this._viewportOrigin.y=e.y*this.imgAspectRatio,this._viewportWidth=e.width,this._viewportHeight=e.height*this.imgAspectRatio,this._viewportCenter.x=this._viewportOrigin.x+this._viewportWidth/2,this._viewportCenter.y=this._viewportOrigin.y+this._viewportHeight/2,this._zoomFactor=this.getViewerContainerSize().x/(this._viewportWidth*this.imgWidth),this._raiseImageViewChanged()},i.ImagingHelper.prototype.getViewerContainerSize=function(){var i=this._viewer.container;return new e.Point(i.clientWidth,i.clientHeight)},i.ImagingHelper.prototype.notifyResize=function(){var i,t,o;this._haveImage&&(!(i=this.getViewerContainerSize()).equals(this._viewerSize)&&(this._viewerSize=i,t=new e.Point(this._viewportCenter.x,this._viewportCenter.y/this.imgAspectRatio),o=this._zoomFactor,this._viewer.viewport.resize(i,!1),this._viewer.viewport.zoomTo(o*this.imgWidth/i.x,null,!0),this._viewer.viewport.panTo(t,!0),this._raiseImageViewChanged()))},i.ImagingHelper.prototype.getMinZoom=function(){return this._minZoom},i.ImagingHelper.prototype.setMinZoom=function(e){this._minZoom=e,this._viewer.minZoomLevel=e*this.imgWidth/this.getViewerContainerSize().x},i.ImagingHelper.prototype.getMaxZoom=function(){return this._maxZoom},i.ImagingHelper.prototype.setMaxZoom=function(e){this._maxZoom=e,this._viewer.maxZoomLevel=e*this.imgWidth/this.getViewerContainerSize().x},i.ImagingHelper.prototype.getZoomStepPercent=function(){return this._zoomStepPercent},i.ImagingHelper.prototype.setZoomStepPercent=function(e){this._zoomStepPercent=e},i.ImagingHelper.prototype.setView=function(i,t,o,n){this._haveImage&&((this._viewportWidth!==i||this._viewportHeight!==t)&&this._viewer.viewport.zoomTo(1/i,null,n),(this._viewportCenter.x!==o.x||this._viewportCenter.y!==o.y)&&this._viewer.viewport.panTo(new e.Point(o.x,o.y/this.imgAspectRatio),n))},i.ImagingHelper.prototype.getZoomFactor=function(){return this._zoomFactor},i.ImagingHelper.prototype.setZoomFactor=function(i,t){this._haveImage&&i!==this._zoomFactor&&0<i&&this._viewer.viewport.zoomTo(i*this.imgWidth/this.getViewerContainerSize().x,new e.Point(this._viewportCenter.x,this._viewportCenter.y/this.imgAspectRatio),t)},i.ImagingHelper.prototype.zoomIn=function(e){var i=this._zoomFactor;(i*=1+this._zoomStepPercent/100)>this._maxZoom&&(i=this._maxZoom),this.setZoomFactor(i,e)},i.ImagingHelper.prototype.zoomOut=function(e){var i=this._zoomFactor;(i/=1+this._zoomStepPercent/100)<this._minZoom&&(i=this._minZoom),this.setZoomFactor(i,e)},i.ImagingHelper.prototype.zoomAboutLogicalPoint=function(i,t,o){this._haveImage&&i!==this._zoomFactor&&0<i&&this._viewer.viewport.zoomTo(i*this.imgWidth/this.getViewerContainerSize().x,new e.Point(t.x,t.y/this.imgAspectRatio),o)},i.ImagingHelper.prototype.zoomInAboutLogicalPoint=function(e,i){var t=this._zoomFactor;(t*=1+this._zoomStepPercent/100)>this._maxZoom&&(t=this._maxZoom),this.zoomAboutLogicalPoint(t,e,i)},i.ImagingHelper.prototype.zoomOutAboutLogicalPoint=function(e,i){var t=this._zoomFactor;(t/=1+this._zoomStepPercent/100)<this._minZoom&&(t=this._minZoom),this.zoomAboutLogicalPoint(t,e,i)},i.ImagingHelper.prototype.centerAboutLogicalPoint=function(i,t){this._haveImage&&(this._viewportCenter.x!==i.x||this._viewportCenter.y!==i.y)&&this._viewer.viewport.panTo(new e.Point(i.x,i.y/this.imgAspectRatio),t)},i.ImagingHelper.prototype.physicalToLogicalPoint=function(i){return new e.Point(this.physicalToLogicalX(i.x),this.physicalToLogicalY(i.y))},i.ImagingHelper.prototype.logicalToPhysicalPoint=function(i){return new e.Point(this.logicalToPhysicalX(i.x),this.logicalToPhysicalY(i.y))},i.ImagingHelper.prototype.physicalToLogicalX=function(e){return this._haveImage?this._viewportOrigin.x+e/this.getViewerContainerSize().x*this._viewportWidth:0},i.ImagingHelper.prototype.physicalToLogicalY=function(e){return this._haveImage?this._viewportOrigin.y+e/this.getViewerContainerSize().y*this._viewportHeight:0},i.ImagingHelper.prototype.logicalToPhysicalX=function(e){return this._haveImage?(e-this._viewportOrigin.x)/this._viewportWidth*this.getViewerContainerSize().x:0},i.ImagingHelper.prototype.logicalToPhysicalY=function(e){return this._haveImage?(e-this._viewportOrigin.y)/this._viewportHeight*this.getViewerContainerSize().y:0},i.ImagingHelper.prototype.physicalToLogicalDistance=function(e){return this._haveImage?e/this.getViewerContainerSize().x*this._viewportWidth:0},i.ImagingHelper.prototype.logicalToPhysicalDistance=function(e){return this._haveImage?e/this._viewportWidth*this.getViewerContainerSize().x:0},i.ImagingHelper.prototype.logicalToDataPoint=function(i){return new e.Point(this.logicalToDataX(i.x),this.logicalToDataY(i.y))},i.ImagingHelper.prototype.dataToLogicalPoint=function(i){return new e.Point(this.dataToLogicalX(i.x),this.dataToLogicalY(i.y))},i.ImagingHelper.prototype.physicalToDataPoint=function(i){return 1===this._viewer.world.getItemCount()?new e.Point(this.physicalToDataX(i.x),this.physicalToDataY(i.y)):this._viewer.world.getItemAt(this._worldIndex).viewerElementToImageCoordinates(i)},i.ImagingHelper.prototype.dataToPhysicalPoint=function(i){return new e.Point(this.dataToPhysicalX(i.x),this.dataToPhysicalY(i.y))},i.ImagingHelper.prototype.logicalToDataX=function(e){return this._haveImage?e*this.imgWidth:0},i.ImagingHelper.prototype.logicalToDataY=function(e){return this._haveImage?e*this.imgHeight:0},i.ImagingHelper.prototype.dataToLogicalX=function(e){return this._haveImage&&0<this.imgWidth?e/this.imgWidth:0},i.ImagingHelper.prototype.dataToLogicalY=function(e){return this._haveImage&&0<this.imgHeight?e/this.imgHeight:0},i.ImagingHelper.prototype.physicalToDataX=function(i){return 1===this._viewer.world.getItemCount()?this._haveImage&&0<this.getViewerContainerSize().x?(this._viewportOrigin.x+i/this.getViewerContainerSize().x*this._viewportWidth)*this.imgWidth:0:this._viewer.world.getItemAt(this._worldIndex).viewerElementToImageCoordinates(new e.Point(i,0)).x},i.ImagingHelper.prototype.physicalToDataY=function(i){return 1===this._viewer.world.getItemCount()?this._haveImage&&0<this.getViewerContainerSize().y?(this._viewportOrigin.y+i/this.getViewerContainerSize().y*this._viewportHeight)*this.imgHeight:0:this._viewer.world.getItemAt(this._worldIndex).viewerElementToImageCoordinates(new e.Point(0,i)).y},i.ImagingHelper.prototype.dataToPhysicalX=function(e){return this._haveImage&&0<this.imgWidth?(e/this.imgWidth-this._viewportOrigin.x)/this._viewportWidth*this.getViewerContainerSize().x:0},i.ImagingHelper.prototype.dataToPhysicalY=function(e){return this._haveImage&&0<this.imgHeight?(e/this.imgHeight-this._viewportOrigin.y)/this._viewportHeight*this.getViewerContainerSize().y:0},i.ImagingHelper.prototype.onOpen=function(){var e=this._viewer.world.getItemAt(this._worldIndex);this._haveImage=!0,this.imgWidth=e.source.dimensions.x,this.imgHeight=e.source.dimensions.y,this.imgAspectRatio=this.imgWidth/this.imgHeight,this._trackZoomPan()},i.ImagingHelper.prototype.onClose=function(){this._haveImage=!1,this.imgWidth=0,this.imgHeight=0,this.imgAspectRatio=0},i.ImagingHelper.prototype.onAnimation=function(){this._trackZoomPan()},i.ImagingHelper.prototype.onAnimationFinish=function(){this._trackZoomPan()},i.ImagingHelper.prototype.onResize=function(){this._viewer.autoResize&&this._trackZoomPan()},i.ImagingHelper.prototype.onFullPage=function(){this._trackZoomPan()},i.ImagingHelper.prototype.onFullScreen=function(){this._trackZoomPan()},i.ImagingHelper}(n.a||window.OpenSeadragon,window.OpenSeadragonImaging=window.OpenSeadragonImaging||{})}]).default}));
//# sourceMappingURL=openseadragon-imaginghelper.js.map
{
"name": "@openseadragon-imaging/openseadragon-imaginghelper",
"version": "2.2.1",
"version": "2.2.2",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc