Skip to main content

Class: SharedCanvasState

Stores common state and settings for multiple canvases.

Properties

PropertyModifierTypeDescription

defaultElementTemplate

readonly

ElementTemplate

Default element template to use as a fallback.

defaultLayout

readonly

LayoutFunction

Default layout algorithm function to use if it's not specified explicitly.

defaultLinkTemplate

readonly

LinkTemplate

Default link template to use as a fallback.

events

readonly

Events<SharedCanvasStateEvents>

Event for the shared canvas state.

renameLinkProvider

readonly

undefined | RenameLinkProvider

A strategy to rename diagram links (change labels).

Accessors

highlighter

get highlighter(): undefined | CellHighlighter

Returns active highlight for the diagram cells.

Experimental: this feature will likely change in the future.

Returns

undefined | CellHighlighter

Defined in

diagram/sharedCanvasState.ts:214


widgets

get widgets(): ReadonlyMap<string, CanvasWidgetDescription>

Live collection of canvas widgets rendered on each canvas.

Returns

ReadonlyMap<string, CanvasWidgetDescription>

Defined in

diagram/sharedCanvasState.ts:154

Methods

findAllCanvases()

findAllCanvases(): CanvasApi[]

Returns all canvases that use this shared state.

Returns

CanvasApi[]

Defined in

diagram/sharedCanvasState.ts:137


findAnyCanvas()

findAnyCanvas(): undefined | CanvasApi

Returns any canvas that uses this shared state or undefined if none found.

Returns

undefined | CanvasApi

Defined in

diagram/sharedCanvasState.ts:146


setCanvasWidget()

setCanvasWidget(key, widget): void

Adds, changes or removes a canvas widget from being rendered on the canvases.

Parameters

ParameterTypeDescription

key

string

unique key for a widget

widget

null | CanvasWidgetDescription

widget description with a target widget layer to render on or null to remove the widget

Returns

void

Defined in

diagram/sharedCanvasState.ts:165


setHandlerForNextDropOnPaper()

setHandlerForNextDropOnPaper(handler): void

Sets the handler for the next drop event from drag-and-drop operation on a canvas.

Experimental: this feature will likely change in the future.

Parameters

ParameterType

handler

undefined | (e) => void

Returns

void

Defined in

diagram/sharedCanvasState.ts:186


setHighlighter()

setHighlighter(value): void

Sets or removes an active highlight for the diagram cells.

Experimental: this feature will likely change in the future.

Parameters

ParameterType

value

undefined | CellHighlighter

Returns

void

Defined in

diagram/sharedCanvasState.ts:220


tryHandleDropOnPaper()

tryHandleDropOnPaper(e): boolean

Tries to run previously set drop handler on a canvas, then removes the handler if it was set.

Experimental: this feature will likely change in the future.

Parameters

ParameterType

e

CanvasDropEvent

Returns

boolean

true if a handler was set, otherwise false

Defined in

diagram/sharedCanvasState.ts:198