* Sets an alternate drag root element. The root element is the element that will be moved as * the user is dragging. Passing an alternate root element is useful when trying to enable * dragging on an element that you might not have access to.
(rootElement: ElementRef<HTMLElement> | HTMLElement)
| 493 | * dragging on an element that you might not have access to. |
| 494 | */ |
| 495 | withRootElement(rootElement: ElementRef<HTMLElement> | HTMLElement): this { |
| 496 | const element = coerceElement(rootElement); |
| 497 | |
| 498 | if (element !== this._rootElement) { |
| 499 | this._removeRootElementListeners(); |
| 500 | const renderer = this._renderer; |
| 501 | this._rootElementCleanups = this._ngZone.runOutsideAngular(() => [ |
| 502 | renderer.listen(element, 'mousedown', this._pointerDown, activeEventListenerOptions), |
| 503 | renderer.listen(element, 'touchstart', this._pointerDown, passiveEventListenerOptions), |
| 504 | renderer.listen(element, 'dragstart', this._nativeDragStart, activeEventListenerOptions), |
| 505 | ]); |
| 506 | this._initialTransform = undefined; |
| 507 | this._rootElement = element; |
| 508 | } |
| 509 | |
| 510 | if (typeof SVGElement !== 'undefined' && this._rootElement instanceof SVGElement) { |
| 511 | this._ownerSVGElement = this._rootElement.ownerSVGElement; |
| 512 | } |
| 513 | |
| 514 | return this; |
| 515 | } |
| 516 | |
| 517 | /** |
| 518 | * Element to which the draggable's position will be constrained. |
no test coverage detected