[SOLVED] Ionic2 class Gesture direction values (swipe)


#1

Anyone knows what are the “direction” values of the class Gesture?

While swiping, seems that that string value are equals to 1,2,4,8 and 16…

Could I use that value to detect a swipe from left to right and right to left?

Source: http://ionicframework.com/docs/v2/api/gestures/Gesture/

export declare class Gesture {
    ....
   direction: string;
}

<div (swipe)="tapEvent($event)">....</div>

tapEvent($event:Gesture) {
    alert('' + $event.direction);
}

#2

Ok so seems that direction take these possible values (source hammer.js)

var INPUT_START = 1;
var INPUT_MOVE = 2;
var INPUT_END = 4;
var INPUT_CANCEL = 8;
var DIRECTION_NONE = 1;
exports.DIRECTION_LEFT = 2;
exports.DIRECTION_RIGHT = 4;
var DIRECTION_UP = 8;
var DIRECTION_DOWN = 16;