From d531ec231644d2d6febc5b4e85065dc1c1c2656d Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Fri, 4 Nov 2016 18:57:15 +0100 Subject: [PATCH] perf(menu): avoid change detection when it isn't needed (#8986) --- src/components/menu/menu-gestures.ts | 2 +- src/components/menu/menu.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/menu/menu-gestures.ts b/src/components/menu/menu-gestures.ts index 257487770eb..21d6e02c2d3 100644 --- a/src/components/menu/menu-gestures.ts +++ b/src/components/menu/menu-gestures.ts @@ -21,6 +21,7 @@ export class MenuContentGesture extends SlideEdgeGesture { threshold: 0, maxEdgeStart: menu.maxEdgeStart || 50, maxAngle: 40, + zone: false, debouncer: new NativeRafDebouncer(), gesture: gestureCtrl.create('menu-swipe', { priority: GesturePriority.MenuSwipe, @@ -58,7 +59,6 @@ export class MenuContentGesture extends SlideEdgeGesture { 'z', z, 'stepValue', stepValue); - ev.preventDefault(); this.menu.swipeProgress(stepValue); } diff --git a/src/components/menu/menu.ts b/src/components/menu/menu.ts index 614483969cd..215956dbcf1 100644 --- a/src/components/menu/menu.ts +++ b/src/components/menu/menu.ts @@ -450,7 +450,11 @@ export class Menu { return; } this._getType().setProgessStep(stepValue); - this.ionDrag.emit(stepValue); + + let ionDrag = this.ionDrag; + if (ionDrag.observers.length > 0) { + this._zone.run(ionDrag.emit.bind(ionDrag, stepValue)); + } } /**