Fix ScrollableWindowComponents buggy behavior when clicking the down arrow button causing the list to scroll all the way to the bottom. Release Build 10067.

This commit is contained in:
sigonasr2 2024-07-16 05:19:46 -05:00
parent c80ec17999
commit 6becdd4f6b
3 changed files with 3 additions and 5 deletions

View File

@ -188,8 +188,6 @@ protected:
vf2d windowAbsPos=Menu::menus[parentMenu]->pos+rect.pos;
bool mouseOverScrollbar=geom2d::overlaps(geom2d::rect<float>(windowAbsPos+vf2d{rect.size.x-12,scrollBarTop+12},{12,scrollBarHeight}),game->GetMousePos());
auto ScrollToClickedPosition=[&](){
float spaceBetweenTopAndBottomArrows=rect.size.y-24;
float viewHeight=rect.size.y;
@ -202,7 +200,7 @@ protected:
SetScrollAmount({GetScrollAmount().x,(-newScrollbarTop+1)/scrollBarScale});
};
if(mouseOverScrollbar||scrollBarSelected){
if(scrollBarSelected){
scrollBarHoverTime=std::min(scrollBarHoverTime+game->GetElapsedTime(),"ThemeGlobal.HighlightTime"_F);
if(game->GetMouse(0).bPressed&&!geom2d::contains(rect,bounds)){
scrollBarSelected=true;
@ -220,7 +218,7 @@ protected:
scrollBarHoverTime=std::max(scrollBarHoverTime-game->GetElapsedTime(),0.f);
//It's possible to still scroll by clicking outside the scrollbar but in the scroll region.
if(game->GetMouse(0).bHeld&&!geom2d::contains(rect,bounds)&&
geom2d::overlaps(geom2d::rect<float>(windowAbsPos+vf2d{rect.size.x-12.f,12.f},{12.f,rect.size.y-12.f}),game->GetMousePos())){
geom2d::overlaps(geom2d::rect<float>(windowAbsPos+vf2d{rect.size.x-12.f,12.f},{12.f,rect.size.y-24.f}),game->GetMousePos())){
ScrollToClickedPosition();
scrollBarSelected=true;
Menu::menus[parentMenu]->alreadyClicked=true;

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 10061
#define VERSION_BUILD 10067
#define stringify(a) stringify_(a)
#define stringify_(a) #a