Fixed issue with similar scroll areas not having scrollbars

This commit is contained in:
Yousef Khadadeh 2026-05-01 10:10:59 +03:00
parent 151c3f9bed
commit 5e195cf029
7 changed files with 1 additions and 28 deletions

View file

@ -1,10 +0,0 @@
#include "ScrollAreaHelpers.hpp"
#include <clay.h>
namespace GUIStuff { namespace ElementHelpers {
void SCROLL_AREA_BUG_WORKAROUND() {
CLAY_AUTO_ID({}){}
}
}}

View file

@ -1,10 +0,0 @@
#pragma once
namespace GUIStuff { namespace ElementHelpers {
// FIXME: Currently, when two scroll areas in popups are created in the "same place" (different ids), only the first scroll area that's displayed will
// have scrolling capabilities, while the second scroll area wont get any scroll data (Clay_GetScrollContainerData gives 0s for content and container dimensions)
// We can workaround this by adding invisible padding to the second scroll area (which is what this function does), but ideally this should be fixed later
void SCROLL_AREA_BUG_WORKAROUND();
}}

View file

@ -559,6 +559,7 @@ void GUIManager::layout() {
#ifdef CLAY_DEBUG_MENU_ENABLED
Clay_SetPointerState({io.input->mouse.pos.x(), io.input->mouse.pos.y()}, io.input->mouse.leftDown);
#endif
Clay_UpdateScrollContainers(false, {0, 0}, 0.1f); // Important regardless if scroll position is updated with Clay or not
constexpr int LAYOUT_RUN_COUNT = 6;
for(int i = 0; i < LAYOUT_RUN_COUNT; i++)
single_layout_run();