forked from Mirrorlandia_minetest/minetest
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:
|
case EET_MOUSE_INPUT_EVENT:
|
||||||
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
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);
|
setPressed(true);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user