Skip to content

feat(editor): add pixel X / Y / Width / Height fields to the crop - #1389

Draft
0xmyst3ry wants to merge 1 commit into
getopenscreen:mainfrom
0xmyst3ry:feat/precise-crop-inputs
Draft

0xmyst3ry wants to merge 1 commit into
getopenscreen:mainfrom
0xmyst3ry:feat/precise-crop-inputs

Conversation

@0xmyst3ry

@0xmyst3ry 0xmyst3ry commented Oct 25, 2026 •

Copy link
Copy Markdown

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.

  • The fields show the crop rounded to whole pixels of the source frame and follow the handles and the keyboard. Typing in a field updates the same crop draft the handles use, so the preview and Apply see it right away.
  • A typed value is rounded to a pixel and clamped so the crop stays inside the frame and no side goes under the 4% minimum the handles already use. The other three fields keep their exact stored values (no re-quantizing).
  • A field can be cleared and retyped; it shows the clamped value again on blur. The fields are labelled, tab-reachable, and step with the arrow keys within the allowed range.
  • A typed width or height re-detects the ratio preset, so a preset (say 1:1) no longer stays highlighted when the shape has changed.
  • The fields stay disabled until the preview video reports its pixel size.
  • The clamp and the percent/pixel conversion are pure helpers in 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

  • Feature

Release impact

  • Minor

Desktop impact

  • Not platform-specific

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 --noEmit and npx tsc -p tsconfig.test.json --noEmit: clean.
  • npm run lint: no new warnings (26, same as main). 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.
  • Not verified visually or in the running app.

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.
@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

[Feature]: More precise cropping controls

1 participant