diff options
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r-- | src/ui/touch.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c index c373ebd3..e8f53bca 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c | |||
@@ -453,8 +453,8 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
453 | if (edge == left_TouchEdge) { | 453 | if (edge == left_TouchEdge) { |
454 | dragging = findSlidePanel_Widget_(aff); | 454 | dragging = findSlidePanel_Widget_(aff); |
455 | if (dragging) { | 455 | if (dragging) { |
456 | printf("Selected for dragging: "); | 456 | // printf("Selected for dragging: "); |
457 | identify_Widget(dragging); | 457 | // identify_Widget(dragging); |
458 | setFlags_Widget(dragging, dragged_WidgetFlag, iTrue); | 458 | setFlags_Widget(dragging, dragged_WidgetFlag, iTrue); |
459 | } | 459 | } |
460 | } | 460 | } |
@@ -556,7 +556,7 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
556 | } | 556 | } |
557 | /* Edge swipe aborted? */ | 557 | /* Edge swipe aborted? */ |
558 | if (touch->edge == left_TouchEdge) { | 558 | if (touch->edge == left_TouchEdge) { |
559 | if (fing->dx < 0) { | 559 | if (fing->dx < 0 && x_F3(touch->pos[0]) < tapRadiusPt_ * window->pixelRatio) { |
560 | touch->edge = none_TouchEdge; | 560 | touch->edge = none_TouchEdge; |
561 | if (touch->edgeDragging) { | 561 | if (touch->edgeDragging) { |
562 | setFlags_Widget(touch->edgeDragging, dragged_WidgetFlag, iFalse); | 562 | setFlags_Widget(touch->edgeDragging, dragged_WidgetFlag, iFalse); |
@@ -631,17 +631,19 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
631 | continue; | 631 | continue; |
632 | } | 632 | } |
633 | /* Edge swipes do not generate momentum. */ | 633 | /* Edge swipes do not generate momentum. */ |
634 | const size_t lastIndex = iMin(touch->posCount - 1, lastIndex_Touch_); | ||
634 | const uint32_t duration = nowTime - touch->startTime; | 635 | const uint32_t duration = nowTime - touch->startTime; |
635 | const iFloat3 gestureVector = sub_F3(pos, touch->startPos); | 636 | const iFloat3 gestureVector = sub_F3(pos, touch->pos[lastIndex]); |
636 | iFloat3 velocity = zero_F3(); | 637 | iFloat3 velocity = zero_F3(); |
637 | if (touch->edge && fabsf(2 * x_F3(gestureVector)) > fabsf(y_F3(gestureVector)) && | 638 | if (touch->edge && fabsf(2 * x_F3(gestureVector)) > fabsf(y_F3(gestureVector)) && |
638 | !isStationary_Touch_(touch)) { | 639 | !isStationary_Touch_(touch)) { |
639 | dispatchClick_Touch_(touch, touch->edge == left_TouchEdge ? SDL_BUTTON_X1 | 640 | const int swipeDir = x_F3(gestureVector) > 0 ? +1 : -1; |
640 | : SDL_BUTTON_X2); | 641 | dispatchClick_Touch_(touch, |
642 | touch->edge == left_TouchEdge && swipeDir > 0 ? SDL_BUTTON_X1 : | ||
643 | touch->edge == right_TouchEdge && swipeDir < 0 ? SDL_BUTTON_X2 : 0); | ||
641 | setHover_Widget(NULL); | 644 | setHover_Widget(NULL); |
642 | } | 645 | } |
643 | else { | 646 | else { |
644 | const size_t lastIndex = iMin(touch->posCount - 1, lastIndex_Touch_); | ||
645 | const uint32_t elapsed = fing->timestamp - touch->posTime[lastIndex]; | 647 | const uint32_t elapsed = fing->timestamp - touch->posTime[lastIndex]; |
646 | const float minVelocity = 400.0f; | 648 | const float minVelocity = 400.0f; |
647 | if (elapsed < 150) { | 649 | if (elapsed < 150) { |