MCPcopy Create free account
hub / github.com/angular/components / _getPreviewInsertionPoint

Method _getPreviewInsertionPoint

src/cdk/drag-drop/drag-ref.ts:1570–1597  ·  view source on GitHub ↗

Gets the element into which the drag preview should be inserted.

(
    initialParent: HTMLElement,
    shadowRoot: ShadowRoot | null,
  )

Source from the content-addressed store, hash-verified

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 {

Callers 1

_startDragSequenceMethod · 0.95

Calls 1

coerceElementFunction · 0.90

Tested by

no test coverage detected