From d230cb40fe798148eb697959e6e8ab9a5e5d2c51 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Thu, 14 Jul 2016 00:03:53 +0200 Subject: [PATCH] fix(gestures): detecting swipe angle correctly + sliding item logic fix --- src/components/item/item-sliding-gesture.ts | 4 ++-- src/components/menu/menu-gestures.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/item/item-sliding-gesture.ts b/src/components/item/item-sliding-gesture.ts index b97a1c9c9af..b71a166a99b 100644 --- a/src/components/item/item-sliding-gesture.ts +++ b/src/components/item/item-sliding-gesture.ts @@ -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 diff --git a/src/components/menu/menu-gestures.ts b/src/components/menu/menu-gestures.ts index 60c274b98e5..bee1b3ac638 100644 --- a/src/components/menu/menu-gestures.ts +++ b/src/components/menu/menu-gestures.ts @@ -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); } }