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

(async) createImagePreview(bgSpec, width, height) → {Promise.<(Image|HTMLImageElement)>}

Create Image Object for a desired background. This method must be used to generate the image previews shown in menus - otherwise they are not accurate.
Parameters:
Name Type Default Description
bgSpec BackgroundItem | StandaloneBackgroundItem bg config
width 250
height 250
Source:
Returns:
Type
Promise.<(Image|HTMLImageElement)>

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:
Link the viewer to context-sharing navigation link: all viewers of the same context will follow the same navigation path.
Parameters:
Name Type Default Description
context any 0 sync context - in which sync session you operate
mapper function custom sync logics instead of the default one, usually you want to call applyViewportState(...) method with your computed viewport state values
Source:
Create thumbnail screenshot TODO FIX THIS - VIEWER REFERENCE is too BIG to capture a thumbnail - we should download manually just a proportion of the image, right now we force the whole tiled image load, which depends on the screen size and is not optimal (especially if navigator is not defined)
Parameters:
Name Type Attributes Default Description
config BackgroundItem | StandaloneBackgroundItem bg config
size OpenSeadragon.Point the output size
timeout number 30000
size.preserveAspectRatio boolean <optional>
true
Source:
Returns:
Type
Promise.<CanvasRenderingContext2D>

(async) retrieveLabel(config) → {Promise.<Image>}

Retrieve label
Parameters:
Name Type Description
config BackgroundItem | StandaloneBackgroundItem bg config
Source:
Returns:
Type
Promise.<Image>

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 OpenSeadragon.Point | object the output size
focus OpenSeadragon.Rect | object | undefined <optional>
screenshot focus area (screen coordinates), by default thw whole viewport
Source:
Returns:
Type
CanvasRenderingContext2D | Image
Unlink the viewer from context-sharing navigation link.
Parameters:
Name Type Default Description
context 0
Source:
Destroy the context-sharing navigation link for all viewers.
Parameters:
Name Type Default Description
context 0
Source:
Link the viewer to context-sharing navigation link: all viewers of the same context will follow the same navigation path.
Parameters:
Name Type Default Description
self OpenSeadragon.Viewer
context any 0 sync context - in which sync session you operate
mapper function custom sync logics instead of the default one
Source:
Unlink the viewer from context-sharing navigation link.
Parameters:
Name Type Default Description
self OpenSeadragon.Viewer
context 0
Source: