| 160 | * Reference to a draggable item. Used to manipulate or dispose of the item. |
| 161 | */ |
| 162 | export class DragRef<T = any> { |
| 163 | private _rootElementCleanups: (() => void)[] | undefined; |
| 164 | private _cleanupShadowRootSelectStart: (() => void) | undefined; |
| 165 | |
| 166 | /** Element displayed next to the user's pointer while the element is dragged. */ |
| 167 | private _preview: PreviewRef | null = null; |
| 168 | |
| 169 | /** Container into which to insert the preview. */ |
| 170 | private _previewContainer: PreviewContainer | undefined; |
| 171 | |
| 172 | /** Reference to the view of the placeholder element. */ |
| 173 | private _placeholderRef: EmbeddedViewRef<any> | null = null; |
| 174 | |
| 175 | /** Element that is rendered instead of the draggable item while it is being sorted. */ |
| 176 | private _placeholder!: HTMLElement; |
| 177 | |
| 178 | /** Coordinates within the element at which the user picked up the element. */ |
| 179 | private _pickupPositionInElement!: Point; |
| 180 | |
| 181 | /** Coordinates on the page at which the user picked up the element. */ |
| 182 | private _pickupPositionOnPage!: Point; |
| 183 | |
| 184 | /** |
| 185 | * Marker node used to save the place in the DOM where the element was |
| 186 | * picked up so that it can be restored at the end of the drag sequence. |
| 187 | */ |
| 188 | private _marker!: Comment; |
| 189 | |
| 190 | /** |
| 191 | * Element indicating the position from which the item was picked up initially. |
| 192 | */ |
| 193 | private _anchor: HTMLElement | null = null; |
| 194 | |
| 195 | /** |
| 196 | * CSS `transform` applied to the element when it isn't being dragged. We need a |
| 197 | * passive transform in order for the dragged element to retain its new position |
| 198 | * after the user has stopped dragging and because we need to know the relative |
| 199 | * position in case they start dragging again. This corresponds to `element.style.transform`. |
| 200 | */ |
| 201 | private _passiveTransform: Point = {x: 0, y: 0}; |
| 202 | |
| 203 | /** CSS `transform` that is applied to the element while it's being dragged. */ |
| 204 | private _activeTransform: Point = {x: 0, y: 0}; |
| 205 | |
| 206 | /** Inline `transform` value that the element had before the first dragging sequence. */ |
| 207 | private _initialTransform?: string; |
| 208 | |
| 209 | /** |
| 210 | * Whether the dragging sequence has been started. Doesn't |
| 211 | * necessarily mean that the element has been moved. |
| 212 | */ |
| 213 | private _hasStartedDragging = signal(false); |
| 214 | |
| 215 | /** Whether the element has moved since the user started dragging it. */ |
| 216 | private _hasMoved = false; |
| 217 | |
| 218 | /** Drop container in which the DragRef resided when dragging began. */ |
| 219 | private _initialContainer!: DropListRef; |
nothing calls this directly
no test coverage detected