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:
Sandy Carter
2015-08-22 12:40:14 -04:00
parent 9d62a2f0a1
commit 6a3c2d3071
+5 -2
View File
@@ -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)
{