Skip to content

LR-VIEW-ZOOM: dragging a mask keeps the photo sharp (#1679) - #4444

Open
john01px2022 wants to merge 1 commit into
storytold:mainfrom
john01px2022:fix-1679-sharp-mask-drags
Open

john01px2022 wants to merge 1 commit into
storytold:mainfrom
john01px2022:fix-1679-sharp-mask-drags

Conversation

@john01px2022

@john01px2022 john01px2022 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1679 (mask drags; slider drags are unchanged).

Problem

While you drag a radial or linear gradient's handle, body or pin, the whole photo goes soft, and sharpens again on release. A mask drag is an interaction, so the loupe drafts it like a slider drag: at region::CPU_DRAFT_SCALE (0.6) where the GPU doesn't draw the view, or once that control's full-size drafts on this photo were judged slow (mask re-evaluation, #1145, makes that likely). The edit changes part of the photo, but all of it drops to 0.6.

Change

  • region.rs: SHARP_DRAG names the mask-edit interaction ("Edit Mask"). DragScale::scale gives it full size whatever the GPU or verdict, and observe never gives up on full size for it mid-drag.
  • panels/detail/masks.rs: the two develop.beginInteraction calls for mask edits use the constant.

Not in this PR: slider drags (#1679's wider ask; a setting for that would be its own PR). The draft still has no Lanczos display fit, as every draft.
Known limit: on a slow CPU-only machine a mask drag now shows fewer, full-size drafts instead of many small ones.

How it was checked

  • cargo xtask ci passes on this branch, rebased on current main (cargo xtask ci --quick passes)
  • A test that fails without this change: region::tests::a_mask_edit_always_drafts_at_full_size (on the CPU, after slow drags, and far over budget mid-drag; a slider drag still drafts small)
  • User-visible change: ran the app and looked at the result (not done)

Merging

Checklist

  • No new panic path in non-test code
  • New text on screen goes through tr(): no new text
  • The feature's row in docs/parity-checklist.md updated (LR-VIEW-ZOOM)
  • New code has a caller
  • No new assets
  • Ready to merge

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Mask handle, body, and pin drags now retain full-size previews, including when rendering on the CPU or when rendering takes longer than usual.
    • Mask previews no longer switch to a reduced size during a drag. Other controls, such as sliders, continue to use reduced-size previews on the CPU.

A drag of a mask's handle, body or pin is an interaction, so the loupe
drafted it like a slider drag: at 0.6 of full size on the CPU, or once its
full-size drafts had been slow. A mask edit changes part of the photo,
and the whole photo went soft for it.

Its drafts (region::SHARP_DRAG, the "Edit Mask" interaction) are now
always full size, on the CPU too, and never drop to 0.6 mid-drag. A slow
machine shows fewer drafts instead. Slider drags are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Mask-handle pointer drags and keyboard adjustments now use SHARP_DRAG. These interactions retain full-size drafts on CPU rendering and after slow or over-budget renders. Other controls, including slider drags, retain their previous draft scaling behavior.

Changes: Mask-edit draft sizing

Layer / File(s) Summary
Identify mask-edit interactions
crates/ui-egui/src/region.rs, crates/ui-egui/src/panels/detail/masks.rs
A public SHARP_DRAG label identifies mask-handle pointer drags and keyboard adjustments.
Preserve full-size drafts
crates/ui-egui/src/region.rs, crates/ui-egui/src/region/tests.rs, docs/parity-checklist.md
Mask-edit drafts stay full size on CPU rendering and after repeated slow drags or 400 ms renders. The test also checks that slider drags retain CPU_DRAFT_SCALE. The parity checklist records the behavior and leaves the status unchanged.

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

Change: Bug fix

Suggested reviewers: aiongg, nledford, bruno-alumn

Merge Risk: Minimal · up to 3efa9

Dragging a mask handle, body or pin now keeps the photo at full size, including on CPU rendering. Slider drags are unchanged. On slow CPU-only machines, mask drags may render fewer drafts, which is intended. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: mask-edit drags keep the photo at full-size drafts, so it stays sharp. The changeset adds SHARP_DRAG, which keeps mask-edit drafts at full size on CPU and during slow …
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: Title check

Explanation

The title names the main change: mask-edit drags keep the photo at full-size drafts, so it stays sharp. The changeset adds SHARP_DRAG, which keeps mask-edit drafts at full size on CPU and during slow or over-budget drags, and adds a test and docs for it. The title does not mention the SHARP_DRAG label rename or the docs update, which is expected for a short title. The title also includes a ticket reference (#1679) that differs from the PR number (#4444) in the objectives; this does not affect the verdict.

Finishing Touches

Generate unit tests (beta)

  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between aa08a77 and 3efa9c8.

Files selected for processing: 4

  • crates/ui-egui/src/panels/detail/masks.rs
  • crates/ui-egui/src/region.rs
  • crates/ui-egui/src/region/tests.rs
  • docs/parity-checklist.md

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

@vangel76 vangel76 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed 3efa9c8c. I checked the sharp-drag path, quality adaptation, and the comparison with slider drafts. I found some avoidable work in the exempt path.

Source review only. I did not build the project, run tests, or check CI.

&& median_after_first(&self.samples).is_some_and(|m| m > DRAFT_BUDGET_MS * GIVE_UP_FACTOR)
&& let Some((_, s)) = self.current.as_mut()
&& let Some(((_, control), s)) = self.current.as_mut()
&& control != SHARP_DRAG

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3. Keep sharp drags out of quality-adaptation sampling. The exempt drag still copies and sorts samples for the median after the cutoff and then ignores the verdict. Finishing also records an entry in the shared history used by sliders. Bypass measurement and recording for the exempt drag. The existing regression can assert that it leaves no adaptation verdict while slider adaptation still works.

emmertex referenced this pull request in AlphaZentaurii/chromaforge Nov 29, 2026
Adapted from upstream #4444: region::SHARP_DRAG names the "Edit Mask"
interaction; DragScale keeps its drafts at full size on the CPU too and
never gives up to CPU_DRAFT_SCALE mid-drag. The fork begins that
interaction in three places in panels/detail.rs (gradient body, grip
drag, mask keys); all use the constant. Test brought over.

Manual: none, no user-visible change beyond sharper drafts.

Co-authored-by: tecari0 <121329615+tecari0@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@wanikhawar wanikhawar 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.

Conflicts with main, please rebase. The change reads correctly.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants