fix: preserve window corner radii in preview overlay#1084
fix: preserve window corner radii in preview overlay#1084william-laverty wants to merge 2 commits intoMrKai77:developfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `inset(by:minRadius:)` method has zero callers after removing its sole call site in PreviewView. The other `inset` calls in the codebase use SwiftUI's built-in `InsettableShape.inset(by:)`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MrKai77
left a comment
There was a problem hiding this comment.
Firstly, please make sure to follow both our issue and PR templates; they both currently don’t adhere to Loop’s emoji conventions, and you are required to disclose any AI usage and how it's been tested :)
Secondly, your issue describes:
inset(by: previewPadding)collapses corner radii to 0 — Typical macOS windows have corner radii of ~10px. The defaultpreviewPaddingis also 10px. Theinset(by:)function inRectangleCornerRadii+Extensions.swiftcomputesmax(10 - 10, 0) = 0, eliminating the corner radius entirely.- The slider fallback never fires — The
??nil-coalescing only falls back to the "Default corner radius" slider value whenoverrideCornerRadiiisnil. But it's not nil — it's a validRectangleCornerRadiithat has been inset to all zeros. So the slider is completely ignored whenever the window has any non-zero corner radii.
That said, this behavior is intentional. The nil-coalescing should only apply when we fail to retrieve the window’s corner radius via SkyLight. In this case, the retrieval succeeds, and the value is just later reduced to 0 (which is where it looks visually displeasing). I left another comment on the PR, but here’s how I’d approach it:
Since 0pt corner radii are really the only case that looks off, it would make sense to keep the current insetting logic relative to the preview padding, but add an additional check. If the computed override results in a 0pt radius, we should then Loop should fall back to the default corner radius.
Let me know if that doesn’t make sense!
|
|
||
| private var cornerRadii: RectangleCornerRadii { | ||
| viewModel.overrideCornerRadii?.inset(by: previewPadding) ?? RectangleCornerRadii( | ||
| viewModel.overrideCornerRadii ?? RectangleCornerRadii( |



Change Summary
Fixed the preview overlay rendering with sharp corners (radius 0) when "Prioritize selected window's corner radius" is enabled on macOS 26+. The preview now correctly displays the selected window's actual corner radii, and the "Default corner radius" slider properly serves as a fallback when window radii are unavailable.
Changes
Fixes #1083:
inset(by: previewPadding)call from thecornerRadiicomputed property inPreviewView.swiftwhich was subtracting the padding value (~10px) from the window's actual corner radii (~10px), collapsing them to 0overrideCornerRadiiis nil (toggle off, pre-macOS 26, or window radii unavailable), rather than being permanently bypassed by a non-nil but zeroed-out resultRectangleCornerRadii+Extensions.swift— theinset(by:minRadius:)extension now has zero callers (the otherinsetcalls in the codebase are SwiftUI's built-inInsettableShape.inset(by:)onRoundedRectangle, not this custom extension)