Skip to content

Commit

Permalink
perf(menu): using passive events in menu
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Nov 26, 2016
1 parent a722107 commit 788a7b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/menu/menu-gestures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class MenuContentGesture extends SlideEdgeGesture {
threshold: 0,
maxEdgeStart: menu.maxEdgeStart || 50,
zone: false,
passive: true,
debouncer: new NativeRafDebouncer(),
gesture: gestureCtrl.createGesture({
name: GESTURE_MENU_SWIPE,
Expand Down
4 changes: 2 additions & 2 deletions src/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export class Menu {
this.setElementAttribute('type', this.type);

// add the gestures
this._cntGesture = new MenuContentGesture(this, document.body, this._gestureCtrl);
this._cntGesture = new MenuContentGesture(this, <any>document, this._gestureCtrl);

// register listeners if this menu is enabled
// check if more than one menu is on the same side
Expand Down Expand Up @@ -502,9 +502,9 @@ export class Menu {

// this places the menu into the correct location before it animates in
// this css class doesn't actually kick off any animations
this.menuContent && this.menuContent.resize();
this.setElementClass('show-menu', true);
this.backdrop.setElementClass('show-backdrop', true);
this.menuContent && this.menuContent.resize();
this._keyboard.close();
this._isAnimating = true;
}
Expand Down
5 changes: 4 additions & 1 deletion src/gestures/drag-gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface PanGestureConfig {
debouncer?: Debouncer;
zone?: boolean;
capture?: boolean;
passive?: boolean;
}

/**
Expand All @@ -40,6 +41,7 @@ export class PanGesture {
direction: 'x',
zone: true,
capture: false,
passive: false,
});

this.debouncer = (opts.debouncer)
Expand All @@ -53,7 +55,8 @@ export class PanGesture {
pointerMove: this.pointerMove.bind(this),
pointerUp: this.pointerUp.bind(this),
zone: opts.zone,
capture: opts.capture
capture: opts.capture,
passive: opts.passive
};
this.detector = new PanRecognizer(opts.direction, opts.threshold, opts.maxAngle);
}
Expand Down

0 comments on commit 788a7b6

Please sign in to comment.