Merge pull request #2019 from LordSk/fix/sr_scrollbar_grab

Fixed scroll region slider being grabbed before specifically clicking on it
This commit is contained in:
oy 2019-02-04 16:43:29 +01:00 committed by GitHub
commit 5b30a168bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2817,7 +2817,7 @@ void CMenus::EndScrollRegion(CScrollRegion* pSr)
{ {
UI()->SetHotItem(pID); UI()->SetHotItem(pID);
if(!UI()->CheckActiveItem(pID) && UI()->MouseButton(0)) if(!UI()->CheckActiveItem(pID) && UI()->MouseButtonClicked(0))
{ {
UI()->SetActiveItem(pID); UI()->SetActiveItem(pID);
pSr->m_MouseGrabStart.y = UI()->MouseY(); pSr->m_MouseGrabStart.y = UI()->MouseY();
@ -2830,7 +2830,7 @@ void CMenus::EndScrollRegion(CScrollRegion* pSr)
UI()->SetActiveItem(0); UI()->SetActiveItem(0);
// move slider // move slider
if(UI()->CheckActiveItem(pID)) if(UI()->CheckActiveItem(pID) && UI()->MouseButton(0))
{ {
float my = UI()->MouseY(); float my = UI()->MouseY();
pSr->m_ScrollY += my - pSr->m_MouseGrabStart.y; pSr->m_ScrollY += my - pSr->m_MouseGrabStart.y;