Board editor: Panels and Sketch (#42) #92

Merged
crowmaki merged 2 commits from issue-42-board-editor into main 2026-10-08 07:37:57 +00:00
Owner

Closes #42. Part of #24.

What

A filmmaker can storyboard a whole Scene in a Panel-strip editor over the Scene's Board timeline.

Core (studio-core)

  • Schema V14 adds board (one per Shot) and panel (position, canvas_w, canvas_h, sketch_blob_id). Sketch PNGs are blobs, and the sweep knows the column.
  • A Panel canvas is the Shot's effective ratio with a short side of 180 px (board_canvas: 320×180 at 16:9).
  • save_board writes all Panels in their new order as one undoable edit ("Save board"). Panels are edited in place with no history, and saving an unchanged Board does nothing. It refuses:
    • an empty Board
    • Panels that belong to another Board, or the same Panel twice
    • unreadable PNGs
    • sizes that are not a Panel canvas
  • Rust decodes and re-encodes every Sketch, so the same pixels always give the same blob.
  • A Panel keeps the canvas it was drawn on. When the Shot's ratio no longer matches, it is barred: fitted inside mid-grey bars. board_images flattens a Board deterministically, and a pinned hash test guards the bytes.
  • scene_boards returns the Board timeline in script order. Shots that start on the same Line follow the Setup order.
  • Deleting a Shot or a Setup takes its Board along, and undo restores it. A split Shot keeps its Board on the first part.

UI

  • The Board view replaces its placeholder, and each Shot row on the Scene page links to it.
  • Sketch tools: brush, eraser, fill, line, rectangle, ellipse, filled toggle, size and three tones. Shapes preview with the same code that draws them. Keys: B/E/G/L/R/O, plus [ and ] for size.
  • Timeline: Panels can be added, duplicated, reordered and deleted. Ghosting shows the previous Panel, including across Shots.
  • Undo: the editor keeps a local stroke undo until save (Ctrl+S). While strokes are unsaved, Ctrl+Z stays in the editor. Once saved, Ctrl+Z is the app undo.
  • Old ratio: a Panel drawn at an old ratio shows with bars. The first stroke reframes it onto the Shot's canvas, with paper where the bars were.
  • Leaving a Shot or the view saves unsaved strokes.

Not in this PR

  • The annotations column, the Sketch/Annotate switch and Notation come with #43.
  • Describe… is #44.
  • Tiled versus per-Panel sending is #47.

Checks

  • cargo test --workspace --all-features: 15 new tests in tests/boards.rs cover Panel ordering, flattening bytes and barring.
  • bun test src and bun run check pass.
  • I drove the real app by hand: drawing, local undo, duplicating, reordering, save and app undo, ghosting across Shots, and barring then reframing after an aspect change.
Closes #42. Part of #24. ## What A filmmaker can storyboard a whole Scene in a Panel-strip editor over the Scene's Board timeline. **Core (`studio-core`)** - Schema V14 adds `board` (one per Shot) and `panel` (position, `canvas_w`, `canvas_h`, `sketch_blob_id`). Sketch PNGs are blobs, and the sweep knows the column. - A Panel canvas is the Shot's effective ratio with a short side of 180 px (`board_canvas`: 320×180 at 16:9). - `save_board` writes all Panels in their new order as **one undoable edit** ("Save board"). Panels are edited in place with no history, and saving an unchanged Board does nothing. It refuses: - an empty Board - Panels that belong to another Board, or the same Panel twice - unreadable PNGs - sizes that are not a Panel canvas - Rust decodes and re-encodes every Sketch, so the same pixels always give the same blob. - A Panel keeps the canvas it was drawn on. When the Shot's ratio no longer matches, it is **barred**: fitted inside mid-grey bars. `board_images` flattens a Board deterministically, and a pinned hash test guards the bytes. - `scene_boards` returns the Board timeline in script order. Shots that start on the same Line follow the Setup order. - Deleting a Shot or a Setup takes its Board along, and undo restores it. A split Shot keeps its Board on the first part. **UI** - The Board view replaces its placeholder, and each Shot row on the Scene page links to it. - **Sketch tools:** brush, eraser, fill, line, rectangle, ellipse, filled toggle, size and three tones. Shapes preview with the same code that draws them. Keys: B/E/G/L/R/O, plus `[` and `]` for size. - **Timeline:** Panels can be added, duplicated, reordered and deleted. Ghosting shows the previous Panel, including across Shots. - **Undo:** the editor keeps a local stroke undo until save (Ctrl+S). While strokes are unsaved, Ctrl+Z stays in the editor. Once saved, Ctrl+Z is the app undo. - **Old ratio:** a Panel drawn at an old ratio shows with bars. The first stroke reframes it onto the Shot's canvas, with paper where the bars were. - Leaving a Shot or the view saves unsaved strokes. ## Not in this PR - The `annotations` column, the Sketch/Annotate switch and Notation come with #43. - Describe… is #44. - Tiled versus per-Panel sending is #47. ## Checks - `cargo test --workspace --all-features`: 15 new tests in `tests/boards.rs` cover Panel ordering, flattening bytes and barring. - `bun test src` and `bun run check` pass. - I drove the real app by hand: drawing, local undo, duplicating, reordering, save and app undo, ghosting across Shots, and barring then reframing after an aspect change.
A Shot's Board is one or more Panels, each a Sketch layer stored as a
PNG blob on a fixed canvas: the Shot's effective aspect ratio with a
short side of 180 px. save_board writes the Panels in their new order
as one undoable edit; Panels are edited in place with no history, and
Shot and Setup deletes take the Board along and undo restores it.

A Panel keeps the canvas it was drawn on. When the ratio changes it is
barred (fitted inside mid-grey bars) on screen and in board_images,
which flattens the stored layers deterministically, until it is drawn
on again. scene_boards gives the Scene's Board timeline in script
order.

The Board view replaces its placeholder: a Panel stage with brush,
eraser, fill, line, rectangle, ellipse, filled toggle, size and three
tones over the Scene-wide timeline, where Panels are added, duplicated,
reordered and deleted, and the previous Panel can be ghosted across
Shots. Svelte keeps a stroke undo until save (Ctrl+S, or on leaving the
Shot).
Undo stays in the editor while strokes are unsaved, so an app undo
never reverts the saved Board underneath them. A pinned hash guards the
flattened bytes. Board row SQL lives on BoardRow, the barring helper is
fit_with_bars, scene_boards reads Line positions once, and the tone
swatches come from the tone values.
crowmaki deleted branch issue-42-board-editor 2026-10-08 07:37:57 +00:00
Sign in to join this conversation.
No description provided.