mirror of
https://github.com/minetest/minetest.git
synced 2024-12-24 23:22:24 +01:00
Touchscreen: Abort ongoing short taps if touch interaction mode changes (#14305)
This commit is contained in:
parent
df9975f35d
commit
2b99dabdac
@ -1091,6 +1091,15 @@ void TouchScreenGUI::applyContextControls(const TouchInteractionMode &mode)
|
|||||||
|
|
||||||
u64 now = porting::getTimeMs();
|
u64 now = porting::getTimeMs();
|
||||||
|
|
||||||
|
// If the meanings of short and long taps have been swapped, abort any ongoing
|
||||||
|
// short taps because they would do something else than the player expected.
|
||||||
|
// Long taps don't need this, they're adjusted to the swapped meanings instead.
|
||||||
|
if (mode != m_last_mode) {
|
||||||
|
m_dig_pressed_until = 0;
|
||||||
|
m_place_pressed_until = 0;
|
||||||
|
}
|
||||||
|
m_last_mode = mode;
|
||||||
|
|
||||||
switch (m_tap_state) {
|
switch (m_tap_state) {
|
||||||
case TapState::ShortTap:
|
case TapState::ShortTap:
|
||||||
if (mode == SHORT_DIG_LONG_PLACE) {
|
if (mode == SHORT_DIG_LONG_PLACE) {
|
||||||
|
@ -314,6 +314,7 @@ private:
|
|||||||
|
|
||||||
v2s32 getPointerPos();
|
v2s32 getPointerPos();
|
||||||
void emitMouseEvent(EMOUSE_INPUT_EVENT type);
|
void emitMouseEvent(EMOUSE_INPUT_EVENT type);
|
||||||
|
TouchInteractionMode m_last_mode = TouchInteractionMode_END;
|
||||||
TapState m_tap_state = TapState::None;
|
TapState m_tap_state = TapState::None;
|
||||||
|
|
||||||
bool m_dig_pressed = false;
|
bool m_dig_pressed = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user