Add the canvas engine and a canvas playground example

The canvas draws a frame in three steps. Scene::build works out what's
shown and where: folding decides which nodes show, boxes are sized from
their wrapped titles (with tags and a +N badge in the bottom border), the
camera turns canvas positions into screen cells, and every branch and
cross-link gets a right-angle route. The line layer records which arms
meet in each cell, so borders and lines join with the right box-drawing
character (├ ┼ ┨ ╭), in any mix of light, thick, double, dashed and dotted.
Rendering then writes lines, arrowheads and labels, and the nodes on top.

Branches leave sideways and bend near their parent, so siblings share one
bus; cross-links take the wider gap and carry their label on the longest
level run. Far zoom keeps the full width and halves the height (one line
per node), Overview shows dots. hjkl picks the nearest node within 45° of
the direction, and new nodes find a free spot next to their parent or
sibling. The theme works out looks in layers (default, tag style, named
style, the node's own), with a mid-tone palette for dark and light
terminals, and an ASCII fallback for fonts without box drawing.

`cargo run --example canvas` opens a sample document to move around,
zoom, fold, edit and drag with the mouse. The tests compare rendered text
against the DESIGN.md mockup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
skkeyeandClaude Opus 5.5 committed 2026-10-01 01:17:38 -04:00
1 parent 69aa7eee58
commit 3b58d6494d
23 files changed
+3641 -7

No files matched your search

+5 -3
View File
@@ -66,9 +66,11 @@ lines.
- Folding: each branch is Open, Auto (open while the cursor is inside) or
Closed (a jump inside opens it until you leave). New branches start Open; a
focus toggle makes Open branches act like Auto.
- Zoom levels: Normal (boxes), Far (one line per node, half the spacing),
Overview (colored dots). Body text never shows on the canvas: `K` pops it up,
and the Note view shows all of it.
- Zoom levels: Normal (boxes), Far (one line per node: the same width, half
the height) and Overview (colored dots: a quarter of the width, a third of
the height). Far keeps the width because one-line titles collided when
distances were halved both ways (changed during stage 2). Body text never
shows on the canvas: `K` pops it up, and the Note view shows all of it.
- Right-angle lines with proper junctions (`├ ┬ ┼`); lines pass under nodes.
- A node's color goes on its border. Each node can pick its border, and the
theme's named styles and tag rules can set color and border together.