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.0 to 2.2.1

4

CHANGELOG.md
## 2.2.0:
* Updated README and docs
## 2.2.0:
* Added destroy() method - frees OpenSeadragon references and restores hooks so OpenSeadragon not bound by the handler closures

4

dist/openseadragon-imaginghelper.js

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

/*! @openseadragon-imaging/openseadragon-imaginghelper 2.2.0 25fbe98 (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.0",major:2,minor:2,revision:0},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.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}));
//# sourceMappingURL=openseadragon-imaginghelper.js.map
{
"name": "@openseadragon-imaging/openseadragon-imaginghelper",
"version": "2.2.0",
"version": "2.2.1",
"publishConfig": {

@@ -47,4 +47,4 @@ "access": "public"

"devDependencies": {
"@babel/cli": "^7.10.4",
"@babel/core": "^7.10.4",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/preset-env": "^7.10.4",

@@ -57,3 +57,3 @@ "@babel/preset-react": "^7.10.4",

"css-loader": "^3.6.0",
"eslint": "^7.3.1",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.11.0",

@@ -63,3 +63,3 @@ "eslint-loader": "^4.0.2",

"eslint-plugin-prettier": "^3.1.4",
"execa": "^4.0.2",
"execa": "^4.0.3",
"fibers": "5.0.0",

@@ -70,4 +70,4 @@ "jsdoc": "^3.6.4",

"regenerator-runtime": "0.13.5",
"sass": "^1.26.9",
"sass-loader": "^8.0.2",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"string-replace-loader": "^2.3.0",

@@ -77,3 +77,3 @@ "style-loader": "^1.2.1",

"webpack-cli": "^3.3.12",
"webpack-merge": "^4.2.2"
"webpack-merge": "^5.0.9"
},

@@ -80,0 +80,0 @@ "peerDependencies": {

@@ -1,2 +0,2 @@

## OpenSeadragonImagingHelper
# OpenSeadragonImagingHelper

@@ -9,7 +9,7 @@ [![Gitter](https://badges.gitter.im/openseadragon-imaging/community.svg)](https://gitter.im/openseadragon-imaging/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

[View the Documentation](http://msalsbery.github.io/openseadragon-imaging/docs/openseadragon-imaginghelper/index.html)
[View the Documentation](https://openseadragon-imaging.github.io/docs/openseadragon-imaginghelper/index.html)
[See the OpenSeadragon Imaging Demo/Test Site Live](http://msalsbery.github.io/openseadragon-imaging/demo/index.html)
[Demo/Test Site](https://openseadragon-imaging.github.io/#/imaginghelper)
### Usage
## Usage

@@ -20,3 +20,3 @@ _**Prerequisite note: OpenSeadragonImagingHelper requires [OpenSeadragon](https://github.com/openseadragon/openseadragon) version 2.0+.**_

1. Direct download [openseadragon-imaginghelper.js](http://msalsbery.github.io/openseadragon-imaging/builds/openseadragon-imaginghelper.js) (and optionally [openseadragon-imaginghelper.js.map](http://msalsbery.github.io/openseadragon-imaging/builds/openseadragon-imaginghelper.js.map))
1. Direct download [openseadragon-imaginghelper.js](https://openseadragon-imaging.github.io/builds/openseadragon-imaginghelper.js) (and optionally [openseadragon-imaginghelper.js.map](https://openseadragon-imaging.github.io/builds/openseadragon-imaginghelper.js.map))
2. npm

@@ -30,3 +30,3 @@

An **ImagingHelper** object can be created and attached to an [OpenSeadragon.Viewer](http://openseadragon.github.io/docs/OpenSeadragon.Viewer.html) two ways:
An **ImagingHelper** object can be created and attached to an [OpenSeadragon.Viewer](https://openseadragon.github.io/docs/OpenSeadragon.Viewer.html) two ways:

@@ -90,3 +90,3 @@ 1. Call the activateImagingHelper method on the viewer

### Details
## Details

@@ -107,6 +107,6 @@ The ImagingHelper class provides a simplified zoomFactor which is simply the ratio

individual horizontal/vertical values or point ({x,y}) objects between coordinate systems
**(Note: methods that return a point object return new [OpenSeadragon.Point](http://openseadragon.github.io/docs/OpenSeadragon.Point.html)
**(Note: methods that return a point object return new [OpenSeadragon.Point](https://openseadragon.github.io/docs/OpenSeadragon.Point.html)
objects)**
The ImagingHelper class extends the [OpenSeadragon.EventSource](http://openseadragon.github.io/docs/OpenSeadragon.EventHandler.html) class and raises
The ImagingHelper class extends the [OpenSeadragon.EventSource](https://openseadragon.github.io/docs/OpenSeadragon.EventHandler.html) class and raises
an event named **'image-view-changed'** whenever the viewer's zoom and/or pan position changes.

@@ -142,16 +142,18 @@

### Demo/Test Site
## Demo/Test Site
The 'demo' folder provides a demo/test site.
The page displays many OpenSeadragon and OpenSeadragonImagingHelper metrics, as well as the output of many OpenSeadragonImagingHelper methods,
all in real-time as the cursor moves and/or the image is zoomed/panned. Four sample images are provided.
The [demo site](https://openseadragon-imaging.github.io/#/imaginghelper) is an example using ImagingHelper in a React application.
The page displays many OpenSeadragon and OpenSeadragonImagingHelper metrics, as well as the output of many OpenSeadragonImagingHelper methods, all in real-time as the cursor moves and/or the image is zoomed/panned.
Additionally, there's an example of syncing an SVG overlay for annotation support.
The source code can be found [here](https://github.com/openseadragon-imaging/openseadragon-imaging/tree/master/site.github.io/src/page-imaginghelper).
All the sample code is in [demo/scripts/viewmodel.js](http://msalsbery.github.io/openseadragon-imaging/demo/scripts/viewmodel.js).
## Legacy Demo/Test Site
### Notes
The old demo site is still available [here](https://openseadragon-imaging.github.io/old-demo/index.html).
This page adds an example of syncing an SVG overlay for annotation support.
### In the works...
All the sample code is in [scripts/viewmodel.js](https://openseadragon-imaging.github.io/old-demo/scripts/viewmodel.js).
## TODO
1. Better multi-image support

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