AbstractProtectedcursorCSS classes toggled by setCursorStyle to reflect the current tool on the mounting
root element. Default 2-state (draw/erase) set; override alongside getCursorClass
for variants with additional tools.
AbstracttoolOptionaloptions: {AbstractclearProtectedclearForce label fully inactive regardless of how many startOperation calls are pending.
For level-triggered signals with a single external "done" event (e.g. the client's
idle event) rather than one end call per start call.
ProtectedclearClears the rootElement.iink back-reference set in the constructor, guarded so it only
clears the reference if it's still pointing at this instance — a newer canvas mounted on
the same element (e.g. Canvas.load() replacing an instance) must not have its own
reference clobbered by this (older) instance's destroy() running after the fact.
Every destroy() implementation must call this, or the mounting DOM element keeps a
strong reference to the entire destroyed canvas graph.
AbstractdestroyMark one occurrence of label as finished. Must be paired with a prior startOperation.
ProtectedgetThe single class from cursorClasses that should be active for the current tool.
Whether label is currently active (at least one unmatched startOperation call).
AbstractinitializeProtectedmanageOnly relevant for WebSocket-backed canvas; other variants never call this.
ProtectedmanageThe client's idle event only fires in response to an explicit
client.waitForIdle() call (a request/response pair, not a push notification) — it does
NOT fire automatically after every addStrokes()/transform/etc. So it cannot be used to end
a "Recognizing" operation reliably. This only preserves the public event.emitIdle passthrough
for consumers who call waitForIdle() themselves.
ProtectedmarkCalled once the canvas has connected to its backend for the first time.
AbstractresizeOptionaldims: { height?: number; width?: number }ProtectedresolveResolves the target height/width for resize(): an explicit value wins, otherwise falls
back to the mounting root element's computed size, clamped to minDimensions.
Optionalheight: numberOptionalwidth: numberProtectedsetMark label as active. Prefer trackOperation unless the operation isn't promise-shaped.
ProtectedstartProtectedstopProtectedteardownCommon teardown shared by every variant's destroy(): stops the resize observer, removes
all event listeners, and destroys the DOM layers and the renderer. Each variant calls this
in addition to its own teardown (input-handler detach, client/menu/model/history cleanup,
etc.) and must still call clearRootElementReference itself afterwards.
Run fn, marking label as an active operation for the duration (shown on the canvas
state badge tooltip). Safe against overlapping/concurrent calls with the same or different
labels, and against fn throwing (the operation is always ended).
Event bus for subscribing to canvas lifecycle and content events.
OptionalinfoServer API information (version, etc.) loaded on first connection.
DOM layer manager handling rendering, UI, and modal elements.
Logger instance for this canvas.
AbstractrendererThe variant's rendering backend, declared here only so teardownCommon can tear it down generically.
Derived, UI-oriented canvas state — see TCanvasConnectionState. Listen to
event.addConnectionStateChangedListenerfor change notifications.