Skip to content

feat(localize): P copies the previous frame's box onto the current frame - #386

Merged
Chouffe merged 2 commits into
mainfrom
worktree-localize-copy-previous-box
Aug 14, 2026
Merged

feat(localize): P copies the previous frame's box onto the current frame#386
Chouffe merged 2 commits into
mainfrom
worktree-localize-copy-previous-box

Conversation

@Chouffe

@Chouffe Chouffe commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

What

A new keyboard shortcut in the localize object editor: P replaces the current frame's box with the box the previous frame shows for this object.

Behavior

  • Walks backward through the lane from the current frame and takes the first box shown: the frame's committed box if one exists, otherwise its winning model pick (what Enter would commit there). Cleared frames ("not visible here") and boxless undecided frames are skipped.
  • The copied geometry commits through the normal autosave path with origin: human — no model proposed it on this frame; a person placed it there.
  • No-ops: no earlier frame shows a box, the frame is out of range (peeking a gap frame), and auto-repeat (the save is async — same reasoning as Delete).
  • Advertised in the editor shortcuts modal (?): "Copy the previous frame's box here — P".

Why

When the model's box on a frame is bad or missing but the plume barely moved since the previous frame, the annotator currently has to redraw by hand what the previous frame already got right.

Testing

  • previousShownBox unit tests: committed box, winning-pick fallback, skipping cleared/boxless frames, null when nothing earlier shows a box, null on the first frame.
  • Editor keyboard tests: commit with human origin, fallback pick, first-frame no-op, auto-repeat dropped, out-of-range no-op.
  • Full suite: 1517 passing; npm run quality green.

In the object editor, P replaces the current frame's box with the one
the nearest earlier lane frame shows — its committed box, or the
winning pick it would commit if undecided. Cleared and boxless frames
are skipped. The copied geometry commits with a human origin: no model
proposed it on this frame, a person placed it there.

No-ops: nothing earlier shows a box, the frame is out of range (a
peeked gap frame), and auto-repeat — the save is async, same reasoning
as Delete.
Review follow-ups on the P shortcut:

- Ctrl/Cmd/Alt+P is the browser's shortcut (print, most visibly) — the
  handler now leaves it alone instead of writing a box AND suppressing
  the print dialog. Same line the page-level handler draws.
- P no longer writes behind the shortcuts sheet or the accept popover.
  Unlike the view toggles it commits data, and the sheet documents P —
  an invitation to press it while the sheet is open.
- The out-of-range no-op test now starts from the last frame, where a
  previous box exists to copy; from the first frame it passed with the
  guard deleted (verified by mutation).
- copyPrevious routes through commitCandidate instead of restating its
  body.
@Chouffe
Chouffe merged commit 5863d00 into main Aug 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant