mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
gui: Fix in parameter for scroll events
Refetch mouse position before checking if mouse is in widget Rect Give acurate position of the mouse when scrolling
This commit is contained in:
parent
9d62a2f0a1
commit
6a3c2d3071
@ -274,8 +274,11 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
|
||||
for(auto i=hlp.begin(); i != hlp.end() && current; i++)
|
||||
{
|
||||
if(!vstd::contains(wheelInterested,*i)) continue;
|
||||
(*i)->wheelScrolled(sEvent->wheel.y < 0, isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y));
|
||||
}
|
||||
// SDL doesn't have the proper values for mouse positions on SDL_MOUSEWHEEL, refetch them
|
||||
int x = 0, y = 0;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
(*i)->wheelScrolled(sEvent->wheel.y < 0, isItIn(&(*i)->pos, x, y));
|
||||
}
|
||||
}
|
||||
else if(sEvent->type == SDL_TEXTINPUT)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user