feat: add mosaic blur and black shading option#431
Conversation
📝 WalkthroughWalkthroughAdded mosaic blur support with configurable blur types ( Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes this one's got some teeth—lots of heterogeneous changes across component logic, canvas rendering, and data normalization. the AnnotationOverlay canvas work and blurEffects module are logic-dense, and the integration points span multiple files. kinda cursed in the best way. Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bcce473d5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/video-editor/AnnotationOverlay.tsx`:
- Around line 85-90: Replace the ad-hoc blur computations with the shared blur
normalizers: where blurType, blurIntensity and blockSize are computed from
annotation.blurData (the current local blurType, blurOverlayColor,
mosaicGridOverlayColor logic), call the shared normalizer helpers (the same one
used at getNormalizedMosaicBlockSize(...) on the mosaic path) to derive a
normalized blur type, intensity and block size from annotation.blurData; update
the places noted (the initial blurType/blurOverlayColor/mosaicGridOverlayColor,
the code around lines where getNormalizedMosaicBlockSize is used, and the
357-364 preview/exporter code) to use these normalized values instead of raw
fields so malformed/legacy blurData cannot produce inconsistent previews or
exports.
- Around line 19-24: The PreviewCanvasSource type is too loose (accepts any
{width,height}) but is passed to drawImage via
previewSnapshotCanvas/previewSourceCanvas; change the type alias
PreviewCanvasSource to a real canvas type (e.g., HTMLCanvasElement |
OffscreenCanvas | null or CanvasImageSource | null) and update any related
variable declarations (previewSnapshotCanvas, previewSourceCanvas) and usages so
the compiler knows drawImage receives a proper CanvasImageSource; ensure
nullability is handled before calling drawImage (guard or conditional) to avoid
runtime errors.
In `@src/lib/blurEffects.test.ts`:
- Around line 69-78: The test expectation for getBlurOverlayColor is out of sync
with the implementation: update the expected value in the "returns a dark
overlay when black blur color is selected" test to match the function's actual
output (getBlurOverlayColor(..., color: "black", ...)) which currently returns
"rgba(0, 0, 0, 0.56)"; locate the test referencing getBlurOverlayColor and
change the toBe assertion to expect "rgba(0, 0, 0, 0.56)".
🪄 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: f9022223-acac-4920-968e-61b00f0d068c
📒 Files selected for processing (12)
src/components/video-editor/AnnotationOverlay.tsxsrc/components/video-editor/BlurSettingsPanel.tsxsrc/components/video-editor/VideoPlayback.tsxsrc/components/video-editor/projectPersistence.test.tssrc/components/video-editor/projectPersistence.tssrc/components/video-editor/types.tssrc/i18n/locales/en/settings.jsonsrc/i18n/locales/es/settings.jsonsrc/i18n/locales/fr/settings.jsonsrc/lib/blurEffects.test.tssrc/lib/blurEffects.tssrc/lib/exporter/annotationRenderer.ts
👮 Files not reviewed due to content moderation or server errors (8)
- src/i18n/locales/fr/settings.json
- src/components/video-editor/types.ts
- src/i18n/locales/en/settings.json
- src/i18n/locales/es/settings.json
- src/components/video-editor/projectPersistence.ts
- src/components/video-editor/projectPersistence.test.ts
- src/components/video-editor/BlurSettingsPanel.tsx
- src/components/video-editor/VideoPlayback.tsx
Description
This PR enhances the blur annotation workflow by adding:
Motivation
The current blur annotation flow only supports the standard blur effect with limited visual customization.
This change improves flexibility when hiding sensitive information by allowing users to:
It also ensures these settings are preserved correctly in saved projects and rendered properly both in-editor and during export.
Type of Change
Related Issue
#303
Screenshots / Video
Mosaic.blur.mp4
Summary by CodeRabbit
Release Notes
New Features
Localization