* Listens to changes in the position of the overlay and sets the correct classes * on the menu based on the new position. This ensures the animation origin is always * correct, even if a fallback position is used for the overlay.
(menu: MatMenuPanel, position: FlexibleConnectedPositionStrategy)
| 383 | * correct, even if a fallback position is used for the overlay. |
| 384 | */ |
| 385 | private _subscribeToPositions(menu: MatMenuPanel, position: FlexibleConnectedPositionStrategy) { |
| 386 | if (menu.setPositionClasses) { |
| 387 | position.positionChanges.subscribe(change => { |
| 388 | this._ngZone.run(() => { |
| 389 | const posX: MenuPositionX = |
| 390 | change.connectionPair.overlayX === 'start' ? 'after' : 'before'; |
| 391 | const posY: MenuPositionY = change.connectionPair.overlayY === 'top' ? 'below' : 'above'; |
| 392 | menu.setPositionClasses!(posX, posY); |
| 393 | }); |
| 394 | }); |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * Sets the appropriate positions on a position strategy |
nothing calls this directly
no outgoing calls
no test coverage detected