* Returns the origin position and a fallback position based on the user's position preference. * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
()
| 627 | * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`). |
| 628 | */ |
| 629 | _getOrigin(): {main: OriginConnectionPosition; fallback: OriginConnectionPosition} { |
| 630 | const isLtr = !this._dir || this._dir.value == 'ltr'; |
| 631 | const position = this.position; |
| 632 | let originPosition: OriginConnectionPosition; |
| 633 | |
| 634 | if (position == 'above' || position == 'below') { |
| 635 | originPosition = {originX: 'center', originY: position == 'above' ? 'top' : 'bottom'}; |
| 636 | } else if ( |
| 637 | position == 'before' || |
| 638 | (position == 'left' && isLtr) || |
| 639 | (position == 'right' && !isLtr) |
| 640 | ) { |
| 641 | originPosition = {originX: 'start', originY: 'center'}; |
| 642 | } else if ( |
| 643 | position == 'after' || |
| 644 | (position == 'right' && isLtr) || |
| 645 | (position == 'left' && !isLtr) |
| 646 | ) { |
| 647 | originPosition = {originX: 'end', originY: 'center'}; |
| 648 | } else if (typeof ngDevMode === 'undefined' || ngDevMode) { |
| 649 | throw getMatTooltipInvalidPositionError(position); |
| 650 | } |
| 651 | |
| 652 | const {x, y} = this._invertPosition(originPosition!.originX, originPosition!.originY); |
| 653 | |
| 654 | return { |
| 655 | main: originPosition!, |
| 656 | fallback: {originX: x, originY: y}, |
| 657 | }; |
| 658 | } |
| 659 | |
| 660 | /** Returns the overlay position and a fallback position based on the user's preference */ |
| 661 | _getOverlayPosition(): {main: OverlayConnectionPosition; fallback: OverlayConnectionPosition} { |
no test coverage detected