diff options
| -rw-r--r-- | dc/dc.c | 12 | ||||
| -rw-r--r-- | teensy/teensy_math.c | 2 | ||||
| -rw-r--r-- | teensy/teensy_ui.c | 4 |
3 files changed, 13 insertions, 5 deletions
@@ -98,11 +98,13 @@ void tick(void) tyui_slider_ex(0, 100, &value, true, TYUI_ALIGN_RIGHT); tyui_blank_slider(0, 100, &value); - tyui_push_layout((float[]){-50, -1, 0}); - tyui_button("abc"); - tyui_button("xyz"); - tyui_button("abc"); - tyui_button("xyz"); + tyui_push_layout((float[]){50, -1, 0}); + tyui_slider(0, 100, &value); + if (tyui_button("inc")) + value++; + tyui_slider(0, 100, &value); + if (tyui_button("dec")) + value--; tyui_pop_layout(); tyui_end_window(); diff --git a/teensy/teensy_math.c b/teensy/teensy_math.c index 9247bd0..18e95f4 100644 --- a/teensy/teensy_math.c +++ b/teensy/teensy_math.c @@ -24,7 +24,9 @@ ty_Recti ty_recti_shrink(ty_Recti rect, int p) rect.x += p; rect.y += p; rect.w -= p * 2; + rect.w = ty_max(rect.w, 0); rect.h -= p * 2; + rect.h = ty_max(rect.h, 0); return rect; } 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(); |
