@ -1,39 +0,0 @@
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
|
||||
// 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';
|
||||
|
||||
@Component({selector: 'gestures-app'})
|
||||
@View({templateUrl: 'template.html'})
|
||||
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);
|
||||
}
|
22
modules/examples/src/gestures/index.ts
Normal file
22
modules/examples/src/gestures/index.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
|
||||
@Component({selector: 'gestures-app'})
|
||||
@View({templateUrl: 'template.html'})
|
||||
class GesturesCmp {
|
||||
swipeDirection: string = '-';
|
||||
pinchScale: number = 1;
|
||||
rotateAngle: number = 0;
|
||||
|
||||
onSwipe(event): void { this.swipeDirection = event.deltaX > 0 ? 'right' : 'left'; }
|
||||
|
||||
onPinch(event): void { this.pinchScale = event.scale; }
|
||||
|
||||
onRotate(event): void { this.rotateAngle = event.rotation; }
|
||||
}
|
||||
|
||||
export function main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
bootstrap(GesturesCmp);
|
||||
}
|
Reference in New Issue
Block a user