Repository navigation
Conversation
The Edit clip dialog could only crop by dragging handles. Add four number fields (X, Y, Width, Height) in source pixels under the ratio row. They show the crop as whole pixels of the source frame, follow the handles and the arrow keys, and write back to the same crop draft when typed into, rounded to a pixel and clamped to the frame. The clamp and the percent/pixel conversion are pure helpers in cropDraft.ts with unit tests. A typed width or height re-detects the ratio preset, so a preset no longer claims a shape the crop does not have. Labels are added to all 15 locales.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. Comment |
This branch has not been deployed
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.
Summary
The crop in the Edit clip dialog can only be set by dragging handles (or the arrow keys), which is hard to do exactly on a small area. This adds four number fields under the ratio row: X, Y, Width and Height, in source pixels.
cropDraft.ts. Four new labels are added to every locale.This covers the "exact pixel values" idea in the issue. Magnified cropping or cropping in the main view would be separate work.
Related issue
Closes #1178
Type of change
Release impact
Desktop impact
Screenshots / video
None. I could not run the Electron app here (its binary was not installed), so I have not seen the new row in the dialog. Layout and spacing are unchecked; the dialog's height with the extra row in particular should be looked at.
Testing
npx vitest --run src/components/ai-edition/cropDraft.test.ts src/components/ai-edition/EditClipModal.test.tsx: 34 passed. New tests cover the clamp and conversion helpers, and the dialog with a stubbed 1920x1080 source: typing, clamping on blur, clearing and retyping, following the keyboard, the ratio preset dropping, and the fields being disabled with no video.npx tsc --noEmitandnpx tsc -p tsconfig.test.json --noEmit: clean.npm run lint: no new warnings (26, same asmain).npm run i18n:check: passed.npm run test: I ran it on Node 26 without the Electron binary, so 262 tests fail both with and without this change (localStorage-based suites and Electron-dependent ones). With the change, 16 more tests pass and nothing new fails. CI on Node 22 is the real check.