From aea47b3afeaa5792bc8e625af679e0b04d89a342 Mon Sep 17 00:00:00 2001 From: Maksim Date: Sat, 9 Apr 2022 12:40:04 +0200 Subject: [PATCH] TouchScreenGUI: minor fixes --- src/client/game.cpp | 2 +- src/gui/guiFormSpecMenu.cpp | 20 ++++++++------------ src/gui/modalMenu.cpp | 4 +++- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/client/game.cpp b/src/client/game.cpp index bb5a1e577..72d0e238c 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -3633,7 +3633,7 @@ void Game::handlePointingAtObject(const PointedThing &pointed, bool nohit_enabled = ((ItemGroupList) playeritem_def.groups)["nohit"] != 0; #ifdef HAVE_TOUCHSCREENGUI - if (isKeyDown(KeyType::PLACE) && !nohit_enabled) { + if (wasKeyPressed(KeyType::PLACE) && !nohit_enabled) { #else if (isKeyDown(KeyType::DIG) && !nohit_enabled) { #endif diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 79045a3d1..ea5167ff4 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -3789,10 +3789,6 @@ void GUIFormSpecMenu::showTooltip(const std::wstring &text, tooltip_offset_y = 0; if (m_pointer.X > (s32)screenSize.X / 2) tooltip_offset_x = -(tooltip_offset_x + tooltip_width); - - // Hide tooltip after ETIE_LEFT_UP - if (m_pointer.X == 0) - return; #endif // Calculate and set the tooltip position @@ -4335,14 +4331,8 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) count = MYMIN(s_count, 10); else if (button == BET_WHEEL_DOWN) count = 1; - else { // left -#ifdef HAVE_TOUCHSCREENGUI - if (s.listname == "craft") - count = 1; - else -#endif + else // left count = s_count; - } if (!event.MouseInput.Shift) { // no shift: select item @@ -4363,8 +4353,14 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) move_amount = 1; else if (button == BET_MIDDLE) move_amount = MYMIN(m_selected_amount, 10); - else if (button == BET_LEFT) + else if (button == BET_LEFT) { +#ifdef HAVE_TOUCHSCREENGUI + if (s.listname == "craft") + move_amount = 1; + else +#endif move_amount = m_selected_amount; + } // else wheeldown if (identical) { diff --git a/src/gui/modalMenu.cpp b/src/gui/modalMenu.cpp index 169716180..ef3c3bace 100644 --- a/src/gui/modalMenu.cpp +++ b/src/gui/modalMenu.cpp @@ -315,8 +315,10 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event) ret = focused->OnEvent(mouse_event); if (!ret && m_hovered && m_hovered != focused) ret = m_hovered->OnEvent(mouse_event); - if (event.TouchInput.Event == ETIE_LEFT_UP) + if (event.TouchInput.Event == ETIE_LEFT_UP) { + m_pointer = v2s32(0, 0); leave(); + } return ret; } case 2: {