Skip to content

Commit 9c319f3

Browse files
committed
refactor: address feedback
1 parent b5b2b30 commit 9c319f3

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
@@ -47,6 +47,13 @@ export interface MdMenuDefaultOptions {
4747
export const MD_MENU_DEFAULT_OPTIONS =
4848
new InjectionToken<MdMenuDefaultOptions>('md-menu-default-options');
4949

50+
/**
51+
* Start elevation for the menu panel.
52+
* @docs-private
53+
*/
54+
const MD_MENU_BASE_ELEVATION = 2;
55+
56+
5057
@Component({
5158
moduleId: module.id,
5259
selector: 'md-menu, mat-menu',
@@ -75,7 +82,7 @@ export class MdMenu implements AfterContentInit, MdMenuPanel, OnDestroy {
7582
/** Current state of the panel animation. */
7683
_panelAnimationState: 'void' | 'enter-start' | 'enter' = 'void';
7784

78-
/** Parent menu os the current menu panel. */
85+
/** Parent menu of the current menu panel. */
7986
parentMenu: MdMenuPanel | undefined;
8087

8188
/** Layout direction of the menu. */
@@ -198,11 +205,11 @@ export class MdMenu implements AfterContentInit, MdMenuPanel, OnDestroy {
198205

199206
/**
200207
* Sets the menu panel elevation.
201-
* @param depth Amount of parent menus that come before the menu.
208+
* @param depth Number of parent menus that come before the menu.
202209
*/
203210
setElevation(depth: number): void {
204-
// The elevation starts at 2 and increases by one for each level.
205-
const newElevation = `mat-elevation-z${depth + 2}`;
211+
// The elevation starts at the base and increases by one for each level.
212+
const newElevation = `mat-elevation-z${MD_MENU_BASE_ELEVATION + depth}`;
206213
const customElevation = Object.keys(this._classList).find(c => c.startsWith('mat-elevation-z'));
207214

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

0 commit comments

Comments
 (0)