From 5e195cf0295e95b1ba7e5bd3f350743bb8dad535 Mon Sep 17 00:00:00 2001 From: Yousef Khadadeh Date: Fri, 1 May 2026 10:10:59 +0300 Subject: [PATCH] Fixed issue with similar scroll areas not having scrollbars --- CMakeLists.txt | 1 - .../Layers/DrawingProgramLayerManagerGUI.cpp | 2 -- src/GUIStuff/ElementHelpers/ScrollAreaHelpers.cpp | 10 ---------- src/GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp | 10 ---------- src/GUIStuff/GUIManager.cpp | 1 + src/Screens/FileSelectScreen.cpp | 2 -- src/Screens/PhoneDrawingProgramScreen.cpp | 3 --- 7 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 src/GUIStuff/ElementHelpers/ScrollAreaHelpers.cpp delete mode 100644 src/GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 23c5c51..2ccedec 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,6 @@ set(sources "src/main.cpp" "src/GUIStuff/ElementHelpers/TextLabelHelpers.cpp" "src/GUIStuff/ElementHelpers/RadioButtonHelpers.cpp" "src/GUIStuff/ElementHelpers/CheckBoxHelpers.cpp" - "src/GUIStuff/ElementHelpers/ScrollAreaHelpers.cpp" "include/Helpers/Networking/NetLibrary.cpp" "include/Helpers/Networking/NetServer.cpp" "include/Helpers/Networking/NetClient.cpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp b/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp index e722281..5791a20 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp @@ -13,7 +13,6 @@ #include "../../GUIStuff/ElementHelpers/LayoutHelpers.hpp" #include "../../GUIStuff/ElementHelpers/TextBoxHelpers.hpp" #include "../../GUIStuff/ElementHelpers/NumberSliderHelpers.hpp" -#include "../../GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp" #include "../../GUIStuff/Elements/SVGIcon.hpp" #include "../../GUIStuff/Elements/DropDown.hpp" @@ -61,7 +60,6 @@ void DrawingProgramLayerManagerGUI::setup_list_gui() { nameToEdit.clear(); } else { - SCROLL_AREA_BUG_WORKAROUND(); gui.element("list", TreeListing::Data { .selectedIndices = &selectedLayerIndices, .dirInfo = [&](const TreeListingObjIndexList& objIndex) -> std::optional { diff --git a/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.cpp b/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.cpp deleted file mode 100644 index d48fa78..0000000 --- a/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "ScrollAreaHelpers.hpp" -#include - -namespace GUIStuff { namespace ElementHelpers { - -void SCROLL_AREA_BUG_WORKAROUND() { - CLAY_AUTO_ID({}){} -} - -}} diff --git a/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp b/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp deleted file mode 100644 index d29d85c..0000000 --- a/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp +++ /dev/null @@ -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(); - -}} diff --git a/src/GUIStuff/GUIManager.cpp b/src/GUIStuff/GUIManager.cpp index 1e5bb80..40ce8d5 100644 --- a/src/GUIStuff/GUIManager.cpp +++ b/src/GUIStuff/GUIManager.cpp @@ -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(); diff --git a/src/Screens/FileSelectScreen.cpp b/src/Screens/FileSelectScreen.cpp index 267b447..1d967a6 100644 --- a/src/Screens/FileSelectScreen.cpp +++ b/src/Screens/FileSelectScreen.cpp @@ -11,7 +11,6 @@ #include "../GUIStuff/Elements/SVGIcon.hpp" #include "../GUIStuff/Elements/TextParagraph.hpp" #include "../GUIStuff/ElementHelpers/LayoutHelpers.hpp" -#include "../GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp" #include "../GUIStuff/Elements/PositionAdjustingPopupMenu.hpp" #include "../World.hpp" #include "Helpers/StringHelpers.hpp" @@ -684,7 +683,6 @@ void FileSelectScreen::file_view() { }; if(fileViewType == FileViewType::LIST) { - SCROLL_AREA_BUG_WORKAROUND(); fileViewScrollArea = gui.element("File selector list", ManyElementScrollArea::Options{ .entryHeight = 150.0f, .entryCount = fileList.size(), diff --git a/src/Screens/PhoneDrawingProgramScreen.cpp b/src/Screens/PhoneDrawingProgramScreen.cpp index 235d1e2..cbfb65a 100644 --- a/src/Screens/PhoneDrawingProgramScreen.cpp +++ b/src/Screens/PhoneDrawingProgramScreen.cpp @@ -6,7 +6,6 @@ #include "../GUIStuff/ElementHelpers/ButtonHelpers.hpp" #include "../GUIStuff/ElementHelpers/LayoutHelpers.hpp" #include "../GUIStuff/ElementHelpers/TextLabelHelpers.hpp" -#include "../GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp" #include "FileSelectScreen.hpp" #include @@ -118,11 +117,9 @@ void PhoneDrawingProgramScreen::bottom_toolbar() { tool_settings_popup(); break; case SettingsMenuPopup::FG_COLOR: - SCROLL_AREA_BUG_WORKAROUND(); color_settings_popup(&main.toolConfig.globalConf.foregroundColor); break; case SettingsMenuPopup::BG_COLOR: - SCROLL_AREA_BUG_WORKAROUND(); color_settings_popup(&main.toolConfig.globalConf.backgroundColor); break; }