mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Formspec: Don't start a button click when the pointer isn't on top (#9332)
This commit is contained in:
parent
0877587cce
commit
3dfb6ecbb2
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user