Skip to content

chore(crop): Remove invalid crop area message and related validation logic - #7160

Merged
Frooodle merged 8 commits into
Stirling-Tools:mainfrom
balazs-szucs:crop-fix
Aug 29, 2026
Merged

chore(crop): Remove invalid crop area message and related validation logic#7160
Frooodle merged 8 commits into
Stirling-Tools:mainfrom
balazs-szucs:crop-fix

Conversation

@balazs-szucs

@balazs-szucs balazs-szucs commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Description of Changes

On the crop UI, you cannot select outside the PDF. As this is the default behavior the validation and error is unnecessary on the FE. Also resolve a bug when you opened the PDF with the "default" crop area it showed out-of-bounds error.

No functional change expected

Changes:

  • Removed out-of-bounds crop selection error alerts and parameter validation failures.
  • Automatically clamp crop coordinates to the nearest page boundary (0 <= x <= actualWidth, 0 <= y <= actualHeight).
  • Retained full PDF default page crop selection on initial open and reset.

Checklist

General

Documentation

Translations (if applicable)

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have run task check to verify linters, typechecks, and tests pass
  • I have tested my changes locally. Refer to the Testing Guide for more details.

Copilot AI review requested due to automatic review settings July 25, 2026 14:39
@dosubot dosubot Bot added size:M This PR changes 30-99 lines ignoring generated files. Bugfix Pull requests that fix bugs labels Jul 25, 2026
@stirlingbot stirlingbot Bot added Front End Issues or pull requests related to front-end development Translation Issues or pull requests related to translation chore Routine tasks or maintenance that don't modify src or test files and removed Bugfix Pull requests that fix bugs labels Jul 25, 2026

Copilot AI 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.

Pull request overview

Removes the crop UI “out-of-bounds” validation/alert path (which could incorrectly trigger on initial open) and introduces a new “default” inset crop-area helper, while also deleting the now-unused crop.error.invalidArea translation key across locales.

Changes:

  • Removed the crop-area validation alert from CropSettings and relaxed crop-area validity checks in the crop parameters hook.
  • Added createDefaultCropArea (10% inset) and exposed resetToDefaultCropArea on the crop parameters hook.
  • Removed crop.error.invalidArea from many locale TOMLs.

Reviewed changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated 44 comments.

File Description
frontend/editor/src/core/utils/cropCoordinates.ts Adds a new helper to generate an inset “default” crop area.
frontend/editor/src/core/hooks/tools/crop/useCropParameters.ts Adjusts crop-area validation and adds a new reset helper for the inset default.
frontend/editor/src/core/components/tools/crop/CropSettings.tsx Removes the invalid-area alert from the crop UI.
frontend/editor/public/locales/*/translation.toml Removes the crop.error.invalidArea key from en-US and many non-en-US locales.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/editor/src/core/utils/cropCoordinates.ts
Comment thread frontend/editor/src/core/utils/cropCoordinates.ts
Comment on lines +33 to 36
/** Reset to default inset crop area inside PDF bounds */
resetToDefaultCropArea: (pdfBounds: PDFBounds) => void;
/** Reset to full PDF dimensions */
resetToFullPDF: (pdfBounds: PDFBounds) => void;
Comment thread frontend/editor/public/locales/en-GB/translation.toml
Comment thread frontend/editor/public/locales/de-DE/translation.toml
Comment on lines 3315 to 3316
[crop.error]
failed = "Obrezovanje PDF-ja ni uspelo"
Comment on lines 3315 to 3316
[crop.error]
failed = "Nije uspelo isecanje PDF-a"
Comment on lines 3315 to 3316
[crop.error]
failed = "Det gick inte att beskära PDF"
Comment thread frontend/editor/public/locales/uk-UA/translation.toml
Comment thread frontend/editor/public/locales/zh-BO/translation.toml
Ludy87
Ludy87 previously approved these changes Aug 4, 2026
@stirlingbot stirlingbot Bot added the has conflicts Pull request has merge conflicts with the base branch label Aug 4, 2026
# Conflicts:
#	frontend/editor/src/core/components/tools/crop/CropSettings.tsx
@stirlingbot stirlingbot Bot removed the has conflicts Pull request has merge conflicts with the base branch label Aug 7, 2026
@balazs-szucs
balazs-szucs requested a review from a team as a code owner August 12, 2026 17:35
@Frooodle
Frooodle merged commit 0b7b4e0 into Stirling-Tools:main Aug 29, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Routine tasks or maintenance that don't modify src or test files Front End Issues or pull requests related to front-end development size:M This PR changes 30-99 lines ignoring generated files. Translation Issues or pull requests related to translation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants