Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions platform/apple/Sources/LUIAppleBackend/LUISwiftUIRoot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5654,18 +5654,40 @@ private struct LUIOptionalClipModifier: ViewModifier {
}
}

enum LUIGlassShapePolicy {
/// Wire `corner_radius` values that already describe a full pill — the
/// 999 sentinel used by capsule chrome, or any radius at least half the
/// declared height — select `Capsule()` on glass surfaces so Liquid
/// Glass gets capsule geometry instead of a clamped rounded rectangle.
static func isPill(cornerRadius: CGFloat, height: CGFloat?) -> Bool {
cornerRadius >= 999 || height.map { cornerRadius >= $0 / 2 } == true
}
}

private struct LUIBackgroundStyleModifier: ViewModifier {
let name: String?
let color: Color
let shape: AnyShape
let isPill: Bool

@ViewBuilder
func body(content: Content) -> some View {
let glassShape: AnyShape = isPill ? AnyShape(Capsule()) : shape
if name == "glass" {
if #available(iOS 26.0, macOS 26.0, *) {
content.glassEffect(in: shape)
content.glassEffect(.regular.interactive(), in: glassShape)
} else {
content.background(.regularMaterial, in: shape)
content.background(.regularMaterial, in: glassShape)
}
} else if name == "glass-container" {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude glass containers from surface clipping

When glass-container is applied to a row or column used to group child glass surfaces, LUIClipRenderingPolicy still treats the non-transparent background name as visible and the later LUIOptionalClipModifier clips this entire wrapped subtree to a zero-radius rectangle. Child Liquid Glass halos, shadows, or animated fusion reaching the grouping node's bounds will therefore be cut off; special-case this container token as non-painting when deciding whether to clip.

Useful? React with 👍 / 👎.

// `content` is the node's whole subtree, so wrapping it groups
// descendant glass surfaces into one fused Liquid Glass region.
if #available(iOS 26.0, macOS 26.0, *) {
GlassEffectContainer {
content.background(color, in: shape)
}
} else {
content.background(color, in: shape)
}
} else {
content.background(color, in: shape)
Expand Down Expand Up @@ -5777,7 +5799,11 @@ private struct LUISurfaceModifier: ViewModifier {
.modifier(LUIBackgroundStyleModifier(
name: backgroundName,
color: background,
shape: shape
shape: shape,
isPill: model.kind != .avatar && LUIGlassShapePolicy.isPill(
cornerRadius: radius,
height: floored(model.surfaceHeight).map(CGFloat.init)
)
))
.shadow(
color: castsShadow ? .black.opacity(0.12) : .clear,
Expand Down
Loading