@ionic/angular#GestureDetail TypeScript Examples
The following examples show how to use
@ionic/angular#GestureDetail.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: notification.component.ts From onchat-web with Apache License 2.0 | 6 votes |
ngOnInit() {
this.element = this.elementRef.nativeElement.querySelector('.notification');
this.animation = this.animationCtrl.create()
.addElement(this.elementRef.nativeElement)
.duration(200)
.fromTo('transform', 'translateY(0)', 'translateY(-100%)')
.fromTo('opacity', 1, .5)
.easing('ease-out');
this.animation.progressStart(false);
this.gesture = this.gestureCtrl.create({
el: this.elementRef.nativeElement,
threshold: 0,
gestureName: 'square-drag',
onMove: (event: GestureDetail) => this.onMove(event),
onEnd: (event: GestureDetail) => this.onEnd(event)
});
this.gesture.enable(true);
}
Example #2
Source File: notification.component.ts From onchat-web with Apache License 2.0 | 6 votes |
/**
* 手势结束时
* @param event
*/
private onEnd(event: GestureDetail) {
this.gesture.enable(false);
const step = this.getStep(event);
const shouldComplete = step > 0.4;
this.animation.progressEnd(shouldComplete ? 1 : 0, step);
this.animation.onFinish(() => {
shouldComplete ? this.dismiss() : this.gesture.enable(true);
});
}
Example #3
Source File: notification.component.ts From onchat-web with Apache License 2.0 | 5 votes |
/**
* 手势移动时
* @param event
*/
private onMove(event: GestureDetail) {
this.animation.progressStart(false);
this.animation.progressStep(this.getStep(event));
}
Example #4
Source File: notification.component.ts From onchat-web with Apache License 2.0 | 5 votes |
private getStep(event: GestureDetail) {
return this.clamp(0, -event.deltaY / 125, 1);
}