Global canvas Matrix applied when drawing (useful for zoom integration)
The effective display scale computed each frame in onDraw (canvasScale × matrix scale). Used by drawShapeSelectionOverlay to keep handle sizes constant on screen.
Global canvas scale factor applied when drawing (useful for zoom integration). Touch coordinates are inverse-transformed automatically.
Global canvas X translation applied when drawing (useful for pan integration)
Global canvas Y translation applied when drawing (useful for pan integration)
Current fill colour
Handle size for selection overlay in dp
Handle hit-test radius in dp
ReadonlylayersAll drawable layers, bottom-to-top order (ObservableArray for data-binding)
Maximum number of undo snapshots to retain (default: 50)
Minimum dimension when resizing a shape in dp
Global opacity for newly created shapes (0-1)
Simplification options for pen strokes
Current stroke colour
Current stroke width in dp
Whether redo is available
Whether undo is available
Get the current active mode name
Open the shared TextField over the given TextShape so the user can type.
If the same shape is already being edited, the TextField is just repositioned
(no keyboard flicker). Pass touchPoint (in canvas coords) to position the
text cursor at the tap location; omit to leave the cursor where the platform puts it.
OptionaltouchPoint: { x: number; y: number }Called by drawing modes to commit a finished shape to the layers
Draw the selection overlay for the given shape.
Override this method to customise the selection overlay appearance across all shapes,
or let individual shapes override their own drawSelectionOverlay() for per-shape customisation.
Commit the TextField content to the shape and hide the TextField. An undo snapshot is pushed only if the text actually changed.
TODO: work in progress , just for testing. Export the current canvas layers as an off-screen bitmap.
width of the output image in dp (defaults to the DrawingCanvas width)
height of the output image in dp (defaults to the DrawingCanvas height)
OptionalbackgroundImageSource: ImageSourceImageSource containing the rendered bitmap, or null on error
Export all layers as a compact JSON string
Import layers from a JSON string, replacing current layers
Move a shape to a specific index in the layer stack
Take a snapshot of the current layers and push to undo stack
Register a custom shape factory for a given type string
Programmatically select a shape: switches to 'select' mode and marks the shape as selected. Fires a 'selectionChange' event.
Switch to a built-in or registered mode
Change the stroke colour of a specific shape (or all selected shapes)
Re-position the shared TextField to match the currently edited TextShape's screen bounds. Called from SelectMode during resize/move so the TextField follows the shape live.
DrawingCanvas – a CanvasView-based view that provides interactive drawing with multiple modes, layers, undo/redo, selection & transform, and JSON serialization.