Add a workaround to a scroll area bug

This commit is contained in:
Yousef Khadadeh 2026-04-30 19:17:21 +03:00
parent 91ff487edd
commit 7437ecdae6
5 changed files with 26 additions and 0 deletions

View file

@ -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"

View file

@ -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<TreeListing>("list", TreeListing::Data {
.selectedIndices = &selectedLayerIndices,
.dirInfo = [&](const TreeListingObjIndexList& objIndex) -> std::optional<TreeListing::DirectoryInfo> {

View file

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

View file

@ -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();
}}

View file

@ -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 <Helpers/Logger.hpp>
@ -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;
}