Skip to content

LR-VIEW-ZOOM: a pinch holds the loupe's fit size, so it no longer renders at every zoom step - #2499

Merged
aiongg merged 1 commit into
storytold:mainfrom
nledford:pinch-display-fit
Oct 22, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
nledford:pinch-display-fit

Conversation

@nledford

@nledford nledford commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Off main.

Problem

tests_preview_limit::in_the_loupe::a_pinch_holds_the_render_sizes_until_it_stops fails intermittently on main. Bisected to #2012 (merge a4cbdb4, thanks @ubergeneric): before it the test passed 20/20, at the #2012 merge it failed 8/8, and on main it failed 17 of 20 runs. The cause isn't in the test: the display fit #2012 added (with_display_fit(drawn width, drawn height) in panels/detail.rs) isn't held during a pinch. SizeHold holds only main_edge and window_edge, so every frame of a pinch asks for a Main render at a new size (762, 823, … 2560), the stream of renders #323/#351 was meant to prevent. Real users pay for it on every pinch, and the hosted FreeBSD job (which runs cargo test --workspace) fails intermittently for every PR.

Change

  • SizeHold also holds the display-fit size (display_fit(now, gesturing, fresh)): the size from before the gesture while one runs and for HOLD_SECS after, then the size it ended at. It's cleared on a photo change like the other held sizes.
  • panels/detail.rs takes that size once per frame and passes it to the Main, Before and (unchanged otherwise) at-rest jobs; the pixel size is clamped before the as usize cast.
  • Fit's sharpness from Detail: Fit is as sharp as the photo #2012 is unchanged at rest: display_fit is called every frame, so the size is retaken as soon as the hold ends.
  • Unit test a_pinch_holds_the_display_fit_size (region.rs), next to a_pinch_holds_the_render_sizes.
  • docs/whats-new.md entry; LR-VIEW-ZOOM row and revision line updated.

Not in this PR: the hover-preview job keeps its own fit (it only renders while not interacting); no change to the hold time or to what a pinch renders at the end.

How it was checked

  • cargo xtask ci: all 8 steps passed (before a rebase onto 2 unrelated commits from main).
  • a_pinch_holds_the_display_fit_size fails with the hold disabled and passes with it.
  • a_pinch_holds_the_render_sizes_until_it_stops passes 10/10 with the fix; the other a_pinch_holds* tests pass.
  • Independent review: found that the Before render still took the live fit size; fixed in this commit.

Screenshots

None: no visible change at rest.

Merging

Checklist

  • No new UI strings
  • No panics in non-test code
  • Docs updated

Summary by CodeRabbit

  • Bug Fixes

    • Improved loupe pinch-zoom behavior by retaining the fit-view render size during continuous gestures, reducing unnecessary full-frame updates.
    • Preserved stable rendering in the main view, hover preview, and Before view while interacting.
  • Documentation

    • Updated the release notes and parity checklist to document the improved zoom behavior.

@coderabbitai

coderabbitai Bot commented Oct 21, 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: Repository: storytold/lightcraft/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a3759fbb-12c0-4715-a785-20ca6aa0613b
📥 Commits

Reviewing files that changed from the base of the PR and between bfb23db and 0e08318.

📒 Files selected for processing: 4
  • crates/ui-egui/src/panels/detail.rs
  • crates/ui-egui/src/region.rs
  • docs/parity-checklist.md
  • docs/whats-new.md

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

📝 Walkthrough

The UI now holds display-fit dimensions during and shortly after pinch gestures. Resting main, hover-preview, and Before renders use the held dimensions. Tests and documentation cover the updated behavior.

Changes: Pinch-held display-fit sizing

Layer / File(s) Summary
Hold display-fit dimensions
crates/ui-egui/src/region.rs
SizeHold stores fit dimensions during gestures and the hold interval, then adopts fresh dimensions. Photo changes reset the stored dimensions. Tests cover holding, release, idle stability, and reset behavior.
Apply held dimensions to resting renders
crates/ui-egui/src/panels/detail.rs, docs/parity-checklist.md, docs/whats-new.md
The detail panel uses rounded, clamped drawn dimensions to obtain held display-fit dimensions for resting main, hover-preview, and Before renders. The checklist and release notes document the pinch behavior.

Priority: ⬇️ Low

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

Change: Bug fix

Possibly related issues

  • storytold/lightcraft issue 2436: It records soft-at-Fit display behavior, which this change relates to through display-fit sizing during pinch zoom.

Suggested reviewers: claude

Merge Risk: ⚪ Minimal · up to 0e083

The loupe retains its fit size during pinching and briefly afterward, then refreshes to the final size. No issue requiring a pre-merge fix was established.

Security architecture risk: ⚪ Minimal · up to 0e083

The change stabilizes rendering during pinch zoom without introducing new access, persistence, or remote exposure. Photo changes clear the retained dimensions, and rendering refreshes after the gesture settles.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed state affects render sizing for the active photo within the UI. The inspected flow does not grant additional authority or introduce a cross-photo data access path.

Resilience and Maintainability Implications

  • observed — Photo changes replace the held state, gesture frames refresh its deadline, and expiry accepts fresh dimensions. The caller schedules repaint while holding. The added test covers repeated gesture frames, post-gesture expiry, idle refresh, and switching photos during a hold.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the main change: pinch zoom now holds the loupe fit size and avoids rendering at every zoom step.
Docstring Coverage Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (2 skipped: 2 u…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.99.0)

Clippy execution timed out

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

@aiongg
aiongg merged commit 27f608a into storytold:main Oct 22, 2026
5 checks passed
AlexChambers added a commit to AlexChambers/lightcraft that referenced this pull request Oct 22, 2026
Merge current main and retain storytold#2499's production fix exactly. Keep the five
controlled headless regressions and adapt the exact-deadline unit test to
SizeHold::apply and display_fit. The base-relative diff adds tests only.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>
AlexChambers added a commit to AlexChambers/lightcraft that referenced this pull request Oct 28, 2026
Merge current main and retain storytold#2499's production fix exactly. Keep the five
controlled headless regressions and adapt the exact-deadline unit test to
SizeHold::apply and display_fit. The base-relative diff adds tests only.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants