Browse files

Window: we now allow mouseOver events to controls outside their bounds

we need to compensate for this fact to prevent sending “negative” coordinates that would cause misplaced events
  • Loading branch information...
1 parent b6c1a87 commit edda693dd936542082b6f38603fc45e8fac6b68c @bradallred bradallred committed Dec 30, 2013
Showing with 9 additions and 1 deletion.
  1. +9 −1 gemrb/core/GUI/Window.cpp
View
10 gemrb/core/GUI/Window.cpp
@@ -416,7 +416,15 @@ void Window::OnMouseOver(unsigned short x, unsigned short y)
if (!lastOver) {
return;
}
- lastOver->OnMouseOver( x - XPos - lastOver->XPos, y - YPos - lastOver->YPos );
+ short cx = x - XPos - lastOver->XPos;
+ short cy = y - YPos - lastOver->YPos;
+ if (cx < 0) {
+ cx = 0;
+ }
+ if (cy < 0) {
+ cy = 0;
+ }
+ lastOver->OnMouseOver(cx, cy);
}
}

0 comments on commit edda693

Please sign in to comment.