Types

Link copied to clipboard
data class AddElement(val element: Element) : Intent

Add a new element to the canvas

Link copied to clipboard
data object BeginErase : Intent

Open an erase session. Resets State.erasingSessionDirty so the next EraseAt that actually removes an element will snapshot history once. A session that never lands on an element snapshots nothing — taps and drags through empty space consume no undo slot.

Link copied to clipboard
data object BeginTransform : Intent

Push the current elements onto the undo history. Use at the start of a gesture that mutates the selection across many tiny updates (drag move, resize, rotate) so a single undo reverts the whole gesture.

Link copied to clipboard

Move selected elements to the top of the z-order. Snapshots history.

Link copied to clipboard
data object ClearSelection : Intent

Clear the current selection.

Link copied to clipboard
data class CommitMarquee(val rect: Rect) : Intent

Finalize a marquee selection: select every element whose bounding box intersects rect. Also clears State.marqueeRect.

Link copied to clipboard
data class DeleteElement(val elementId: String) : Intent

Delete an element from the canvas

Link copied to clipboard
data object DeleteSelected : Intent

Delete every element in State.selectedIds.

Link copied to clipboard
data object EndErase : Intent

Close an erase session. Clears State.erasingSessionDirty so the next session starts fresh. Also serves as a transaction-end signal for sync / autosave observers (see EndTransform).

Link copied to clipboard
data object EndTransform : Intent

Marks the end of a drag-driven mutation. State is already up to date by this point; the reducer treats this as a no-op. Provided as a hint for transaction-aware observers (sync layers, autosave debouncers, analytics): a coherent gesture just ended, commit/flush now.

Link copied to clipboard
data class EraseAt(val point: Offset, val radius: Float) : Intent

Delete every element whose body intersects a disk of radius around point (world space). Snapshots history lazily on the first hit within the current erase session (see BeginErase). Subsequent hits inside the same session mutate elements in place without snapshotting, so a single undo reverts the entire sweep. No-op when no element is hit — no snapshot is pushed and no State copy is emitted.

Link copied to clipboard
data class FinalizeArrowBindings(val id: String) : Intent

Recompute connector bindings for an ARROW based on where its endpoints currently sit. Called at drag-end after creating or moving the arrow.

Link copied to clipboard
data class InsertImage(val bytes: ByteArray, val position: Offset, val intrinsicSize: Size) : Intent

Place an Element.Image at position in world space, sized from intrinsicSize so the placed bitmap preserves its source aspect ratio by default. Hosts that want different placement can dispatch SetElementBounds right after.

Link copied to clipboard
data class InsertNewPath(val offset: Offset) : Intent

Start a new freehand path at the specified offset.

Link copied to clipboard
data class InsertNewShape(val shapeType: ShapeType, val offset: Offset) : Intent

Start a new shape at the specified offset.

Link copied to clipboard
data class InsertText(val text: String, val position: Offset, val fontSize: Float, val fontFamilyKey: String, val alignment: TextAlignment, val color: Color) : Intent

Insert an Element.Text at position with the given style. The wrap box is sized from a sensible default width; embedders that want a different layout can dispatch SetElementBounds immediately after. Snapshots history once.

Link copied to clipboard

Load a previously saved drawing from storage

Link copied to clipboard
data class MoveSelected(val delta: Offset) : Intent

Translate every selected element by delta. Does not snapshot history.

Link copied to clipboard
data class PanBy(val delta: Offset) : Intent

Translate the camera by delta screen pixels. Not undoable (session state).

Link copied to clipboard
object Redo : Intent

Redo the last undone action

Link copied to clipboard
data class RequestTextEditAt(val offset: Offset, val tolerance: Float = 8.0f) : Intent

Request in-place text editing at offset (dispatched on a double-tap in Mode.SELECT). Selects the topmost Element.Text under the point within tolerance; when one is hit, the controller emits Event.TextEditRequested. A no-op when the topmost hit is not a text element. Not undoable — selection changes only.

Link copied to clipboard
object Reset : Intent

Clear all elements and reset to empty canvas

Link copied to clipboard
data object ResetCamera : Intent

Reset the viewport to identity (offset = Zero, scale = 1). Not undoable.

Link copied to clipboard
data class SelectAt(val offset: Offset, val tolerance: Float = 8.0f) : Intent

Pick the topmost element at offset and make it the sole selection. If no element is hit, clears selection. Tolerance is in canvas pixels.

Link copied to clipboard

Move selected elements to the bottom of the z-order. Snapshots history.

Link copied to clipboard
data class SetBackgroundPattern(val pattern: BackgroundPattern?) : Intent

Set or clear the repeating background pattern painted above SetBgColor and below all drawing elements.

Link copied to clipboard
data class SetBgColor(val bgColor: Color) : Intent

Change the canvas background color

Link copied to clipboard
data class SetCornerRadius(val radius: Float) : Intent

Default corner radius applied to new RECTANGLE / TRIANGLE shapes. Has no effect on shapes that ignore it (circle, line, arrow) and on shapes already on the canvas.

Link copied to clipboard
data class SetElementBounds(val id: String, val bounds: Rect) : Intent

Set the absolute bounding box of a single element. Used during resize. Does not snapshot history (caller should dispatch BeginTransform first).

Link copied to clipboard
data class SetElementPoints(val id: String, val points: List<Offset>) : Intent

Replace the points list of a single element. Used when dragging the endpoint of a LINE/ARROW. Does not snapshot history.

Link copied to clipboard
data class SetElementRotation(val id: String, val rotationDegrees: Float) : Intent

