feat(EventManager): implement the EventManager

This commit is contained in:
Victor Berchet
2015-02-09 15:11:31 +01:00
parent 91fd5a69bf
commit 8844671c8d
26 changed files with 495 additions and 69 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
import {bootstrap, Component, TemplateConfig} from 'angular2/core';
import {reflector} from 'angular2/src/reflection/reflection';
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
@Component({
selector: 'gestures-app',
template: new TemplateConfig({
url: '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);
}

View File

@ -0,0 +1,15 @@
<style type="text/css">
.row {
height: 33%;
text-align: center;
border-bottom: 1px solid black;
margin: 0;
padding: 0;
-webkit-user-select: none;
}
</style>
<div class="row" (swipe)="onSwipe($event)">Swipe (direction = {{swipeDirection}})</div>
<div class="row" (pinch)="onPinch($event)">pinch (scale = {{pinchScale}})</div>
<div class="row" (rotate)="onRotate($event)">Rotate (angle = {{rotateAngle}})</div>
<div class="row"></div>