Reapplied scroll workaround

This commit is contained in:
Yousef Khadadeh 2026-01-07 11:05:54 +03:00
parent 850882c8ed
commit 3953fd16f3
3 changed files with 4 additions and 4 deletions

View file

@ -45,7 +45,7 @@ void TreeListing::update(UpdateInputData& io, GUIManager& gui, NetworkingObjects
}
}) {}
}
});
}, false);
}
Clay_ElementData scrollAreaBB = Clay_GetElementData(localID);
if(scrollAreaBB.found) {

View file

@ -669,7 +669,7 @@ void GUIManager::dropdown_select(const std::string& id, size_t* val, const std::
pop_id();
}
void GUIManager::scroll_bar_area(const std::string& id, bool clipHorizontal, const std::function<void(float, float, float&)>& elemUpdate) {
void GUIManager::scroll_bar_area(const std::string& id, bool clipHorizontal, const std::function<void(float, float, float&)>& elemUpdate, bool maxScrollBugWorkaround) {
push_id(id);
CLAY_AUTO_ID({
.layout = {
@ -717,7 +717,7 @@ void GUIManager::scroll_bar_area(const std::string& id, bool clipHorizontal, con
float sAreaDim = scrollData.scrollContainerDimensions.height;
float contDim = scrollData.contentDimensions.height;
float scrollerSize = (sAreaDim / contDim) * sAreaDim;
float scrollPosMax = (contDim - sAreaDim);// + 3.0f; NOTE: Adding + 3.0f to prevent bug with scroller that pushes everything under it when its at the bottom of the scroll area (I think the bug that caused this is fixed now)
float scrollPosMax = (contDim - sAreaDim) + (maxScrollBugWorkaround ? 3.0f : 0.0f); //NOTE: Adding + 3.0f to prevent bug with scroller that pushes everything under it when its at the bottom of the scroll area. Only happens with some scroll areas
float scrollerPos = std::fabs(scrollData.scrollPosition->y / scrollPosMax);
float areaAboveScrollerSize = scrollerPos * (sAreaDim - scrollerSize);

View file

@ -80,7 +80,7 @@ class GUIManager {
void push_id(const std::string& id);
void pop_id();
void scroll_bar_area(const std::string& id, bool clipHorizontal, const std::function<void(float scrollContentHeight, float containerHeight, float& scrollAmount)>& elemUpdate);
void scroll_bar_area(const std::string& id, bool clipHorizontal, const std::function<void(float scrollContentHeight, float containerHeight, float& scrollAmount)>& elemUpdate, bool maxScrollBugWorkaround = true);
void scroll_bar_many_entries_area(const std::string& id, float entryHeight, size_t entryCount, bool clipHorizontal, const std::function<void(size_t elementIndex, bool listHovered)>& entryUpdate, const std::function<void(float scrollContentHeight, float containerHeight, float& scrollAmount)>& elemUpdate = nullptr);
bool input_color_component_255(const std::string& id, float* val, const std::function<void(SelectionHelper&)>& elemUpdate = nullptr);