Gets the element into which the drag preview should be inserted.
(
initialParent: HTMLElement,
shadowRoot: ShadowRoot | null,
)
| 1568 | |
| 1569 | /** Gets the element into which the drag preview should be inserted. */ |
| 1570 | private _getPreviewInsertionPoint( |
| 1571 | initialParent: HTMLElement, |
| 1572 | shadowRoot: ShadowRoot | null, |
| 1573 | ): HTMLElement { |
| 1574 | const previewContainer = this._previewContainer || 'global'; |
| 1575 | |
| 1576 | if (previewContainer === 'parent') { |
| 1577 | return initialParent; |
| 1578 | } |
| 1579 | |
| 1580 | if (previewContainer === 'global') { |
| 1581 | const documentRef = this._document; |
| 1582 | |
| 1583 | // We can't use the body if the user is in fullscreen mode, |
| 1584 | // because the preview will render under the fullscreen element. |
| 1585 | // TODO(crisbeto): dedupe this with the `FullscreenOverlayContainer` eventually. |
| 1586 | return ( |
| 1587 | shadowRoot || |
| 1588 | documentRef.fullscreenElement || |
| 1589 | (documentRef as any).webkitFullscreenElement || |
| 1590 | (documentRef as any).mozFullScreenElement || |
| 1591 | (documentRef as any).msFullscreenElement || |
| 1592 | documentRef.body |
| 1593 | ); |
| 1594 | } |
| 1595 | |
| 1596 | return coerceElement(previewContainer); |
| 1597 | } |
| 1598 | |
| 1599 | /** Lazily resolves and returns the dimensions of the preview. */ |
| 1600 | private _getPreviewRect(): DOMRect { |
no test coverage detected