Skip to content

Commit

Permalink
fix(gestures): detecting swipe angle correctly + sliding item logic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jul 13, 2016
1 parent 1ae6619 commit d230cb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/item/item-sliding-gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export class ItemSlidingGesture {
}

// Close open container if it is not the selected one.
if (container !== this.openContainer && this.closeOpened()) {
return false;
if (container !== this.openContainer) {
this.closeOpened();
}

// Try to start gesture
Expand Down
5 changes: 3 additions & 2 deletions src/components/menu/menu-gestures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ export class MenuContentGesture extends SlideEdgeGesture {
return true;
}

let cosine = Math.cos(ev.angle * (Math.PI / 180));
if (menu.side === 'right') {
if ((ev.angle > 140 && ev.angle <= 180) || (ev.angle > -140 && ev.angle <= -180)) {
if (cosine < -0.95) {
return super.canStart(ev);
}
} else {
if (ev.angle > -40 && ev.angle < 40) {
if (cosine > 0.95) {
return super.canStart(ev);
}
}
Expand Down

0 comments on commit d230cb4

Please sign in to comment.