Showing the changes to interface/src/ui/UserInputMapper.cpp (1 of 2 files). Show all
Unified · Split
| @@ -73,16 +73,25 @@ void KeyboardMouseDevice::touchBeginEvent(const QTouchEvent* event) { · 72 unmodified lines | |||
| 73 | _isTouching = event->touchPointStates().testFlag(Qt::TouchPointPressed); | 73 | _isTouching = event->touchPointStates().testFlag(Qt::TouchPointPressed); |
| 74 | 74 | ||
| 75 | _lastTouch = evalAverageTouchPoints(event->touchPoints()); | 75 | _lastTouch = evalAverageTouchPoints(event->touchPoints()); |
| 76 | _lastTouchTime = _clock.now(); | ||
| 76 | } | 77 | } |
| 77 | void KeyboardMouseDevice::touchEndEvent(const QTouchEvent* event) { | 78 | void KeyboardMouseDevice::touchEndEvent(const QTouchEvent* event) { |
| 78 | _isTouching = false; | 79 | _isTouching = false; |
| 79 | _lastTouch = evalAverageTouchPoints(event->touchPoints()); | 80 | _lastTouch = evalAverageTouchPoints(event->touchPoints()); |
| 81 | _lastTouchTime = _clock.now(); | ||
| 80 | } | 82 | } |
| 81 | void KeyboardMouseDevice::touchUpdateEvent(const QTouchEvent* event) { | 83 | void KeyboardMouseDevice::touchUpdateEvent(const QTouchEvent* event) { |
| 82 | auto currentPos = evalAverageTouchPoints(event->touchPoints()); | 84 | auto currentPos = evalAverageTouchPoints(event->touchPoints()); |
| 83 | 85 | ||
| 86 | auto currentTime = _clock.now(); | ||
| 87 | auto sinceLastTouch = std::chrono::duration_cast<std::chrono::milliseconds>(currentTime - _lastTouchTime); | ||
| 88 | if (sinceLastTouch.count() > 50) { | ||
| 89 | _isTouching = false; | ||
| 90 | } | ||
| 91 | |||
| 84 | if (!_isTouching) { | 92 | if (!_isTouching) { |
| 85 | _isTouching = event->touchPointStates().testFlag(Qt::TouchPointPressed); | 93 | _isTouching = event->touchPointStates().testFlag(Qt::TouchPointPressed); |
| 94 | _lastTouchTime = _clock.now(); | ||
| 86 | } else { | 95 | } else { |
| 87 | auto currentMove = currentPos - _lastTouch; | 96 | auto currentMove = currentPos - _lastTouch; |
| 88 | 97 | ||
| @@ -131,7 +140,7 @@ void KeyboardMouseDevice::registerToUserInputMapper(UserInputMapper& mapper) { · 42 unmodified lines | |||
| 131 | void KeyboardMouseDevice::assignDefaultInputMapping(UserInputMapper& mapper) { | 140 | void KeyboardMouseDevice::assignDefaultInputMapping(UserInputMapper& mapper) { |
| 132 | const float BUTTON_MOVE_SPEED = 1.0f; | 141 | const float BUTTON_MOVE_SPEED = 1.0f; |
| 133 | const float BUTTON_ROTATION_SPEED = 30.0f; | 142 | const float BUTTON_ROTATION_SPEED = 30.0f; |
| 134 | const float MOUSE_ROTATION_SPEED = 1.0f; | 143 | const float MOUSE_ROTATION_SPEED = 0.5f; |
| 135 | const float BUTTON_BOOM_SPEED = 0.1f; | 144 | const float BUTTON_BOOM_SPEED = 0.1f; |
| 136 | 145 | ||
| 137 | // AWSD keys mapping | 146 | // AWSD keys mapping |