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 | 73 | _isTouching = event->touchPointStates().testFlag(Qt::TouchPointPressed); |
| 74 | 74 | |
| 75 | 75 | _lastTouch = evalAverageTouchPoints(event->touchPoints()); |
| 76 | + _lastTouchTime = _clock.now(); | |
| 76 | 77 | } |
| 77 | 78 | void KeyboardMouseDevice::touchEndEvent(const QTouchEvent* event) { |
| 78 | 79 | _isTouching = false; |
| 79 | 80 | _lastTouch = evalAverageTouchPoints(event->touchPoints()); |
| 81 | + _lastTouchTime = _clock.now(); | |
| 80 | 82 | } |
| 81 | 83 | void KeyboardMouseDevice::touchUpdateEvent(const QTouchEvent* event) { |
| 82 | 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 | 92 | if (!_isTouching) { |
| 85 | 93 | _isTouching = event->touchPointStates().testFlag(Qt::TouchPointPressed); |
| 94 | + _lastTouchTime = _clock.now(); | |
| 86 | 95 | } else { |
| 87 | 96 | auto currentMove = currentPos - _lastTouch; |
| 88 | 97 | |
| @@ -131,7 +140,7 @@ void KeyboardMouseDevice::registerToUserInputMapper(UserInputMapper& mapper) { · 42 unmodified lines | ||
| 131 | 140 | void KeyboardMouseDevice::assignDefaultInputMapping(UserInputMapper& mapper) { |
| 132 | 141 | const float BUTTON_MOVE_SPEED = 1.0f; |
| 133 | 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 | 144 | const float BUTTON_BOOM_SPEED = 0.1f; |
| 136 | 145 | |
| 137 | 146 | // AWSD keys mapping |