TouchScreenGUI: minor fixes

master
Maksim 2022-04-09 12:40:04 +02:00
parent f8f32cc628
commit aea47b3afe
3 changed files with 12 additions and 14 deletions

View File

@ -3633,7 +3633,7 @@ void Game::handlePointingAtObject(const PointedThing &pointed,
bool nohit_enabled = ((ItemGroupList) playeritem_def.groups)["nohit"] != 0; bool nohit_enabled = ((ItemGroupList) playeritem_def.groups)["nohit"] != 0;
#ifdef HAVE_TOUCHSCREENGUI #ifdef HAVE_TOUCHSCREENGUI
if (isKeyDown(KeyType::PLACE) && !nohit_enabled) { if (wasKeyPressed(KeyType::PLACE) && !nohit_enabled) {
#else #else
if (isKeyDown(KeyType::DIG) && !nohit_enabled) { if (isKeyDown(KeyType::DIG) && !nohit_enabled) {
#endif #endif

View File

@ -3789,10 +3789,6 @@ void GUIFormSpecMenu::showTooltip(const std::wstring &text,
tooltip_offset_y = 0; tooltip_offset_y = 0;
if (m_pointer.X > (s32)screenSize.X / 2) if (m_pointer.X > (s32)screenSize.X / 2)
tooltip_offset_x = -(tooltip_offset_x + tooltip_width); tooltip_offset_x = -(tooltip_offset_x + tooltip_width);
// Hide tooltip after ETIE_LEFT_UP
if (m_pointer.X == 0)
return;
#endif #endif
// Calculate and set the tooltip position // Calculate and set the tooltip position
@ -4335,14 +4331,8 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
count = MYMIN(s_count, 10); count = MYMIN(s_count, 10);
else if (button == BET_WHEEL_DOWN) else if (button == BET_WHEEL_DOWN)
count = 1; count = 1;
else { // left else // left
#ifdef HAVE_TOUCHSCREENGUI
if (s.listname == "craft")
count = 1;
else
#endif
count = s_count; count = s_count;
}
if (!event.MouseInput.Shift) { if (!event.MouseInput.Shift) {
// no shift: select item // no shift: select item
@ -4363,8 +4353,14 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
move_amount = 1; move_amount = 1;
else if (button == BET_MIDDLE) else if (button == BET_MIDDLE)
move_amount = MYMIN(m_selected_amount, 10); 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; move_amount = m_selected_amount;
}
// else wheeldown // else wheeldown
if (identical) { if (identical) {

View File

@ -315,8 +315,10 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
ret = focused->OnEvent(mouse_event); ret = focused->OnEvent(mouse_event);
if (!ret && m_hovered && m_hovered != focused) if (!ret && m_hovered && m_hovered != focused)
ret = m_hovered->OnEvent(mouse_event); 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(); leave();
}
return ret; return ret;
} }
case 2: { case 2: {