Skip to main content

Crate litz_editor

Crate litz_editor 

Source
Expand description

The editing model behind any Litz frontend.

This crate owns the document — parts, wires and the undo history — and knows nothing about pixels, DOM or a particular UI toolkit. A browser canvas, a native window and a test can all drive the same operations.

Every mutation goes through Editor::transact: the new circuit is built off to the side, validated, and only then committed. A refused edit leaves the document and its history untouched, which is what an undo stack needs to stay honest.

Geometry is presentation only. route_wire produces an orthogonal path for drawing; nothing here feeds a simulation.

Structs§

Editor
One editable circuit plus its undo and redo history.
Point
A point on the canvas.

Enums§

EditError
Why an edit was refused.

Constants§

GRID
The grid a wire and a part snap to, in canvas units.

Functions§

route_wire
An orthogonal path from from to to, snapped to the grid.
snap
Snap a coordinate to the nearest grid intersection.