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;
#ifdef HAVE_TOUCHSCREENGUI
if (isKeyDown(KeyType::PLACE) && !nohit_enabled) {
if (wasKeyPressed(KeyType::PLACE) && !nohit_enabled) {
#else
if (isKeyDown(KeyType::DIG) && !nohit_enabled) {
#endif

View File

@ -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) {

View File

@ -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: {