True if there is a state to undo / redo.
All completed drawings plus the in-progress one (if any).
The currently-selected drawing instance, or null.
Id of the currently-selected drawing, or null.
Feed an anchor into the active drawing. Finalizes if complete.
Abort the in-progress drawing without finalizing it.
Remove every completed drawing. Does not touch the active slot.
Return the topmost drawing whose rendered geometry is within
tolerance pixels of the screen point (x, y), or null. Iterates in
reverse paint order so the visually-frontmost drawing wins.
Highest revealed index (replay cap). Drawings fully past it are skipped.
Re-apply the last undone mutation. Returns true if applied.
Remove a drawing by id. Returns true if found.
Remove the selected drawing, if any. Returns true if one was removed.
Render all completed drawings plus the in-progress one.
Highest revealed index (replay cap). Drawings fully past it are hidden.
Select a drawing by id, or clear the selection with null.
Hit-test at (x, y) and select the topmost drawing found (or clear the selection when nothing is hit). Returns the newly-selected drawing.
Highest revealed index (replay cap). A drawing fully past it can't be selected — otherwise its handles would redraw the hidden future anchors.
Shift every anchor's buffer index by delta. Called after the buffer
evicts old candles (eviction lowers every remaining candle's logical
index) so drawings stay pinned to the same candles. Affects completed
drawings and the in-progress one; undo history is not rewritten.
Begin a new drawing. The drawing is immediately in the active slot
but not yet in drawings. The next addPoint call pushes the
first anchor; when the drawing becomes complete it is moved to
drawings and active is cleared.
Serialize all completed drawings to a JSON-safe array.
Revert the last mutation (add / remove / clear). Returns true if applied.
Update the last anchor of the active drawing — used during "rubber band" preview between clicks while a multi-point drawing is still in progress.
StaticfromRestore drawings from a snapshot array. Unknown kinds are silently
skipped — consumers should register custom kinds before calling
fromSnapshot if they rely on them.
StaticregisterRegister a new subclass so fromSnapshot can hydrate it.
Ordered collection of drawings with a single "active" slot for creation in progress. Consumers drive creation via
startDrawing,addPoint, and an implicit finalize when the drawing hits its required point count.The layer is render-only with respect to the chart — it doesn't listen to DOM events. Input handling lives in the consumer so the core stays framework-agnostic.