Skip to content

fix(annotations): refit frame text whenever the Auto frame changes shape - #1262

Merged
EtienneLescot merged 2 commits into
mainfrom
fix/annotation-refit-auto-frame-shape
Oct 15, 2026
Merged

EtienneLescot merged 2 commits into
mainfrom
fix/annotation-refit-auto-frame-shape

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

A text annotation now keeps its words when a Frame style or padding change reshapes the Auto frame. Found in the v2.1.0-rc.1 Windows pass (#1258): the title wrapped and was clipped, in the preview and the export.

Cause

  • applySettingsPatch refitted frame annotations only when the patch carried aspectRatio.
  • Under Auto, the default format, the frame shape also follows the device frame, the padding and the camera layout (autoFormatAspect). Monitor takes a 16:9 take from 1.747 to 1.343.
  • The text box kept its share of a narrower frame, so the compositor wrapped its words and the box cut them.

Fix

  • Refit whenever the resolved frame shape changes, whatever key the patch carries. refitFrameAnnotations already returns early when the shape is unchanged.
  • Editor and agent tools both route through applySettingsPatch, so both get it.

Not a regression of this cycle. v2.0.0 has the same gate (useEditorSettings.ts at the tag), with frame-space text and Auto shaped by the device frame.

Proof on exported frames. Same 1920×1080 take, a 64 px bold title on a plate, fitted under Auto with no frame, then Frame = Monitor. Both documents exported by the installed 2.1.0-rc.1 CLI (the renderer is untouched here), 1450×1080, frame at 1.5 s:

Document Plate Text
As rc.1 writes it 462×96 px 2 lines, cut by the plate edge
As this fix writes it 704×88 px 670 px, 1 line, uncut

Tests. settingsPatch.test.ts: a device frame and a padding change under Auto (both fail before the fix), and a fixed format left alone.

Not covered. Under Auto the frame also reshapes when clips change (a crop of the first clip, a new first clip); those paths still do not refit. The live editor preview was not driven by hand; it draws the same document through the same compositor.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Annotations now adjust to fit when settings change the shape of an Auto-aspect-ratio frame, including changes to the device frame or padding.
    • When a settings change preserves the frame’s shape, annotations remain unchanged, avoiding unnecessary adjustments.
    • Frame annotations now respond to changes in the resolved frame shape, even when the aspect-ratio setting itself has not changed.

applySettingsPatch refitted frame annotations only when the patch carried aspectRatio. Under Auto, the default format, the frame shape also follows the device frame, the padding and the camera layout, so a Frame style change (Monitor: 1.747 to 1.343 on a 16:9 take) left a text box at its share of a narrower frame: the compositor wrapped its words and the box cut them, in the preview and the export. Refit whenever the resolved shape changes, whatever key the patch carries.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eec921c8-332f-41fa-abdb-a424a200c5a2
📥 Commits

Reviewing files that changed from the base of the PR and between 5852165 and 31f3ed4.

📒 Files selected for processing: 1
  • src/lib/ai-edition/store/settingsPatch.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

📝 Walkthrough

applySettingsPatch can now refit frame-space annotations when a settings patch changes the resolved frame shape, even if the patch omits aspectRatio. Tests cover Auto frame-shape changes and unchanged shapes.

Changes: Settings Patch Refitting

Layer / File(s) Summary
Shape-based annotation refitting
src/lib/ai-edition/store/settingsPatch.ts, src/lib/ai-edition/store/settingsPatch.test.ts
The function checks for frame-space annotations instead of returning early when patch.aspectRatio is undefined. Tests check text-box fit after device-frame and padding changes under Auto, and annotation object identity when the frame shape remains unchanged.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 31f3e

Settings changes that reshape an Auto frame now refit its frame annotations, while unchanged shapes remain untouched. The editor and agent paths preserve the result; no concrete merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: refitting frame text when an Auto frame changes shape.
Description check Passed The description clearly explains the problem, cause, fix, impact, evidence, tests, and known limitations. It does not use the template headings or specify the related issue, change type, release impac…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot

Copy link
Copy Markdown
Collaborator Author

Perf: no per-frame or per-scene-build cost. The check runs only on a settings write (slider moves included), never in sceneDescription or the render loop.

Measured in Node, per settings write under Auto:

  • shape check: 15 µs with no device frame, 55 µs with one; ~0 under a fixed format;
  • skipped entirely when no annotation sits on the frame (31f3ed4);
  • a write that keeps the shape refits nothing; one that reshapes it (a padding drag) measures each frame text once, ~115 µs per text with the font-table measure the agent uses. The editor measures with a canvas, not timed here.

@EtienneLescot
EtienneLescot merged commit 40a0fd4 into main Oct 15, 2026
19 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