-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathgestures.component.ts
67 lines (57 loc) · 1.82 KB
/
gestures.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import {Component} from "@angular/core";
import {
GestureEventData,
PanGestureEventData,
PinchGestureEventData,
RotationGestureEventData,
SwipeGestureEventData,
TouchGestureEventData} from "tns-core-modules/ui/gestures";
@Component({
selector: "gestures",
templateUrl: "snippets/gestures.component.html",
styles: ["label { font-size: 32; margin: 2; background-color: lightgreen;}"]
})
export class GestureComponent {
// >> ng-tap-gesture
onTap(args: GestureEventData) {
console.log("Tap!");
}
// << ng-tap-gesture
// >> ng-double-tap-gesture
onDoubleTap(args: GestureEventData) {
console.log("DoubleTap!");
}
// << ng-double-tap-gesture
// >> ng-long-press-gesture
onLongPress(args: GestureEventData) {
console.log("LongPress!");
}
// << ng-long-press-gesture
// >> ng-swipe-gesture
onSwipe(args: SwipeGestureEventData) {
console.log("Swipe Direction: " + args.direction);
}
// << ng-swipe-gesture
// >> ng-pan-gesture
onPan(args: PanGestureEventData) {
console.log("Pan delta: [" + args.deltaX + ", " + args.deltaY + "] state: " + args.state);
}
// << ng-pan-gesture
// >> ng-pinch-gesture
onPinch(args: PinchGestureEventData) {
console.log("Pinch scale: " + args.scale + " state: " + args.state);
}
// << ng-pinch-gesture
// >> ng-rotate-gesture
onRotate(args: RotationGestureEventData) {
console.log("Rotate angle: " + args.rotation + " state: " + args.state);
}
// << ng-rotate-gesture
// >> ng-touch-gesture
onTouch(args: TouchGestureEventData) {
console.log(
"Touch point: [" + args.getX() + ", " + args.getY() +
"] activePointers: " + args.getActivePointers().length);
}
// << ng-touch-gesture
}