1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Right-click popups will stay till next tap, in line with Android UI

This commit is contained in:
Ivan Savenko 2023-05-29 19:21:09 +03:00
parent 57df1c3e0d
commit 18388b2d72
2 changed files with 17 additions and 1 deletions

View File

@ -79,6 +79,7 @@ void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfin
break;
}
case TouchState::TAP_DOWN_LONG:
case TouchState::TAP_DOWN_LONG_AWAIT:
{
// no-op
break;
@ -118,6 +119,7 @@ void InputSourceTouch::handleEventFingerDown(const SDL_TouchFingerEvent & tfinge
}
case TouchState::TAP_DOWN_DOUBLE:
case TouchState::TAP_DOWN_LONG:
case TouchState::TAP_DOWN_LONG_AWAIT:
{
// no-op
break;
@ -169,6 +171,14 @@ void InputSourceTouch::handleEventFingerUp(const SDL_TouchFingerEvent & tfinger)
break;
}
case TouchState::TAP_DOWN_LONG:
{
if (SDL_GetNumTouchFingers(tfinger.touchId) == 0)
{
state = TouchState::TAP_DOWN_LONG_AWAIT;
}
break;
}
case TouchState::TAP_DOWN_LONG_AWAIT:
{
if (SDL_GetNumTouchFingers(tfinger.touchId) == 0)
{

View File

@ -51,9 +51,15 @@ enum class TouchState
// single finger is down for long period of time
// DOWN -> ignored
// MOTION -> ignored
// UP -> transition to IDLE, generate onRightClickUp() event
// UP -> transition to TAP_DOWN_LONG_AWAIT
TAP_DOWN_LONG,
// right-click popup is active, waiting for new tap to hide popup
// DOWN -> ignored
// MOTION -> ignored
// UP -> transition to IDLE, generate onRightClickUp() event
TAP_DOWN_LONG_AWAIT,
// Possible transitions:
// -> DOUBLE