Reducer

class Reducer(useCase: UseCase)

Pure state reducer implementing the MVI pattern.

(State, Intent) → State. No side effects, no mutation of the input state.

Undo model: snapshot-based. Each intent that mutates elements in a way the user would expect to undo (insert, delete, recolor, z-order, transform-commit) pushes the previous element list onto history and clears future. The per-pixel update intents (UpdateLatestPath, UpdateLatestShape, MoveSelected, SetElementBounds, SetElementRotation) do NOT push to history — the caller is expected to dispatch Intent.BeginTransform once at the start of the gesture.

Constructors

Link copied to clipboard
constructor(useCase: UseCase)

Functions

Link copied to clipboard
fun hitTopmost(elements: List<Element>, point: Offset, tolerance: Float): Element?

Topmost element hit at point within tolerance, or null. Exposes the pick used by reduce so the controller can resolve edit targets for Event.TextEditRequested without duplicating hit-test logic.

Link copied to clipboard
fun reduce(state: State, intent: Intent): State