Set the absolute rotation in degrees of a single element. Used during rotate. Does not snapshot history.

Link copied to clipboard
data class SetEraserSize(val size: Float) : Intent

Change the world-space eraser radius used by Mode.ERASER.

Link copied to clipboard
data class SetFillColor(val color: Color?) : Intent

Default fill color for new Element.Shapes. null clears the fill so new shapes render stroke-only. Has no effect on shapes already on the canvas; use SetSelectedFillColor to retro-edit those.

Link copied to clipboard
data class SetFontFamily(val fontFamilyKey: String) : Intent

Default font family key for future text inserts. Not history-tracked.

Link copied to clipboard
data class SetFontSize(val size: Float) : Intent

Default font size for future text inserts. Mirrors SetStrokeWidth for shapes: mutates the State default without touching any existing element. Not history-tracked — the default is session-level UI state.

Link copied to clipboard
data class SetLineBend(val id: String, val bend: Offset) : Intent

Update the curve deflection of a LINE/ARROW. Does not snapshot history.

Link copied to clipboard
data class SetMarqueeRect(val rect: Rect?) : Intent

Replace the current marquee rectangle (or clear with null). Not undoable.

Link copied to clipboard
data class SetMode(val mode: Mode) : Intent

Switch to a different drawing mode.

Link copied to clipboard
data class SetOpacity(val opacity: Float) : Intent

Change the opacity/alpha for new drawings (0.0 to 1.0)

Link copied to clipboard
data class SetSelectedCornerRadius(val radius: Float) : Intent

Set the corner radius of every selected RECTANGLE / TRIANGLE shape. Snapshots history. Other shape types in the selection are left alone.

Link copied to clipboard
data class SetSelectedFillColor(val color: Color?) : Intent

Replace the fill color of every selected Element.Shape. Pass null to clear the fill so the shape renders stroke-only. Paths and images in the selection are left untouched. Snapshots history.

Link copied to clipboard
data class SetSelectedFontFamily(val fontFamilyKey: String) : Intent

Replace font family key on every selected text element. Snapshots history.

Link copied to clipboard
data class SetSelectedFontSize(val size: Float) : Intent

Replace font size on every selected text element. Snapshots history.

Link copied to clipboard
data class SetSelectedStrokeColor(val color: Color) : Intent

Replace the stroke color of every selected element. Snapshots history.

Link copied to clipboard
data class SetSelectedStrokeEnabled(val enabled: Boolean) : Intent

Toggle the stroke pass on every selected Element.Shape. false makes the shape fill-only; true restores the outline. Paths and images (always stroked) are left untouched. Snapshots history.

Link copied to clipboard
data class SetSelectedStrokeStyle(val style: StrokeStyle) : Intent

Set the stroke pattern of every selected Element.Shape. Snapshots history. Freehand paths in the selection are left alone.

Link copied to clipboard
data class SetSelectedStrokeWidth(val width: Float) : Intent

Replace the stroke width of every selected element. Snapshots history.

Link copied to clipboard
data class SetSelectedTextAlignment(val alignment: TextAlignment) : Intent

Replace text alignment on every selected text element. Snapshots history.

Link copied to clipboard
data class SetStrokeColor(val color: Color) : Intent

Change the stroke color for new drawings

Link copied to clipboard
data class SetStrokeEnabled(val enabled: Boolean) : Intent

Default outline pass for new Element.Shapes. When false, new shapes render fill-only. Has no effect on shapes already on the canvas; use SetSelectedStrokeEnabled to retro-edit those.

Link copied to clipboard
data class SetStrokeStyle(val style: StrokeStyle) : Intent

Default stroke pattern applied to new shapes. Has no effect on existing shapes on the canvas; use SetSelectedStrokeStyle to retro-edit those.

Link copied to clipboard
data class SetStrokeWidth(val width: Float) : Intent

Change the stroke width for new drawings

Link copied to clipboard
data class SetTempPan(val active: Boolean) : Intent

Toggle the transient pan-while-held flag (e.g. for space bar). Not undoable.

Link copied to clipboard
data class SetTextAlignment(val alignment: TextAlignment) : Intent

Default text alignment for future text inserts. Not history-tracked.

Link copied to clipboard
data class SyncTextMeasuredHeight(val id: String, val height: Float) : Intent

Renderer-driven height reconciliation for a single text element.

Link copied to clipboard
object Undo : Intent

Undo the last drawing action

Link copied to clipboard
data class UpdateElement(val element: Element) : Intent

Update an existing element in place

Link copied to clipboard
data class UpdateLatestPath(val newPoint: Offset, val pressure: Float = 1.0f) : Intent

Add a new point to the current path being drawn.

Link copied to clipboard
data class UpdateLatestShape(val newPoint: Offset) : Intent

Update the current shape's dimensions by providing the end point.

Link copied to clipboard
data class UpdateText(val id: String, val text: String) : Intent

Replace the text content of an existing Element.Text. Snapshots history so a typing session can be undone as a single revision when the embedder commits with a single dispatch (typical for modal editors); embedders implementing inline editing should batch their own undo boundaries.

Link copied to clipboard
data class ZoomBy(val factor: Float, val focalScreen: Offset) : Intent

Multiplicatively zoom the camera by factor anchored at focalScreen (a point in screen pixels that stays put). Not undoable.

Link copied to clipboard
data class ZoomTo(val targetScale: Float, val focalScreen: Offset) : Intent

Set absolute scale to targetScale anchored at focalScreen. Not undoable.