mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
cache window dimensions
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
import {Gesture} from 'ionic/gestures/gesture';
|
||||
import * as util from 'ionic/util';
|
||||
//import Hammer from 'hammer';
|
||||
|
||||
/*
|
||||
* BUG(ajoslin): HammerJS 2.x does not have an alternative to HammerJS 1.x's
|
||||
* dragLockToAxis, so a vertical and horizontal gesture can happen at the same time.
|
||||
*/
|
||||
|
||||
export class DragGesture extends Gesture {
|
||||
constructor(element, opts = {}) {
|
||||
util.defaults(opts, {});
|
||||
super(element, opts);
|
||||
}
|
||||
|
||||
listen() {
|
||||
super.listen();
|
||||
this.on('panstart', ev => {
|
||||
@@ -33,6 +30,7 @@ export class DragGesture extends Gesture {
|
||||
// ev.stopPropagation()
|
||||
});
|
||||
}
|
||||
|
||||
onDrag() {}
|
||||
onDragStart() {}
|
||||
onDragEnd() {}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import {SlideGesture} from 'ionic/gestures/slide-gesture';
|
||||
import * as util from 'ionic/util';
|
||||
import {defaults} from '../util/util';
|
||||
import {windowDimensions} from '../util/dom';
|
||||
|
||||
|
||||
export class SlideEdgeGesture extends SlideGesture {
|
||||
constructor(element: Element, opts: Object = {}) {
|
||||
util.defaults(opts, {
|
||||
defaults(opts, {
|
||||
edge: 'left',
|
||||
threshold: 50
|
||||
});
|
||||
@@ -22,8 +24,8 @@ export class SlideEdgeGesture extends SlideGesture {
|
||||
return {
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight
|
||||
width: windowDimensions().width,
|
||||
height: windowDimensions().height
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user