Mode

sealed class Mode

Represents the current drawing mode, determining what type of element is created when the user interacts with the canvas.

Each mode maps to a specific Element type and rendering behavior:

The mode is read from State.mode and passed to DrawBox, which uses it to determine how to interpret user gestures.

Inheritors

Types

Link copied to clipboard
data object ARROW : Mode

Arrow shape mode with intelligent head sizing

Link copied to clipboard
data object CIRCLE : Mode

Circle shape mode

Link copied to clipboard
data object ERASER : Mode

Object eraser — tap or drag to delete any element whose body intersects the eraser radius. Whole-element (not pixel-level): a single hit removes the entire stroke or shape. Undoable as one gesture.

Link copied to clipboard
data object LINE : Mode

Line shape mode

Link copied to clipboard
data object PAN : Mode

Pan mode - drag pans the camera; useful for navigating the infinite canvas

Link copied to clipboard
data object PEN : Mode

Freehand drawing mode - creates continuous paths from user input

Link copied to clipboard
data object RECTANGLE : Mode

Rectangle shape mode

Link copied to clipboard
data object SELECT : Mode

Selection mode - tap / drag to select, move, resize, rotate existing elements

Link copied to clipboard
data object TEXT : Mode

Plain-text mode — tap on the canvas inserts an empty Element.Text at the tap position. The sample app opens a modal text field to gather the actual content; embedders can mirror that pattern or provide an inline editor (out of scope for OSS v1).

Link copied to clipboard
data object TRIANGLE : Mode

Triangle shape mode

Functions

Link copied to clipboard

Whether mode participates in State.toolMemory save/restore on Intent.SetMode.