Revert "Only send middle click event on release when not double-tapping (Android) (#32)"

This reverts commit 3f7549abeb.
This commit is contained in:
Maksim Gamarnik 2016-12-21 00:49:28 +02:00
parent 4f11fb7403
commit 79aa272620
1 changed files with 18 additions and 23 deletions

View File

@ -564,29 +564,7 @@ void TouchScreenGUI::handleReleaseEvent(size_t evt_id)
translated->MouseInput.Event = EMIE_LMOUSE_LEFT_UP;
m_receiver->OnEvent(*translated);
delete translated;
/* do double tap detection */
bool was_double_tap = doubleTapDetection();
/* send middle click for single touch */
if (!was_double_tap && !m_move_has_really_moved) {
// update shootline
m_shootline = m_device
->getSceneManager()
->getSceneCollisionManager()
->getRayFromScreenCoordinates(m_move_downlocation);
// send the event
SEvent *translated = new SEvent;
memset(translated, 0, sizeof(SEvent));
translated->EventType = EET_MOUSE_INPUT_EVENT;
translated->MouseInput.X = m_move_downlocation.X;
translated->MouseInput.Y = m_move_downlocation.Y;
translated->MouseInput.ButtonStates = EMBSM_MIDDLE; // << important!
translated->MouseInput.Event = EMIE_MMOUSE_LEFT_UP;
m_receiver->OnEvent(*translated);
delete translated;
}
doubleTapDetection();
m_shootline = m_device
->getSceneManager()
->getSceneCollisionManager()
@ -665,6 +643,23 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
m_move_downtime = getTimeMs();
m_move_downlocation = v2s32(event.TouchInput.X, event.TouchInput.Y);
m_move_sent_as_mouse_event = false;
// update shootline (in case the game handles the event we send below)
m_shootline = m_device
->getSceneManager()
->getSceneCollisionManager()
->getRayFromScreenCoordinates(m_move_downlocation);
// send a middle click event so the game can handle single touches
SEvent *translated = new SEvent;
memset(translated, 0, sizeof(SEvent));
translated->EventType = EET_MOUSE_INPUT_EVENT;
translated->MouseInput.X = m_move_downlocation.X;
translated->MouseInput.Y = m_move_downlocation.Y;
translated->MouseInput.ButtonStates = EMBSM_MIDDLE; // << important!
translated->MouseInput.Event = EMIE_MMOUSE_LEFT_UP;
m_receiver->OnEvent(*translated);
delete translated;
}
}