diff options
-rw-r--r-- | src/ui/touch.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c index c369c5a5..40e5c5d0 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c | |||
@@ -118,8 +118,12 @@ iLocalDef float distance_Touch_(const iTouch *d) { | |||
118 | return length_F3(sub_F3(d->pos[0], d->startPos)); | 118 | return length_F3(sub_F3(d->pos[0], d->startPos)); |
119 | } | 119 | } |
120 | 120 | ||
121 | static iBool isStationaryDistance_Touch_(const iTouch *d, int distance) { | ||
122 | return !d->hasMoved && distance_Touch_(d) < distance * get_Window()->pixelRatio; | ||
123 | } | ||
124 | |||
121 | static iBool isStationary_Touch_(const iTouch *d) { | 125 | static iBool isStationary_Touch_(const iTouch *d) { |
122 | return !d->hasMoved && distance_Touch_(d) < tapRadiusPt_ * get_Window()->pixelRatio; | 126 | return isStationaryDistance_Touch_(d, tapRadiusPt_); |
123 | } | 127 | } |
124 | 128 | ||
125 | static void dispatchMotion_Touch_(iFloat3 pos, int buttonState) { | 129 | static void dispatchMotion_Touch_(iFloat3 pos, int buttonState) { |
@@ -372,10 +376,12 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
372 | } | 376 | } |
373 | if (touch->isTapAndHold) { | 377 | if (touch->isTapAndHold) { |
374 | pushPos_Touch_(touch, pos, fing->timestamp); | 378 | pushPos_Touch_(touch, pos, fing->timestamp); |
375 | if (!touch->hasMoved && !isStationary_Touch_(touch)) { | 379 | if (!touch->hasMoved && !isStationaryDistance_Touch_(touch, tapRadiusPt_ * 3)) { |
376 | touch->hasMoved = iTrue; | 380 | touch->hasMoved = iTrue; |
377 | } | 381 | } |
378 | dispatchMotion_Touch_(pos, 0); | 382 | if (touch->hasMoved) { |
383 | dispatchMotion_Touch_(pos, 0); | ||
384 | } | ||
379 | return iTrue; | 385 | return iTrue; |
380 | } | 386 | } |
381 | /* Update touch position. */ | 387 | /* Update touch position. */ |