Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.

Zero threshold velocity for triggering onSwipeLeft() and onSwipeRight…#66

Open
baconmania wants to merge 1 commit intoionic-team:masterfrom
baconmania:slow-swipes
Open

Zero threshold velocity for triggering onSwipeLeft() and onSwipeRight…#66
baconmania wants to merge 1 commit intoionic-team:masterfrom
baconmania:slow-swipes

Conversation

@baconmania
Copy link

…(). Resolves #65.

@mrienstra
Copy link

As pointed out (albeit a bit tersely) in this comment on #65, replacing on-swipe-left with on-transition-left also resolves #65.

I suggest closing this pull request (and #65).

I'm hoping to contributing to the README.md or the ./example (which could use some love). ;)


A swipe will trigger both on-swipe-left and on-transition-left (in that order), so if you are interested in knowing whether it was a swipe or a transition (zero velocity), you'll need to do something like the following:

In the "cards" controller:

  var skipSlow = false;

  $scope.cardTransition = function(dir, speed, index) {
    console.log('BrowseCtrl .cardTransition', dir, speed, index, skipSlow);
    if (speed === 'fast') {
      skipSlow = true;
      $scope.addCard();
    } else if (!skipSlow) {
      $scope.addCard();
    } else {
      skipSlow = false;
    }
  };

Repeater directives (some omitted for clarity):

<td-card ng-repeat="card in cards" on-swipe-left="cardTransition('left', 'fast', $index)" on-transition-left="cardTransition('left', 'slow', $index)" on-swipe-right="cardTransition('right', 'fast', $index)" on-transition-right="cardTransition('right', 'slow', $index)">

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onSwipeLeft & onSwipeRight not called on slow swipes

2 participants