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

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

View file

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

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

View file

@ -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<ManyElementScrollArea>("File selector list", ManyElementScrollArea::Options{
.entryHeight = 150.0f,
.entryCount = fileList.size(),

View file

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