Skip to content

Commit 2d9d83d

Browse files
wash2Drakulix
authored andcommitted
fix(corner-radius): guard against corner radius being too large
1 parent f01ebf2 commit 2d9d83d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/shell/element/surface.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,15 @@ impl CosmicSurface {
141141

142142
let guard = corners.lock().unwrap();
143143

144+
let size = <CosmicSurface as SpaceElement>::geometry(self).size;
145+
// guard against corner radius being too large, potentially disconnecting the outline
146+
let half_min_dim = u8::try_from(size.w.min(size.h) / 2).unwrap_or(u8::MAX);
147+
144148
Some([
145-
guard.top_right,
146-
guard.bottom_right,
147-
guard.top_left,
148-
guard.bottom_left,
149+
guard.top_right.min(half_min_dim),
150+
guard.bottom_right.min(half_min_dim),
151+
guard.top_left.min(half_min_dim),
152+
guard.bottom_left.min(half_min_dim),
149153
])
150154
})
151155
})

0 commit comments

Comments
 (0)