Repository navigation
feat(gpui): platform safe zones on the preview - #2782
YoavLevavi wants to merge 7 commits into
Conversation
A toolbar button cycles Off / Reels / TikTok / Shorts and shades the parts of a portrait preview that the platform's UI covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@YoavLevavi is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the GPUI port @YoavLevavi, keeping this preview-only and out of the project config is the right call. Two small things: 1) |
The button is hidden when the output isn't portrait, so it can no longer sit in a pressed state that draws nothing. The overlay's shade, border and label come from theme.editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @YoavLevavi, both points are addressed: the Safe zones toggle only shows for portrait output and the overlay uses the theme colours now. This looks good to go. One tiny thing before merge: the |
|
Thanks @richiemcilroy, both addressed in 348faa8:
|
|
@greptileai review |
| let player = self.player_frame_rect.get()?; | ||
| let (fw, fh) = ( | ||
| f32::from(player.frame.size.width), | ||
| f32::from(player.frame.size.height), | ||
| ); | ||
| let origin_x = player.frame.origin.x - player.container.origin.x; | ||
| let origin_y = player.frame.origin.y - player.container.origin.y; |
There was a problem hiding this comment.
Guides keep old preview bounds
render_safe_zone_overlay sizes its guides from the previous paint's player_frame_rect. When the preview changes size, these fixed pixel bounds are built before PreviewFrameView paints and updates the rectangle. That update does not request another render, so the guides can stay out of line with the video until another editor update. Calculate the guides from the current layout bounds instead.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/safe_zones.rs
Line: 107-113
Comment:
**Guides keep old preview bounds**
`render_safe_zone_overlay` sizes its guides from the previous paint's `player_frame_rect`. When the preview changes size, these fixed pixel bounds are built before `PreviewFrameView` paints and updates the rectangle. That update does not request another render, so the guides can stay out of line with the video until another editor update. Calculate the guides from the current layout bounds instead.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| /// The button only exists for portrait output; on any other aspect there | ||
| /// is nothing for it to draw. |
There was a problem hiding this comment.
The new comment above render_safe_zone_button only repeats its portrait check. AGENTS.md requires comments to explain non-obvious context, not narrate what the code does. Remove this comment and the similar description above safe_zone_rect before merging to satisfy that requirement. Keep the useful explanation of the platform inset assumptions.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/safe_zones.rs
Line: 74-75
Comment:
**Comments repeat the code**
The new comment above `render_safe_zone_button` only repeats its portrait check. `AGENTS.md` requires comments to explain non-obvious context, not narrate what the code does. Remove this comment and the similar description above `safe_zone_rect` before merging to satisfy that requirement. Keep the useful explanation of the platform inset assumptions.
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Thanks @YoavLevavi. After updating the branch with main, Greptile's review came back 4/5 with two points, and both are fair:
Once those are pushed, mention @greptileai to re-review. It needs 5/5 with green CI for us to merge. Thanks! |
|
Both points are valid: the overlay uses cached I can’t edit or push the branch from this review thread—the available repository tools are read-only. Please make those changes and push them; then ping |
The overlay is a canvas that fits the frame inside its own bounds during paint, with the same preview_frame_bounds the preview uses, so the guides follow a resize in the same frame instead of last paint's rect. Drops the comments that restated the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @richiemcilroy, both are done in 6b06aaa (on top of your merge and the latest main):
@greptileai review |
# Conflicts: # apps/desktop-gpui/src/assets.rs
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
GPUI port of #2380.
A toolbar button cycles Off / Reels / TikTok / Shorts and shades the parts of a portrait preview that the platform's UI covers (captions, buttons, account row). Only shown for portrait output (width/height ≤ 0.7). Insets are guidance for a 1080x1920 frame.
Testing: new unit tests in
editor_window/safe_zones.rs,cargo checkinapps/desktop-gpui.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; both previous findings are addressed.Summary
Adds preview-only safe zones for Reels, TikTok, and Shorts on portrait output.
Reviews (2) · Last reviewed commit: "Safe zones: lay the guides out from the ..." · Reviewed by Greptile