feat(EventManager): implement the EventManager
This commit is contained in:
32
modules/examples/src/gestures/index.html
Normal file
32
modules/examples/src/gestures/index.html
Normal file
File diff suppressed because one or more lines are too long
38
modules/examples/src/gestures/index.js
Normal file
38
modules/examples/src/gestures/index.js
Normal 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);
|
||||
}
|
15
modules/examples/src/gestures/template.html
Normal file
15
modules/examples/src/gestures/template.html
Normal 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>
|
Reference in New Issue
Block a user