From bbfc3fffc0e5f28681ebfb9fc0fd47777fded191 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 16 Nov 2025 23:33:27 -0700 Subject: Scrolling focus thingy --- src/ui.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'src/ui.c') diff --git a/src/ui.c b/src/ui.c index 6fbc250..6cd8d43 100644 --- a/src/ui.c +++ b/src/ui.c @@ -158,18 +158,31 @@ FocusCommand updateFloatingWindowNotMinimized(FloatingWindow* window, if (window->callback != NULL) { Rectangle scissor; - - GuiScrollPanel( - (Rectangle){ - window->rect.x, window->rect.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT, + + // Handle scrolling. + if (window->hasFocus) + { + GuiScrollPanel( + (Rectangle){ + window->rect.x, window->rect.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT, + window->rect.width, + window->rect.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT}, + NULL, + (Rectangle){ + window->rect.x, window->rect.y, + window->contentSize.x, window->contentSize.y}, + &window->scroll, + &scissor); + } + else + { + scissor = (Rectangle){ + window->rect.x, + window->rect.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT, window->rect.width, - window->rect.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT}, - NULL, - (Rectangle){ - window->rect.x, window->rect.y, - window->contentSize.x, window->contentSize.y}, - &window->scroll, - &scissor); + window->rect.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + }; + } bool requireScissor = window->rect.width < window->contentSize.x || window->rect.height < window->contentSize.x; -- cgit v1.2.3