Skip to main content

Class: OpenSeadragonController

Defined in: controllers/OpenSeadragonController.ts:20

Controller for managing an OpenSeadragon viewer and its tiled images

Handles the lifecycle of tiled images (creation, update, removal) for Image and Labels data objects, including transform computation, opacity, and viewer animation options.

Constructors

Constructor

new OpenSeadragonController(viewerElement, viewerInit?): OpenSeadragonController

Defined in: controllers/OpenSeadragonController.ts:37

Parameters

viewerElement

HTMLElement

DOM element in which the OpenSeadragon viewer is created

viewerInit?

(viewer) => void

Optional callback invoked with the viewer immediately after creation

Returns

OpenSeadragonController

Methods

configureAnimationHandlers()

configureAnimationHandlers(viewerAnimationStartOptions, viewerAnimationFinishOptions): void

Defined in: controllers/OpenSeadragonController.ts:113

Installs OpenSeadragon animation-start and animation-finish handlers

On animation start, the specified start options are applied and the previous values are saved. On animation finish, the saved values are restored and then merged with the finish options.

Calling this method again replaces any previously installed handlers.

Parameters

viewerAnimationStartOptions

ViewerOptions

Options to apply when an animation starts

viewerAnimationFinishOptions

ViewerOptions

Options to apply when an animation finishes

Returns

void


destroy()

destroy(): void

Defined in: controllers/OpenSeadragonController.ts:226

Destroys the OpenSeadragon viewer and releases all tiled image state

Returns

void


setViewerOptions()

setViewerOptions(viewerOptions): void

Defined in: controllers/OpenSeadragonController.ts:66

Applies viewer options to the OpenSeadragon viewer and all existing tiled images

For each option key, performs a shallow merge (one level deep) of nested objects on both the viewer instance and every tiled image in the world.

Parameters

viewerOptions

ViewerOptions

Options to apply

Returns

void


synchronize()

synchronize(layers, images, labels, loadImage, loadLabels, options?): Promise<void>

Defined in: controllers/OpenSeadragonController.ts:193

Synchronizes the viewer's tiled images with the current model state

Loads all images and labels that are assigned to the given layers, removes tiled images that are no longer needed, and creates or updates the remaining ones.

Parameters

layers

Layer[]

Layers to render

images

Image[]

Image data objects to display

labels

Labels[]

Labels data objects to display

loadImage

(imageId, options?) => Promise<ImageData>

Async loader for image data

loadLabels

(labelsId, options?) => Promise<LabelsData>

Async loader for labels data

options?

Optional abort signal

signal?

AbortSignal

Returns

Promise<void>