aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy_ui.c
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-22 19:19:14 -0400
committeriamcheeseman <[email protected]>2026-05-22 19:19:14 -0400
commit77d193cdd127714ce4eab73d7a11a155655b7678 (patch)
tree7e8f8cee1495206c4df2fe3d62ef9841e7eb81f8 /teensy/teensy_ui.c
parent2d5c6f38f73453e4b1185017ff01b02f095a5db0 (diff)
fix elements getting clipped with size <0
Diffstat (limited to 'teensy/teensy_ui.c')
-rw-r--r--teensy/teensy_ui.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/teensy/teensy_ui.c b/teensy/teensy_ui.c
index 8449417..13993f0 100644
--- a/teensy/teensy_ui.c
+++ b/teensy/teensy_ui.c
@@ -133,6 +133,7 @@ void clip_cmd(ty_Recti rect)
{
Cmd cmd = {};
cmd.kind = CMD_CLIP;
+
if (rect.w < 0 || rect.h < 0)
rect = window()->rect; // This is a full screen clip
@@ -198,6 +199,9 @@ ty_Recti next_rect(int height)
x += window()->rect.x;
y += window()->rect.y;
+ width = ty_max(width, 0);
+ height = ty_max(height, 0);
+
l->x += width + padding();
advance_layout();