Add webcam mirror toggle#633
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
✅ Files skipped from review due to trivial changes (6)
📝 WalkthroughWalkthroughPR implements horizontal webcam mirroring across the entire app: adds a mirror toggle to SettingsPanel, threads the setting through editor state and project persistence, applies live preview mirroring via CSS transform in VideoPlayback, and exports mirrored frames via a new canvas utility in GIF and MP4 outputs. ChangesWebcam Mirroring Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/video-editor/SettingsPanel.tsx`:
- Around line 1194-1199: The "Mirror webcam" label and its aria-label are
hardcoded; replace both with your i18n lookup (e.g., use the t function from
your translation hook) so the text and aria-label are localized. In
SettingsPanel (where webcamMirrored and onWebcamMirroredChange are used) change
"Mirror webcam" to something like t('settings.mirrorWebcam') and the Switch
aria-label to t('settings.mirrorWebcamAria') (and add those keys to the locale
files), ensuring you import/use the existing translation hook (e.g., const { t }
= useTranslation()) in the component.
In `@src/lib/exporter/webcamFrameDrawing.ts`:
- Around line 20-26: The mirrored branch in webcamFrameDrawing uses ctx.save(),
ctx.translate(...), ctx.scale(...), ctx.drawImage(...), then ctx.restore(); but
if drawImage throws the transform leaks—wrap the transform and draw in a
try/finally so ctx.restore() always runs; specifically locate the mirrored
handling block that calls ctx.save(), ctx.translate, ctx.scale and ctx.drawImage
and ensure restore() is invoked in finally before returning from the function.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 25b5b6c5-a18f-4633-ab71-fa740eb019d9
📒 Files selected for processing (12)
src/components/video-editor/SettingsPanel.tsxsrc/components/video-editor/VideoEditor.tsxsrc/components/video-editor/VideoPlayback.tsxsrc/components/video-editor/projectPersistence.test.tssrc/components/video-editor/projectPersistence.tssrc/components/video-editor/types.tssrc/hooks/useEditorHistory.tssrc/lib/exporter/frameRenderer.test.tssrc/lib/exporter/frameRenderer.tssrc/lib/exporter/gifExporter.tssrc/lib/exporter/videoExporter.tssrc/lib/exporter/webcamFrameDrawing.ts
Fixes #632.
Added a Mirror webcam switch in the editor layout panel. When it is on, the webcam flips in the preview and the same flip is used during GIF/MP4 export, so the saved file matches what you see while editing.
Tested locally:
One note: full
npm run lintstill hits existing formatter/line-ending errors in untouched repo files, so I kept the check scoped to the files changed here.Summary by CodeRabbit
New Features
Localization