Skip to content

Commit

Permalink
fix(menu): swipe menu is triggered when the swipe |angle| < 40º
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jul 14, 2016
1 parent 72c24bc commit 32a70a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/menu/menu-gestures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { SlideData } from '../../gestures/slide-gesture';
import { assign } from '../../util/util';
import { GestureDelegate, GesturePriority } from '../../gestures/gesture-controller';

const DEGRESS_TO_RADIANS = Math.PI / 180;
const MIN_COSINE = Math.cos(40 * DEGRESS_TO_RADIANS);

This comment has been minimized.

Copy link
@biesbjerg

biesbjerg Jul 14, 2016

DEGREES_TO_RADIAN* ?

I think this typo is in several locations.

This comment has been minimized.

Copy link
@biesbjerg

biesbjerg Jul 14, 2016

Oops, you already fixed it. Cool!:-)


/**
* Gesture attached to the content which the menu is assigned to
Expand Down Expand Up @@ -51,13 +53,13 @@ export class MenuContentGesture extends SlideEdgeGesture {
return true;
}

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

0 comments on commit 32a70a6

Please sign in to comment.