Repository navigation
feat(crop): the picked ratio carries on through a batch (#542) - #581
Merged
KnifeLemon merged 2 commits intoOct 25, 2026
Merged
Conversation
…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.
Collaborator
Author
|
@KnifeLemon, CI is green on every check here. When you have reviewed it, could you merge it into main? |
KnifeLemon
approved these changes
Oct 25, 2026
KnifeLemon
left a comment
Owner
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
How:
CropOverlayViewModelkeeps the batch's ratio and orientation; picking on the dial, cycling and swapping set it, and Reset clears it.CropMath.Centeredgives the largest centred frame of a ratio on a picture, in parts of the picture. The view model passes it to the canvas throughResetRequested, so the frame is right even before the new picture has been laid out.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_alikereplaces 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-changesis clean.dotnet test: Platform 81, Core 602, CLI 30, Setup 181 and Engines 1822 pass, and App passes 1370 of 1371. The one failure wasMemoryTrimmerTests.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.