Skip to content

Slide show ink: pen, highlighter, eraser, laser, keep-on-exit, ink select tool - #161

Open
ansgomez wants to merge 3 commits into
storytold:mainfrom
ansgomez:ink-tools
Open

ansgomez wants to merge 3 commits into
storytold:mainfrom
ansgomez:ink-tools

Conversation

@ansgomez

@ansgomez ansgomez commented Oct 11, 2026 •

Copy link
Copy Markdown

Summary

Turns the slide show's pen into a proper notetaking tool set, all reachable from an always-visible icon bar (no collapsed popovers, no text buttons):

  • show_ink module (crates/ui-egui/src/show_ink.rs): per-slide stroke store that survives navigation; tool enum (pointer / select / pen / highlighter / eraser / laser); palette and width ladder per tool; midpoint-quadratic stroke smoothing; journal-based undo covering draws, erasures, clears, moves, duplicates and pastes. Pure and unit-tested (53 tests).
  • Show bar is always visible: vector-icon buttons throughout (nav chevrons, lasso select, pen, highlighter, eraser, laser, undo, trash = clear, blank-screen toggle, exit; three icons drawn new in icons.rs's code-drawn idiom), 8 color swatches as rounded tiles, 4 width quick-pick dots, slim group dividers. Buttons have hover fills, active frames, disabled greying (Undo/Clear track the ink journal) and tooltips that survive the disabled state. Bar width is measured from content; narrow windows drop the extras instead of overflowing.
  • Select tool (V): click a stroke to select (Shift toggles/adds), drag selected ink to move it (one gesture = one undo), drag empty space for a marquee, ⌫ deletes, ⌘D duplicates, ⌘C/⌘V copy/paste across slides. Accent bounding box + handles; marquee tint. Gestures are anchored to the slide where they began — navigation mid-drag commits cleanly, undo mid-drag reverts the in-flight gesture.
  • Laser pointer (⌘L): glowing dot with a smooth tapered fading tail; clicks still advance. Highlighter (⌘I), eraser (⌘E, ring cursor), ⌘Z undo, E clears the slide's ink (undoable), C cycles color, [/] step the width.
  • Keep-on-exit: ending a show with annotations asks whether to keep them (modal; Y/Enter keeps, N/Esc discards). Kept ink lands in the document via a new validated, capped, undoable slide.annotate engine command (dots promoted to zero-length segments so they render and export).
  • Presenter view mirrors the ink. Control channel: ui.key forwards modifiers to a running show, ui.inspect reports ink state (inkTool, strokes, selected, askKeep), show.end takes {keep} to answer the prompt atomically.

Parity checklist: Pen and highlighter ink during the show and Laser pointer moved to D (summary regenerated with cargo xtask parity).

Testing

  • cargo xtask ci green (fmt, clippy -D warnings, tests, assets, layers, wasm).
  • 53 show_ink unit tests + engine tests for slide.annotate.
  • 6 headless UI tests (crates/ui-egui/tests/show_ui.rs, egui_kittest + wgpu, GPU-less-CI guarded): bar contents, disabled-state tracking, drag-draws, prompt buttons, select/move/duplicate/delete through real input, navigation mid-drag.
  • Driven end-to-end in the real app through the control channel: every tool, both prompt paths, show.end {keep}.
  • Two adversarial-review rounds per feature; all findings fixed (incl. a HIGH: unanchored move gestures corrupted undo ordering) and pinned with regression tests.

Notes for reviewers

Pre-existing, not introduced here, not fixed: after ~3–4 fullscreen show cycles the show can become input-inert (reproduces on the 0.3.0 release build; looks winit/fullscreen-space related); show.goto digit entry accumulates stale input; closing the window mid-show drops ink without the keep prompt (quit ≠ end show — arguable); one engine test (clicks_in_flipped_shapes_hit_the_text_where_it_is_drawn) flaked once under full-workspace parallel test load, passes consistently in isolation (font-metric sensitivity — observed on a tree untouched by this PR's crates). Happy to file issues.

Update 2026-10-16 — rebased onto current main

Branch rebased onto main @ 1dc6972 (was based on be14248); conflicts in engine/cmd/slide.rs, ui-egui/{control,lib,show}.rs and docs resolved keeping both sides. After the rebase: cargo xtask ci — fmt, clippy, pdf-deps, assets, layers, wasm all pass. cargo test --workspace has one failure in replacefonts_tests::ribbon_button_opens_the_dialog_and_replaces that reproduces on clean origin/main in a fonts-embedded environment (the Home ribbon is ~130 px wider than the test's 1400 px window, so the "Replace Fonts…" button renders off-screen and the click misses). Pre-existing upstream issue, not caused by this branch.

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…old#207)

An unwrapped title carried a long file name past the viewport: egui's Modal
sizes to its content, so the centered panel grew to the name's full width,
clipped its own message and pushed Save/Cancel off-screen (reported on
Windows, reproduced everywhere). Wrap the title to the dialog width in the
save prompt and the password prompt, and pin the title and all three
buttons inside a 1365x719 screen in a regression test.

Co-authored-by: Mawfyy <mawfy12@gmail.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
… to fit the window (storytold#322)

Wrapping the title (storytold#161) kept the prompt narrow, but a long enough name
still grew it taller than the window and pushed Save, Cancel and Don't
save off-screen. On the web a `?file=` URL names the document, so the
name has no length limit.

Past 80 characters the name now gives way in the middle ("start…end"),
keeping the start and the extension and version suffix; the full name
shows on hover. The new test checks the title and buttons stay inside
the desktop's minimum window (820×520) for long Latin, Thai and CJK
names and a 2000-character one.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Andres Gomez added 3 commits October 16, 2026 17:39
…-on-exit

The slide show's pen becomes a proper notetaking tool set:

- New show_ink module: per-slide stroke store (survives navigation), tool enum
  (pointer/pen/highlighter/eraser/laser), palette and width ladder per tool,
  midpoint-quadratic stroke smoothing, journal-based undo that also restores
  erasures and clears.
- Show bar is always visible: navigation, vector icon buttons for pen,
  highlighter, eraser and laser (new laser-pointer icon), 8 color swatches,
  width quick-pick dots, Undo/Clear, blank, End. Bar width is measured from
  content; narrow windows drop the extras instead of overflowing.
- Laser pointer (Cmd+L): glowing dot with a smooth tapered fading tail; clicks
  still advance. Highlighter (Cmd+I), eraser (Cmd+E, ring cursor), Cmd+Z undo,
  E clears the slide's ink (undoable).
- Exiting with annotations asks to keep them (modal prompt; Y/Enter keeps,
  N/Esc discards); kept ink lands in the document via the new slide.annotate
  engine command (validated, capped, undoable; dots promoted to zero-length
  segments so they render and export).
- Presenter view mirrors ink. Parity: show pen/highlighter and laser pointer
  are now Done. Control channel: ui.key forwards modifiers to the show,
  ui.inspect reports ink state, show.end takes {keep} to answer the prompt.

Headless UI regression tests render the show with egui_kittest (widget tree +
pixels): full bar visible, swatches painted, drag draws, prompt buttons painted
and clickable.
…sabled states

Nav chevrons, tool icons, swatches and width dots are joined by vector-icon Undo,
Clear (new trash icon), Blank screen (new monitor icon, now a toggle) and End (new
exit icon); the reading-mode bar gets the same treatment. Buttons show a hover fill,
an active frame, grey out when inert (Undo/Clear track the ink journal via the new
can_undo) and keep their tooltips even while disabled. Groups are separated by slim
dividers; swatches are painted as rounded tiles with hover/selection rings.

Headless tests now also assert the disabled state of Undo/Clear follows the ink, and
can_undo is unit-tested against the journal.
…e, delete

A proper notetaking select tool during the show: lasso icon in the bar (V), click a
stroke to select it (Shift toggles/adds), drag a selected stroke to move the whole
selection, drag on empty space for a marquee (bbox intersect), Delete removes,
Cmd+D duplicates at an offset, Cmd+C/Cmd+V copy/paste across slides via an ink
clipboard. Selection shows an accent box with handles; the marquee paints as a
tinted rect. Everything is journaled: one move gesture = one undo, duplicate/paste
undo as Added, delete restores via the erasure path.

Gesture safety, pinned by regression tests: move drags stay anchored to the slide
where they began (navigation commits the partial move there, mid-drag or same-frame);
undo mid-drag first reverts the in-flight gesture; delete/clear/duplicate/paste close
an open gesture before mutating; edit keys are inert on the end screen and mid-drag;
sync_slide lives in Show::apply (the one navigation choke point) plus per-key, so no
ordering of bar clicks, keys, auto-advance or presenter-window navigation can act on
a stale selection. ui.inspect reports the selection count.

Adversarial review: 10 findings fixed (1 high: unanchored move corrupted undo),
verified fixed in a second pass; its 3 remaining lows (bar-nav key race, same-frame
marquee release, can_undo mid-drag) fixed with tests.
@ansgomez ansgomez changed the title INK.1-8: presentation ink tools — colors, widths, eraser, laser, keep-on-exit Slide show ink: pen, highlighter, eraser, laser, keep-on-exit, ink select tool Oct 16, 2026

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: slide show ink with a pen, highlighter, eraser, laser, keep-on-exit and an ink select tool. The lock gains image, the engine gains a slide.annotate command ("Add Ink Annotations") and imports Shape and ShapeKind into the slide commands. PowerPoint's show-time pens and highlighters, its Keep ink annotations prompt and the Ink Replay are the oracle. Ink annotations kept on exit become shapes of the slide, so they must be one undo step and appear in the saved file as ink (p:contentPart with ink) and not as thousands of shapes; the number of points per stroke needs a bound. It overlaps deckcraft#624 and #636 (laser and recording) by another author, and the ink and laser features should share state. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the missing feature The reference application has it and we do not, or only part of it label Nov 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing feature The reference application has it and we do not, or only part of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants