mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
refactor(menu): gestureCtrl is a private property of menu
This commit is contained in:
@ -2,21 +2,25 @@ import { Menu } from './menu';
|
|||||||
import { SlideEdgeGesture } from '../../gestures/slide-edge-gesture';
|
import { SlideEdgeGesture } from '../../gestures/slide-edge-gesture';
|
||||||
import { SlideData } from '../../gestures/slide-gesture';
|
import { SlideData } from '../../gestures/slide-gesture';
|
||||||
import { assign } from '../../util/util';
|
import { assign } from '../../util/util';
|
||||||
import { GesturePriority } from '../../gestures/gesture-controller';
|
import { GestureController, GesturePriority } from '../../gestures/gesture-controller';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gesture attached to the content which the menu is assigned to
|
* Gesture attached to the content which the menu is assigned to
|
||||||
*/
|
*/
|
||||||
export class MenuContentGesture extends SlideEdgeGesture {
|
export class MenuContentGesture extends SlideEdgeGesture {
|
||||||
|
|
||||||
constructor(public menu: Menu, contentEle: HTMLElement, options: any = {}) {
|
constructor(
|
||||||
|
public menu: Menu,
|
||||||
|
gestureCtrl: GestureController,
|
||||||
|
contentEle: HTMLElement,
|
||||||
|
options: any = {}) {
|
||||||
super(contentEle, assign({
|
super(contentEle, assign({
|
||||||
direction: 'x',
|
direction: 'x',
|
||||||
edge: menu.side,
|
edge: menu.side,
|
||||||
threshold: 0,
|
threshold: 0,
|
||||||
maxEdgeStart: menu.maxEdgeStart || 50,
|
maxEdgeStart: menu.maxEdgeStart || 50,
|
||||||
maxAngle: 40,
|
maxAngle: 40,
|
||||||
gesture: menu.gestureCtrl.create('menu-swipe', {
|
gesture: gestureCtrl.create('menu-swipe', {
|
||||||
priority: GesturePriority.MenuSwipe,
|
priority: GesturePriority.MenuSwipe,
|
||||||
})
|
})
|
||||||
}, options));
|
}, options));
|
||||||
|
@ -303,7 +303,7 @@ export class Menu {
|
|||||||
private _renderer: Renderer,
|
private _renderer: Renderer,
|
||||||
private _keyboard: Keyboard,
|
private _keyboard: Keyboard,
|
||||||
private _zone: NgZone,
|
private _zone: NgZone,
|
||||||
public gestureCtrl: GestureController
|
private _gestureCtrl: GestureController
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -333,7 +333,7 @@ export class Menu {
|
|||||||
this.setElementAttribute('type', this.type);
|
this.setElementAttribute('type', this.type);
|
||||||
|
|
||||||
// add the gestures
|
// add the gestures
|
||||||
this._cntGesture = new MenuContentGesture(this, document.body);
|
this._cntGesture = new MenuContentGesture(this, this._gestureCtrl, document.body);
|
||||||
|
|
||||||
// register listeners if this menu is enabled
|
// register listeners if this menu is enabled
|
||||||
// check if more than one menu is on the same side
|
// check if more than one menu is on the same side
|
||||||
|
Reference in New Issue
Block a user