Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@openseadragon-imaging/openseadragon-imaginghelper
Advanced tools
OpenSeadragon plugin which adds helper properties/methods for imaging applications.
OpenSeadragonImagingHelper is a plugin for OpenSeadragon which implements some properties and methods helpful in imaging applications.
See the OpenSeadragon Imaging Demo/Test Site Live
Download openseadragon-imaginghelper.min.js (or the un-minified openseadragon-imaginghelper.js)
To use the plugin, add openseadragon-imaginghelper.min.js after openseadragon.min.js to your site.
An ImagingHelper object can be created and attached to an OpenSeadragon.Viewer two ways:
Both methods return a new ImagingHelper object, and both methods also add the ImagingHelper object reference to the viewer as a property called 'imagingHelper'.
// Example 1 - Use the Viewer.activateImagingHelper() method to create an ImagingHelper
// create an OpenSeadragon viewer
var viewer = OpenSeadragon({...});
// add an ImagingHelper to the viewer
var imagingHelper = viewer.activateImagingHelper({...});
// Example 2 - Attach a new ImagingHelper to an existing OpenSeadragon.Viewer
var imagingHelper = new OpenSeadragonImaging.ImagingHelper({viewer: existingviewer});
The ImagingHelper class provides a simplified zoomFactor which is simply the ratio of the displayed image pixel size to the image's native pixel size.
In OpenSeadragon 2.0 and above, conversion is based on the image at index 0 in world.getItemAt, unless another value is set by the worldIndex option.
The ImagingHelper methods use three coordinate systems, named as follows:
Methods are provided to zoom and/or pan using these conventions, as well as to convert individual horizontal/vertical values or point ({x,y}) objects between coordinate systems (Note: methods that return a point object return new OpenSeadragon.Point objects)
The ImagingHelper class extends the OpenSeadragon.EventSource class and raises an event named 'image-view-changed' whenever the viewer's zoom and/or pan position changes.
// Event Example 1 - Use the options 'onImageViewChanged' property to set a handler
var viewer = OpenSeadragon({...});
var imagingHelper = viewer.activateImagingHelper({onImageViewChanged: onImageViewChanged});
function onImageViewChanged(event) {
// event.viewportWidth == width of viewer viewport in logical coordinates relative to image native size
// event.viewportHeight == height of viewer viewport in logical coordinates relative to image native size
// event.viewportOrigin == OpenSeadragon.Point, top-left of the viewer viewport in logical coordinates relative to image
// event.viewportCenter == OpenSeadragon.Point, center of the viewer viewport in logical coordinates relative to image
// event.zoomFactor == current zoom factor
...
}
// Event Example 2 - Add a handler to an existing ImagingHelper
imagingHelper.addHandler('image-view-changed', function (event) {
// event.viewportWidth == width of viewer viewport in logical coordinates relative to image native size
// event.viewportHeight == height of viewer viewport in logical coordinates relative to image native size
// event.viewportOrigin == OpenSeadragon.Point, top-left of the viewer viewport in logical coordinates relative to image
// event.viewportCenter == OpenSeadragon.Point, center of the viewer viewport in logical coordinates relative to image
// event.zoomFactor == current zoom factor
...
});
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.
Additionally, there's an example of syncing an SVG overlay for annotation support.
All the sample code is in demo/scripts/viewmodel.js.
FAQs
OpenSeadragon plugin which adds helper properties/methods for imaging applications.
The npm package @openseadragon-imaging/openseadragon-imaginghelper receives a total of 56 weekly downloads. As such, @openseadragon-imaging/openseadragon-imaginghelper popularity was classified as not popular.
We found that @openseadragon-imaging/openseadragon-imaginghelper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.