Class: Tools

Tools

Utilities for the OpenSeadragon Viewer. Available as OpenSeadragon.tools instance (attaches itself on creation). in xOpat: VIEWER.tools.[...]

Constructor

new Tools(context)

Parameters:
Name Type Description
context OpenSeadragon instance
Source:

Methods

focus(params)

Parameters:
Name Type Description
params Object that defines the focus
Properties
Name Type Description
bounds OpenSeadragon.Rect, in viewport coordinates; both elements below must be defined if bounds are undefined
point OpenSeadragon.Point center of focus
zoomLevel Number, zoom level
animationTime | params.duration (optional)
springStiffness | params.transition (optional)
immediately focus immediately if true (optional)
preferSameZoom optional, default: keep the user's viewport as close as possible if false, or keep the same zoom level if true; note this value is ignored if appropriate data not present
Source:

offlineScreenshot(region, targetSize, onfinish, outputSizeopt)

Create region screenshot, the screenshot CAN BE ANYWHERE
Parameters:
Name Type Attributes Default Description
region object region of interest in the image pixel space
Properties
Name Type Description
x number
y number
width number
height number
targetSize object desired size (should have the same AR -aspect ratio- as region), the result tries to find a level on which the region is closest in size to the desired size
Properties
Name Type Description
width number
height number
onfinish function function that is called on screenshot finish, argument is a canvas with resulting image
outputSize object <optional>
targetSize output image size, defaults to target size
Properties
Name Type Description
width number
height number
Source:

(async) raiseAwaitEvent(context, eventName, eventArgs) → {Promise.<void>}

EventSource - compatible event raising with support for async function waiting
Parameters:
Name Type Description
context EventSource instance
eventName name of the event to invoke
eventArgs event args object
Source:
Returns:
promise resolved once event finishes
Type
Promise.<void>

screenshot(toImage, size, focusopt) → {CanvasRenderingContext2D|Image}

Create viewport screenshot
Parameters:
Name Type Attributes Description
toImage boolean true if element should be created, otherwise Context2D
size object the output size
Properties
Name Type Description
width number
height number
focus OpenSeadragon.Rect | object | undefined <optional>
screenshot focus area (screen coordinates), by default thw whole viewport
Source:
Returns:
Type
CanvasRenderingContext2D | Image