Skip to content

feat(crop): the picked ratio carries on through a batch (#542) - #581

Merged
KnifeLemon merged 2 commits into
KnifeLemon:mainfrom
cre8ive-marketing:feat/542-batch-ratio
Oct 25, 2026
Merged

KnifeLemon merged 2 commits into
KnifeLemon:mainfrom
cre8ive-marketing:feat/542-batch-ratio

Conversation

@cre8ive-marketing

Copy link
Copy Markdown
Collaborator

Part 1 of the #542 follow-ups, as agreed there (after #543).

What it does

The ratio picked for one picture carries on to the next pictures of the batch, so a batch for Instagram picks 4:5 once:

  • The next picture starts at the same ratio and orientation (4:5 stays upright), with the frame as large as that ratio fits, centred. Only a move is left.
  • R (Reset) goes back to Free, for this picture and the next ones.
  • A batch that never picked a ratio still starts every picture at Free, on the whole picture, as before.
  • "Original" carries as "each picture's own ratio", so its frame is the whole picture.

How:

  • CropOverlayViewModel keeps the batch's ratio and orientation; picking on the dial, cycling and swapping set it, and Reset clears it.
  • CropMath.Centered gives the largest centred frame of a ratio on a picture, in parts of the picture. The view model passes it to the canvas through ResetRequested, so the frame is right even before the new picture has been laid out.
  • No settings and no new strings: it lasts while the crop window is open.

Tests

  • CropMathTests.A_carried_ratio_starts_as_the_largest_centred_frame: 4:5 on landscape, 16:9 on upright, the picture's own ratio and free.
  • CropOverlayTests.The_next_file_keeps_the_chosen_ratio_as_large_as_it_fits_centred_in_view_and_canvas_alike replaces the old "next file starts free" test: 9:16 carries to an upright 1000 × 1600 picture as a 900 × 1600 frame in the middle, in the view model and the canvas alike.
  • CropOverlayTests.A_batch_starts_free_until_a_ratio_is_picked_and_again_after_reset.
  • dotnet format --verify-no-changes is clean.
  • Full dotnet test: Platform 81, Core 602, CLI 30, Setup 181 and Engines 1822 pass, and App passes 1370 of 1371. The one failure was MemoryTrimmerTests.A_new_request_moves_the_trim_on, a timing test, while two suites ran side by side; it passes 3 of 3 alone, and this PR doesn't touch it.

The custom W:H slice comes in its own PR next.

…emon#542)

A batch for Instagram picks 4:5 once: the next picture starts at the same ratio and orientation, as large as it fits and centred, so only a move is left. R (Reset) goes back to Free for this picture and the next; a batch that never picked a ratio still starts each picture at Free.
@cre8ive-marketing

Copy link
Copy Markdown
Collaborator Author

@KnifeLemon, CI is green on every check here. When you have reviewed it, could you merge it into main?

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @cre8ive-marketing, this matches the plan in #542 exactly. The ratio and its orientation carry over, the next frame starts as large as fits and centred, R goes back to Free for this picture and the ones after, and a batch that never picked a ratio stays Free. CropMath.Centered is small and well covered, and splitting the old test into "keeps the ratio" plus "Free until picked, Free again after R" covers both sides. Skip goes through LoadFileAsync too, so skipping a picture doesn't lose the ratio. CI is green. Looking forward to the custom W:H slice.

@KnifeLemon
KnifeLemon merged commit 3471d65 into KnifeLemon:main Oct 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants