Skip to content

Commit e8d08d1

Browse files
committed
refactor: address feedback
1 parent 3a640b7 commit e8d08d1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/lib/menu/menu-directive.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ import {Observable} from 'rxjs/Observable';
3535
import {Direction} from '../core';
3636

3737

38+
/**
39+
* Start elevation for the menu panel.
40+
* @docs-private
41+
*/
42+
const MD_MENU_BASE_ELEVATION = 2;
43+
44+
3845
@Component({
3946
moduleId: module.id,
4047
selector: 'md-menu, mat-menu',
@@ -63,7 +70,7 @@ export class MdMenu implements AfterContentInit, MdMenuPanel, OnDestroy {
6370
/** Current state of the panel animation. */
6471
_panelAnimationState: 'void' | 'enter-start' | 'enter' = 'void';
6572

66-
/** Parent menu os the current menu panel. */
73+
/** Parent menu of the current menu panel. */
6774
parentMenu: MdMenuPanel | undefined;
6875

6976
/** Layout direction of the menu. */
@@ -184,11 +191,11 @@ export class MdMenu implements AfterContentInit, MdMenuPanel, OnDestroy {
184191

185192
/**
186193
* Sets the menu panel elevation.
187-
* @param depth Amount of parent menus that come before the menu.
194+
* @param depth Number of parent menus that come before the menu.
188195
*/
189196
setElevation(depth: number): void {
190-
// The elevation starts at 2 and increases by one for each level.
191-
const newElevation = `mat-elevation-z${depth + 2}`;
197+
// The elevation starts at the base and increases by one for each level.
198+
const newElevation = `mat-elevation-z${MD_MENU_BASE_ELEVATION + depth}`;
192199
const customElevation = Object.keys(this._classList).find(c => c.startsWith('mat-elevation-z'));
193200

194201
if (!customElevation || customElevation === this._previousElevation) {

0 commit comments

Comments
 (0)