perf(menu): improves menu performance and fixes some edge cases

This commit is contained in:
Manu Mtz.-Almeida
2016-11-25 22:51:37 +01:00
parent b515f5251b
commit 320989540e
8 changed files with 68 additions and 31 deletions

View File

@@ -47,6 +47,11 @@ export class MenuContentGesture extends SlideEdgeGesture {
// Set CSS, then wait one frame for it to apply before sliding starts
onSlideBeforeStart(ev: any) {
console.debug('menu gesture, onSlideBeforeStart', this.menu.side);
this.menu.swipeBeforeStart();
}
onSlideStart() {
console.debug('menu gesture, onSlideStart', this.menu.side);
this.menu.swipeStart();
}

View File

@@ -438,12 +438,24 @@ export class Menu {
/**
* @private
*/
swipeStart() {
// user started swiping the menu open/close
if (this.canSwipe()) {
this._before();
this._getType().setProgressStart(this.isOpen);
swipeBeforeStart() {
if (!this.canSwipe()) {
assert(false, 'canSwipe() has to be true');
return;
}
this._before();
}
/**
* @private
*/
swipeStart() {
// user actively dragging the menu
if (!this._isAnimating) {
assert(false, '_isAnimating has to be true');
return;
}
this._getType().setProgressStart(this.isOpen);
}
/**
@@ -452,6 +464,7 @@ export class Menu {
swipeProgress(stepValue: number) {
// user actively dragging the menu
if (!this._isAnimating) {
assert(false, '_isAnimating has to be true');
return;
}
this._getType().setProgessStep(stepValue);