cache window dimensions

This commit is contained in:
Adam Bradley
2015-09-13 22:34:23 -05:00
parent dc1c997f52
commit 28c8d001e6
12 changed files with 33 additions and 36 deletions

View File

@@ -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() {}

View File

@@ -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
};
}