1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 00:55:20 +02:00

Close formspecs with a single tap outside (#14605)

This commit is contained in:
grorp
2024-05-09 19:16:08 +02:00
committed by GitHub
parent 178591b6d5
commit e0e1d0855d
3 changed files with 90 additions and 55 deletions

View File

@@ -4740,6 +4740,8 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
list_selected->changeItem(m_selected_item->i, stack_from);
}
bool absorb_event = false;
// Possibly send inventory action to server
if (move_amount > 0) {
// Send IAction::Move
@@ -4882,6 +4884,10 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
a->from_i = m_selected_item->i;
m_invmgr->inventoryAction(a);
// Formspecs usually close when you click outside them, we absorb
// the event to prevent that. See GUIModalMenu::remapClickOutside.
absorb_event = true;
} else if (craft_amount > 0) {
assert(s.isValid());
@@ -4911,6 +4917,9 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
m_selected_dragging = false;
}
m_old_pointer = m_pointer;
if (absorb_event)
return true;
}
if (event.EventType == EET_GUI_EVENT) {