2015-04-28 18:17:00 -07:00
|
|
|
import {bootstrap} from 'angular2/angular2';
|
2015-02-09 15:11:31 +01:00
|
|
|
import {reflector} from 'angular2/src/reflection/reflection';
|
|
|
|
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
|
|
|
|
2015-04-28 18:17:00 -07:00
|
|
|
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
|
|
|
// add those imports back into 'angular2/angular2';
|
|
|
|
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
|
|
|
import {View} from 'angular2/src/core/annotations_impl/view';
|
|
|
|
|
2015-02-12 14:44:59 +01:00
|
|
|
@Component({selector: 'gestures-app'})
|
2015-04-09 21:20:11 +02:00
|
|
|
@View({templateUrl: 'template.html'})
|
2015-02-09 15:11:31 +01:00
|
|
|
class GesturesCmp {
|
|
|
|
swipeDirection: string;
|
|
|
|
pinchScale: number;
|
|
|
|
rotateAngle: number;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.swipeDirection = '-';
|
|
|
|
this.pinchScale = 1;
|
|
|
|
this.rotateAngle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
onSwipe(event) {
|
|
|
|
this.swipeDirection = event.deltaX > 0 ? 'right' : 'left';
|
|
|
|
}
|
|
|
|
|
|
|
|
onPinch(event) {
|
|
|
|
this.pinchScale = event.scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
onRotate(event) {
|
|
|
|
this.rotateAngle = event.rotation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function main() {
|
|
|
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
|
|
|
bootstrap(GesturesCmp);
|
|
|
|
}
|