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

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