Adds the configured offset to a position. Used as a hook for child classes.
(position: ConnectedPosition)
| 606 | |
| 607 | /** Adds the configured offset to a position. Used as a hook for child classes. */ |
| 608 | protected _addOffset(position: ConnectedPosition): ConnectedPosition { |
| 609 | const offset = UNBOUNDED_ANCHOR_GAP; |
| 610 | const isLtr = !this._dir || this._dir.value == 'ltr'; |
| 611 | |
| 612 | if (position.originY === 'top') { |
| 613 | position.offsetY = -offset; |
| 614 | } else if (position.originY === 'bottom') { |
| 615 | position.offsetY = offset; |
| 616 | } else if (position.originX === 'start') { |
| 617 | position.offsetX = isLtr ? -offset : offset; |
| 618 | } else if (position.originX === 'end') { |
| 619 | position.offsetX = isLtr ? offset : -offset; |
| 620 | } |
| 621 | |
| 622 | return position; |
| 623 | } |
| 624 | |
| 625 | /** |
| 626 | * Returns the origin position and a fallback position based on the user's position preference. |