State
Represents the complete immutable state of the drawing canvas.
All drawing operations produce a new State instance rather than mutating the existing one, following functional programming principles. This ensures:
Clear state history for undo/redo
Predictable state changes
Easy debugging and testing
See also
Constructors
Properties
Optional repeating image tiled above bgColor and below all elements; runtime decoration only and not persisted by JSON/SVG export
Default fill color applied to new Element.Shapes (rect/circle/triangle). null means stroke-only — the shape renders without a fill. Mutated by Intent.SetFillColor; the selection form Intent.SetSelectedFillColor writes to selected elements instead.
Default font family key applied to new text elements. See Intent.SetFontFamily. Always resolves via the host's io.ak1.drawbox.text.FontRegistry at render time, so an unregistered key here falls back to sans without crashing the canvas.
Default font size in world pixels applied to text elements inserted via Mode.TEXT. Mutated by Intent.SetFontSize (the non-selection form); the selection form Intent.SetSelectedFontSize writes to the selected element instead and leaves this default untouched.
Whether the outline pass is drawn on new Element.Shapes. When false, new shapes render fill-only. Mutated by Intent.SetStrokeEnabled; the selection form Intent.SetSelectedStrokeEnabled writes to selected elements instead.
Default horizontal alignment for new text elements; see Intent.SetTextAlignment.
The mode currently driving user input. Equals State.mode unless the user is holding the space bar (or has otherwise activated a temporary pan), in which case it returns Mode.PAN. The original State.mode is preserved so release of the temp-pan modifier restores the previous tool.
World-space radius used by Mode.ERASER for hit-testing. Pressure-aware platforms can modulate this at the gesture layer without persisting the modulated value here.
Within a single erase gesture: has any tick actually removed an element yet? Used to guarantee at most one history snapshot per gesture, taken lazily on the first hit. A tap or drag that never intersects an element therefore consumes no undo slot. Cleared by Intent.BeginErase and Intent.EndErase; not persisted.
Transient rectangle drawn while a marquee selection is in progress. Null when no marquee is active. Not undoable.
IDs of currently selected elements. Drives selection chrome rendering and the targets of move/resize/rotate/delete intents.
Color for drawing lines and shape strokes
Width/thickness of strokes in pixels
Per-tool memory: each drawing mode (PEN, RECTANGLE, CIRCLE, TRIANGLE, ARROW, LINE, TEXT) snapshots its own color / width / style / fill / corner / text settings. On Intent.SetMode the outgoing mode's current top-level fields are captured here, and the incoming mode's saved settings are restored to the top-level fields. Non-drawing modes (SELECT, ERASER, PAN) don't participate — they pass through settings untouched. Users get the "each pen remembers its own color" behavior Samsung Notes / OPPO Notes use.