Skip to content

Commit 7fe2f25

Browse files
committed
refactor(menu): set animation origin based on overlay position
Uses the menu panel's overlay position to determine the animation origin, instead of the trigger. These changes make it easier to follow and avoid having to correct it explicitly based on the `overlapTrigger` flag, in addition to fixing some issues in nested menus.
1 parent 6e0b848 commit 7fe2f25

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/lib/menu/menu-trigger.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,9 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy {
238238
* correct, even if a fallback position is used for the overlay.
239239
*/
240240
private _subscribeToPositions(position: ConnectedPositionStrategy): void {
241-
this._positionSubscription = position.onPositionChange.subscribe((change) => {
242-
const posX: MenuPositionX = change.connectionPair.originX === 'start' ? 'after' : 'before';
243-
let posY: MenuPositionY = change.connectionPair.originY === 'top' ? 'below' : 'above';
244-
245-
if (!this.menu.overlapTrigger) {
246-
posY = posY === 'below' ? 'above' : 'below';
247-
}
241+
this._positionSubscription = position.onPositionChange.subscribe(change => {
242+
const posX: MenuPositionX = change.connectionPair.overlayX === 'start' ? 'after' : 'before';
243+
const posY: MenuPositionY = change.connectionPair.overlayY === 'top' ? 'below' : 'above';
248244

249245
this.menu.setPositionClasses(posX, posY);
250246
});

0 commit comments

Comments
 (0)