* Clears subscriptions and stops the dragging sequence. * @param event Browser event object that ended the sequence.
(event: MouseEvent | TouchEvent)
| 833 | * @param event Browser event object that ended the sequence. |
| 834 | */ |
| 835 | private _endDragSequence(event: MouseEvent | TouchEvent) { |
| 836 | // Note that here we use `isDragging` from the service, rather than from `this`. |
| 837 | // The difference is that the one from the service reflects whether a dragging sequence |
| 838 | // has been initiated, whereas the one on `this` includes whether the user has passed |
| 839 | // the minimum dragging threshold. |
| 840 | if (!this._dragDropRegistry.isDragging(this)) { |
| 841 | return; |
| 842 | } |
| 843 | |
| 844 | this._removeListeners(); |
| 845 | this._dragDropRegistry.stopDragging(this); |
| 846 | this._toggleNativeDragInteractions(); |
| 847 | |
| 848 | if (this._handles) { |
| 849 | (this._rootElement.style as DragCSSStyleDeclaration).webkitTapHighlightColor = |
| 850 | this._rootElementTapHighlight; |
| 851 | } |
| 852 | |
| 853 | if (!this._hasStartedDragging()) { |
| 854 | return; |
| 855 | } |
| 856 | |
| 857 | this.released.next({source: this, event}); |
| 858 | |
| 859 | if (this._dropContainer) { |
| 860 | // Stop scrolling immediately, instead of waiting for the animation to finish. |
| 861 | this._dropContainer._stopScrolling(); |
| 862 | this._animatePreviewToPlaceholder().then(() => { |
| 863 | this._cleanupDragArtifacts(event); |
| 864 | this._cleanupCachedDimensions(); |
| 865 | this._dragDropRegistry.stopDragging(this); |
| 866 | }); |
| 867 | } else { |
| 868 | // Convert the active transform into a passive one. This means that next time |
| 869 | // the user starts dragging the item, its position will be calculated relatively |
| 870 | // to the new passive transform. |
| 871 | this._passiveTransform.x = this._activeTransform.x; |
| 872 | const pointerPosition = this._getPointerPositionOnPage(event); |
| 873 | this._passiveTransform.y = this._activeTransform.y; |
| 874 | this._ngZone.run(() => { |
| 875 | this.ended.next({ |
| 876 | source: this, |
| 877 | distance: this._getDragDistance(pointerPosition), |
| 878 | dropPoint: pointerPosition, |
| 879 | event, |
| 880 | }); |
| 881 | }); |
| 882 | this._cleanupCachedDimensions(); |
| 883 | this._dragDropRegistry.stopDragging(this); |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | /** Starts the dragging sequence. */ |
| 888 | private _startDragSequence(event: MouseEvent | TouchEvent) { |
no test coverage detected