Skip to content

Commit

Permalink
Formspec: Don't start a button click when the pointer isn't on top (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Df458 authored and nerzhul committed Jan 22, 2020
1 parent 0877587 commit 3dfb6ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/guiButton.cpp
Expand Up @@ -203,8 +203,12 @@ bool GUIButton::OnEvent(const SEvent& event)
case EET_MOUSE_INPUT_EVENT:
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{
if (!IsPushButton)
// Sometimes formspec elements can receive mouse events when the
// mouse is outside of the formspec. Thus, we test the position here.
if ( !IsPushButton && AbsoluteClippingRect.isPointInside(
core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y ))) {
setPressed(true);
}

return true;
}
Expand Down

0 comments on commit 3dfb6ec

Please sign in to comment.