diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ccedec..23c5c51 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,6 +140,7 @@ 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 5791a20..e722281 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp @@ -13,6 +13,7 @@ #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" @@ -60,6 +61,7 @@ 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 new file mode 100644 index 0000000..d48fa78 --- /dev/null +++ b/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.cpp @@ -0,0 +1,10 @@ +#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 new file mode 100644 index 0000000..d29d85c --- /dev/null +++ b/src/GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp @@ -0,0 +1,10 @@ +#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/Screens/PhoneDrawingProgramScreen.cpp b/src/Screens/PhoneDrawingProgramScreen.cpp index cbfb65a..235d1e2 100644 --- a/src/Screens/PhoneDrawingProgramScreen.cpp +++ b/src/Screens/PhoneDrawingProgramScreen.cpp @@ -6,6 +6,7 @@ #include "../GUIStuff/ElementHelpers/ButtonHelpers.hpp" #include "../GUIStuff/ElementHelpers/LayoutHelpers.hpp" #include "../GUIStuff/ElementHelpers/TextLabelHelpers.hpp" +#include "../GUIStuff/ElementHelpers/ScrollAreaHelpers.hpp" #include "FileSelectScreen.hpp" #include @@ -117,9 +118,11 @@ 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; }