Skip to content

fix(presets): keep crop when preset intensity is set to 0 - #1948

Merged
CyberTimon merged 1 commit into
CyberTimon:mainfrom
lalibertemarc:fix/preset-intensity-zero-crop
Oct 18, 2026
Merged

CyberTimon merged 1 commit into
CyberTimon:mainfrom
lalibertemarc:fix/preset-intensity-zero-crop

Conversation

@lalibertemarc

Copy link
Copy Markdown
Contributor

Description

Fixes #1941. Dragging a preset's intensity slider down to 0 reset the crop, along with every other setting the preset doesn't touch (rotation, flips, masks...).

mixAdjustments had a shortcut for 0%: it returned the whole INITIAL_ADJUSTMENTS object, and handleIntensityChange spreads that over the current adjustments. Presets leave out geometry and masks by default, so those keys should never be touched by the slider. Every other intensity only mixes the preset's own keys, so only 0% did this.

Now 0% goes through the same per-key loop and sets each preset key back to its initial value. Everything outside the preset stays as it is.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Changes Made

  • PresetsPanel.tsx / mixAdjustments: removed the fraction === 0 early return. At 0% each preset key gets its initial value inside the existing loop.

Testing

  • These changes were tested locally by a human and confirmed to work.
  • I haven't added any automated tests to the code because the codebase currently lacks a test suite.

Repro from the issue: apply a preset, crop, drag the preset slider to 0. The crop now stays.

Test Configuration:

  • OS: Windows 10 Home (19045)
  • Hardware: AMD Ryzen 5 3600X, NVIDIA GeForce RTX 2070

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

Additional Notes

#1792 (multi-preset toggle) deletes the same line. It also rebuilds the adjustments from a snapshot taken when the preset was first applied, though, so a crop made after applying the preset may still get reverted there. Whichever PR merges second will need a small rebase.

AI Disclaimer:

Please state the involvement of AI in this PR:

  • This PR is created by an AI agent
  • This PR is mostly AI-generated but edited/merged together by a human
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)

🤖 Generated with Claude Code

At 0% mixAdjustments returned the whole INITIAL_ADJUSTMENTS object,
which reset crop, rotation, masks and every other non-preset setting.
Only reset the keys the preset actually contains.

Fixes CyberTimon#1941

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

Copy link
Copy Markdown
Contributor Author

The presets that save the crop will keep the current behavior, though it makes no sense to reset the crop when the preset saves none and amound slider is 0.

@CyberTimon

Copy link
Copy Markdown
Owner

LGTM, thanks for the fix!

@CyberTimon
CyberTimon merged commit 619dc04 into CyberTimon:main Oct 18, 2026
15 of 16 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.

BUG: Crop Reset when reducing previously applied preset slider down to 0

2 participants