Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@openseadragon-imaging/openseadragon-viewerinputhook
Advanced tools
OpenSeadragon plugin which provides hooks into the viewer input event pipeline.
OpenSeadragonViewerInputHook is a plugin for OpenSeadragon 1.0.0+ which provides hooks into the user input event pipeline for providing additional behavior and/or overriding the default behavior.
Prerequisite note: OpenSeadragonViewerInputHook requires OpenSeadragon version 2.0+.
The OpenSeadragonViewerInputHook bundle can be obtained the following ways:
npm install @openseadragon-imaging/openseadragon-viewerinputhook
The OpenSeadragonViewerInputHook bundle can be included using a script tag in HTML or imported as a library module (ES2015, CommonJS, AMD).
A ViewerInputHook object can be created and attached (if desired) to an OpenSeadragon.Viewer two ways:
Both methods return a new ViewerInputHook object, and both methods take an options parameter where the event handlers to be hooked may be specified (see the 'Details' section below).
Example using an HTML script tag
<script
type="text/javascript"
src="path_to/openseadragon/openseadragon.js"
></script>
<script
type="text/javascript"
src="path_to/openseadragon-imaging/openseadragon-viewerinputhook.js"
></script>
// Example 1 - Use the Viewer.addViewerInputHook() method to create a ViewerInputHook
// create an OpenSeadragon viewer
var viewer = window.OpenSeadragon({...});
// add a ViewerInputHook to the viewer
var viewerInputHook = viewer.addViewerInputHook({ hooks: [...] });
// Example 2 - Attach a new ViewerInputHook to an existing OpenSeadragon.Viewer
var viewerInputHook = new window.OpenSeadragonImaging.ViewerInputHook({ viewer: existingviewer, hooks: [...] });
Example importing as a module
npm install openseadragon --save
npm install @openseadragon-imaging/openseadragon-viewerinputhook --save
import OpenSeadragon from 'openseadragon';
import OpenSeadragonViewerInputHook from '@openseadragon-imaging/openseadragon-viewerinputhook';
// Example 1 - Use the Viewer.addViewerInputHook() method to create a ViewerInputHook
// create an OpenSeadragon viewer
var viewer = OpenSeadragon({...});
// add a ViewerInputHook to the viewer
var viewerInputHook = viewer.addViewerInputHook({ hooks: [...] });
// Example 2 - Attach a new ViewerInputHook to an existing OpenSeadragon.Viewer
var viewerInputHook = new OpenSeadragonViewerInputHook({ viewer: existingviewer, hooks: [...] });
Event handler callbacks are specified in the hooks property (array) of the options object passed when creating a ViewerInputHook object (see example code below). Any number of hooks can be specified.
Each hook specification in the array should have three properties - tracker, handler, and hookHandler.
The tracker property of each hook definition can be a reference to any OpenSeadragon.MouseTracker instance, or one of the pre-defined OpenSeadragon viewer trackers - currently 'viewer' or 'viewer_outer'.
The handler property of each hook definition specifies which MouseTracker handler to hook. Valid values are:
The hookHandler property of each hook definition should be the user-defined event handler callback. All event handler callbacks have the following signature:
handlerFunc(event)
The ViewerInputHook class inserts your event hook handler methods in front of any existing event handler methods so the attached handler will be called first. Additional ViewerInputHook objects can be added on the same viewer/MouseTracker to create a chain of hook methods, where the last added handler(s) will be called first. Note: If multiple ViewerInputHook are attached to the same viewer/MouseTracker, destroy() should be called for each ViewerInputHook in reverse order of attachment!
Your hook event handler methods can control the event handling behavior in one or more of the following ways:
// Example
var viewer = OpenSeadragon({...});
viewer.addViewerInputHook({hooks: [
{tracker: 'viewer', handler: 'scrollHandler', hookHandler: onViewerScroll},
{tracker: 'viewer', handler: 'clickHandler', hookHandler: onViewerClick}
]});
function onViewerScroll(event) {
// Disable mousewheel zoom on the viewer and let the original mousewheel events bubble
if (!event.isTouchEvent) {
event.preventDefaultAction = true;
return true;
}
}
function onViewerClick(event) {
// Disable click zoom on the viewer using event.preventDefaultAction
event.preventDefaultAction = true;
event.stopBubbling = true;
}
The demo site uses OpenSeadragonViewerInputHook to monitor cursor position and provide custom click and mousewheel event actions.
The source code can be found here.
2.2.1:
FAQs
OpenSeadragon plugin which provides hooks into the viewer input event pipeline.
The npm package @openseadragon-imaging/openseadragon-viewerinputhook receives a total of 481 weekly downloads. As such, @openseadragon-imaging/openseadragon-viewerinputhook popularity was classified as not popular.
We found that @openseadragon-imaging/openseadragon-viewerinputhook 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.