Active canvas configuration (recognition, rendering, menu, math, etc.).
Derived, UI-oriented canvas state — see TCanvasConnectionState.
Listen to event.addConnectionStateChangedListener for change notifications.
ProtectedcursorCSS 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.
Promise that resolves when the WebSocket session is fully initialized. Await this before calling any recognition methods.
True while the connection is down after a first one succeeded, changes queued or not.
Listen to event.addConnectionStatusChangedListener for change notifications.
Current symbol model containing all ink, text, math, and shape symbols.
Current pen style applied to new strokes. Setting this merges the provided partial style with the current style.
Whether real pointer input (write/erase/select/move) is currently blocked - see readOnly setter.
Block or restore real pointer input across every tool at once (write/erase/select/move all
attach through layers.rendering), and reflect it with a "not-allowed" cursor. Used e.g. by
canvas.playback so a replayed stroke can't race the user's own input.
Apply a partial rendering configuration at runtime. Triggers a resize and guide-row recompute.
Partial rendering config to merge
Active editing tool.
Setting this switches cursor style, attaches/detaches the corresponding manager,
clears selection, and emits a toolChanged event.
Create and attach an InteractiveInk canvas to the given DOM element.
Use Canvas.load() instead of calling this constructor directly.
Host DOM element that will contain the canvas layers
Optionaloptions: TInteractiveInkCanvasOptions
Canvas options: configuration, CSS vars, manager overrides
ProtectedbuildBuild a symbol from partial data
Partial symbol data
Complete symbol instance
Change the order of a symbol in the rendering stack
Symbol to reorder
New position (first, last, forward, backward)
Change the order of multiple symbols in the rendering stack
Symbols to reorder
New position (first, last, forward, backward)
Clear all content from the canvas
Promise that resolves when cleared
ProtectedclearForce 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.
Convert specific symbols, or all symbols if none specified
Optionalsymbols: TSymbol[]
Symbols to convert (defaults to all symbols)
Promise that resolves when conversion is complete
Copy selected symbols (or all symbols if nothing selected) to the internal clipboard
Create a symbol from partial data
Partial symbol data
Promise resolving to created symbol
Create multiple symbols from partial data
Array of partial symbol data
Promise resolving to array of created symbols
Cut selected symbols: copy them to clipboard, then remove from model
Destroy the canvas and clean up resources
Promise that resolves when destruction is complete
Export the content and hand the resulting file to the browser.
Format to download; pdf opens the print flow instead of saving a file
Optionaloptions: TPDFDownloadOptions
Which symbols to export, plus the file name. The PDF settings
(format/orientation/mode/scale) are ignored by every other format.
Mark one occurrence of label as finished. Must be paired with a prior startOperation.
Export content to specified MIME types
OptionalmimeTypes: string[]
Array of MIME types to export
Promise resolving with exports
Export the content in the given format.
pdf is not available here — printing produces no in-memory value, use
InteractiveInkCanvas.download instead.
Format to export to; the resolved type follows from it
Optionaloptions: TExportOptions
Which symbols to export (scope, or an explicit symbols list)
Promise resolving with the exported content
ProtectedgetThe single class from cursorClasses that should be active for the current tool.
Get the current viewport zoom level.
Current zoom factor (1.0 = 100 %)
ProtectedhandleWhether label is currently active (at least one unmatched startOperation call).
Import strokes from point events
Array of partial stroke data
OptionalcreationTime?: numberOptionaldecoratorKind?: DecoratorKindOptionalendAnchor?: {OptionalentryPoint?: { x?: number; y?: number }Intersection of the edge with the shape border, in world coordinates.
OptionalnormalizedX?: numberOptionalnormalizedY?: numberOptionalsymbolId?: stringOptionalid?: stringOptionalisSolverOutput?: booleanOptionaljiixBlockId?: stringOptionaljiixBlockType?: "Text" | "Math" | "Node" | "Edge" | "Decorator"OptionalmodificationDate?: numberOptionalpointers?: ({ dt?: number; p?: number; x?: number; y?: number } | undefined)[]OptionalpointerType?: stringOptionalstartAnchor?: {OptionalentryPoint?: { x?: number; y?: number }Intersection of the edge with the shape border, in world coordinates.
OptionalnormalizedX?: numberOptionalnormalizedY?: numberOptionalsymbolId?: stringOptionalstyle?: {Optionaltransform?: { tx?: number; ty?: number; xx?: number; xy?: number; yx?: number; yy?: number }Where this symbol sits, relative to the coordinates it stores.
A transform writes here and nowhere else: the raw coordinates are what the symbol was created with and never move again. That is what lets the renderer apply a change by rewriting one attribute instead of rebuilding the element, and what keeps undo exact — re-applying an inverse matrix restores the value bit for bit, where re-transforming coordinates accumulated rounding.
Optionaltx?: numberOptionalty?: numberOptionalxx?: numberOptionalxy?: numberOptionalyx?: numberOptionalyy?: numberOptionaltype?: StrokePromise resolving to updated model
ProtectedmanageOnly relevant for WebSocket-backed canvas; other variants never call this.
Display an error in the canvas overlay and emit an error event.
Error to display and emit
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.
ProtectedonProtectedonWith ignoreGestureStrokes the backend never emits a contentChanged for a gesture stroke,
so the debounced synchronize scheduled by onContentChanged has nothing left to reschedule it -
force one here instead of relying on that mechanism.
Shift the viewport by the given pixel delta without changing zoom.
Horizontal offset in pixels (positive = pan right)
Vertical offset in pixels (positive = pan down)
Paste clipboard symbols at an offset and select them
Remove a symbol from the model
ID of symbol to remove
Whether to add to history (default: true)
Promise that resolves when symbol is removed
Remove multiple symbols from the model
Array of symbol IDs to remove
Whether to add to history (default: true)
Promise that resolves when symbols are removed
Resize the canvas
New height and/or width
Promise that resolves when resize is complete
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: numberSelect symbols by their IDs
Array of symbol IDs to select
Select all symbols
ProtectedsetOn top of the base badge tracking, cancels the pending debounced synchronize() as soon
as a new gesture starts - so a stroke/transform beginning right as the debounce timer would
otherwise fire never races it (it'll be rescheduled once that gesture's own content change
comes in).
ProtectedstartProtectedstopSynchronize strokes with JIIX export
ProtectedteardownCommon 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).
Unselect all currently selected symbols
Update layer UI with debouncing
Debounce timeout in milliseconds (default: 500ms)
Change the recognition configuration (language, math solver…) without destroying the canvas. Opens a new backend session with it and re-sends every user stroke; the canvas is read-only meanwhile. Calls are serialized, and those waiting for a running one are applied together.
Keys to change; an array replaces the current one, undefined clears a key
Update one symbol: updateSymbols([id], patch, addToHistory).
The updated record, or undefined when no symbol has this id
Update symbols by id, each with the same patch.
style is merged into each symbol's style, font is applied to the texts
(any other symbol ignores it);Texts and maths are re-measured, and a text that gets wider or narrower slides the texts after it on its row. The backend hears only of strokes that appeared or disappeared: style is not recognized. Only the symbols named are touched, whatever the size of the document.
Whether to add to history (default: true). Texts slid along are part of the same entry.
The updated records; an id with no symbol is skipped
Wait for the client to become idle
Promise that resolves when idle
Set the viewport zoom level, optionally anchored to a point.
Target zoom factor (e.g. 1.5 = 150 %)
OptionalcenterX: number
X coordinate to zoom around (pixels, default: viewport center)
OptionalcenterY: number
Y coordinate to zoom around (pixels, default: viewport center)
Zoom and pan the view to fit the given symbols (or all symbols) within the viewport. Resets to zoom 1 if there are no symbols.
Optionalsymbols: TSymbol[]
Symbols to fit (default: all model symbols)
WebSocket client handling real-time communication with the MyScript backend.
Manages smart connectors and anchor-based endpoint updates.
Converts ink strokes to recognized text, math, or shape symbols.
ReadonlydomStatic utility class for creating DOM elements.
Handles erasing strokes and symbols via pointer interaction.
Event bus for subscribing to canvas lifecycle and content events.
Static ReadonlyEXPORT_Produces every export format and drives the file downloads.
Detects and processes touch/pointer gestures (scratch-out, join, insert, etc.).
Manages undo/redo history stack for all symbol changes.
OptionalinfoServer API information (version, etc.) loaded on first connection.
Queries and maps JIIX data to local symbols for math/text label resolution.
Handles keyboard shortcuts and hotkey-based tool switching.
DOM layer manager handling rendering, UI, and modal elements.
Where the menus, the connection state and the minimap sit
Logger instance for this canvas.
Manages math recognition: variables, computation, and evaluation rendering.
Manages the floating UI menu (tool selector, style panel, action buttons).
Handles canvas panning when the Move tool is active.
Manages all visual overlays: math/text block indicators, debug visualizations.
Static ReadonlyPASTE_Builds print-only DOM/CSS layers and drives PDF export via native browser print.
Replays a recorded set of strokes with play/pause/speed control.
SVG renderer responsible for drawing symbols onto the canvas layer.
Handles symbol selection, selection group rendering, and hit-testing.
Manages snapping behavior for symbols during move/resize operations.
Synchronizes the local model with the JIIX export from the backend client.
Orchestrates translate, resize, and rotation transforms on selected symbols.
Manages text and math symbol layout: bounds computation and reflow after edits.
Handles ink input: captures pointer events and creates strokes.
Static ReadonlyZOOM_
Apply or replace CSS custom properties on the canvas root element. Clears all existing
--ms-ink-*properties first, then sets the provided vars. Does not reinitialize — current model and session are preserved. Passundefinedto reset to stylesheet defaults.