Skip to content

FabricOverlay

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:40

A Fabric.js canvas overlay synchronized with an OpenSeaDragon viewer.

Handles event routing between OSD and Fabric using an OSD MouseTracker attached to Fabric’s container element. Events are forwarded to Fabric as synthetic PointerEvents with a re-entrancy guard to prevent infinite recursion (dispatched events bubble back to the tracker’s element).

Two interaction modes:

  • navigation: OSD handles all input, Fabric is display-only.
  • annotation: Fabric handles all input (select, move, draw). Ctrl+drag or Command+drag pans OSD within annotation mode.

new FabricOverlay(viewer, options?): FabricOverlay

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:65

Viewer

OverlayOptions

FabricOverlay

get canvas(): Canvas

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:67

The Fabric.js Canvas instance

Canvas

applyImageFilters(exposure, inverted): void

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:72

number

boolean

void


applyViewTransform(transform): void

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:69

Apply a view transform (rotation/flip) to the OpenSeadragon viewer

CellTransform

void


destroy(): void

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:92

Clean up all event listeners and DOM elements

void


getFlip(): boolean

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:71

boolean


getMode(): OverlayMode

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:86

Get the current overlay interaction mode

OverlayMode


getRotation(): number

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:70

number


imageToScreen(imagePoint): Point

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:90

Convert a point from image-space to screen-space

Point

Point


resetView(): void

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:73

void


screenToImage(screenPoint): Point

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:88

Convert a point from screen-space to image-space

Point

Point


setMode(mode): void

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:84

Set the overlay interaction mode

OverlayMode

void


sync(): void

Defined in: packages/fabric-osd/dist/overlay/fabric-overlay.d.ts:82

Force a re-sync of the overlay transform with the current OSD viewport.

Uses synchronous renderAll() because this runs inside OSD’s own requestAnimationFrame callback. Using the async requestRenderAll() would defer the Fabric paint to the next frame, causing a visible 1-frame lag where the image has moved but annotations haven’t.

void