1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { normalizePassiveListenerOptions, _getEventTarget, _getShadowRoot, } from '@angular/cdk/platform';
|
---|
9 | import { coerceBooleanProperty, coerceElement } from '@angular/cdk/coercion';
|
---|
10 | import { isFakeMousedownFromScreenReader, isFakeTouchstartFromScreenReader, } from '@angular/cdk/a11y';
|
---|
11 | import { Subscription, Subject } from 'rxjs';
|
---|
12 | import { combineTransforms, extendStyles, toggleNativeDragInteractions, toggleVisibility, } from './drag-styling';
|
---|
13 | import { getTransformTransitionDurationInMs } from './transition-duration';
|
---|
14 | import { getMutableClientRect, adjustClientRect } from './client-rect';
|
---|
15 | import { ParentPositionTracker } from './parent-position-tracker';
|
---|
16 | import { deepCloneNode } from './clone-node';
|
---|
17 | /** Options that can be used to bind a passive event listener. */
|
---|
18 | const passiveEventListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
---|
19 | /** Options that can be used to bind an active event listener. */
|
---|
20 | const activeEventListenerOptions = normalizePassiveListenerOptions({ passive: false });
|
---|
21 | /**
|
---|
22 | * Time in milliseconds for which to ignore mouse events, after
|
---|
23 | * receiving a touch event. Used to avoid doing double work for
|
---|
24 | * touch devices where the browser fires fake mouse events, in
|
---|
25 | * addition to touch events.
|
---|
26 | */
|
---|
27 | const MOUSE_EVENT_IGNORE_TIME = 800;
|
---|
28 | /** Inline styles to be set as `!important` while dragging. */
|
---|
29 | const dragImportantProperties = new Set([
|
---|
30 | // Needs to be important, because some `mat-table` sets `position: sticky !important`. See #22781.
|
---|
31 | 'position'
|
---|
32 | ]);
|
---|
33 | /**
|
---|
34 | * Reference to a draggable item. Used to manipulate or dispose of the item.
|
---|
35 | */
|
---|
36 | export class DragRef {
|
---|
37 | constructor(element, _config, _document, _ngZone, _viewportRuler, _dragDropRegistry) {
|
---|
38 | this._config = _config;
|
---|
39 | this._document = _document;
|
---|
40 | this._ngZone = _ngZone;
|
---|
41 | this._viewportRuler = _viewportRuler;
|
---|
42 | this._dragDropRegistry = _dragDropRegistry;
|
---|
43 | /**
|
---|
44 | * CSS `transform` applied to the element when it isn't being dragged. We need a
|
---|
45 | * passive transform in order for the dragged element to retain its new position
|
---|
46 | * after the user has stopped dragging and because we need to know the relative
|
---|
47 | * position in case they start dragging again. This corresponds to `element.style.transform`.
|
---|
48 | */
|
---|
49 | this._passiveTransform = { x: 0, y: 0 };
|
---|
50 | /** CSS `transform` that is applied to the element while it's being dragged. */
|
---|
51 | this._activeTransform = { x: 0, y: 0 };
|
---|
52 | /**
|
---|
53 | * Whether the dragging sequence has been started. Doesn't
|
---|
54 | * necessarily mean that the element has been moved.
|
---|
55 | */
|
---|
56 | this._hasStartedDragging = false;
|
---|
57 | /** Emits when the item is being moved. */
|
---|
58 | this._moveEvents = new Subject();
|
---|
59 | /** Subscription to pointer movement events. */
|
---|
60 | this._pointerMoveSubscription = Subscription.EMPTY;
|
---|
61 | /** Subscription to the event that is dispatched when the user lifts their pointer. */
|
---|
62 | this._pointerUpSubscription = Subscription.EMPTY;
|
---|
63 | /** Subscription to the viewport being scrolled. */
|
---|
64 | this._scrollSubscription = Subscription.EMPTY;
|
---|
65 | /** Subscription to the viewport being resized. */
|
---|
66 | this._resizeSubscription = Subscription.EMPTY;
|
---|
67 | /** Cached reference to the boundary element. */
|
---|
68 | this._boundaryElement = null;
|
---|
69 | /** Whether the native dragging interactions have been enabled on the root element. */
|
---|
70 | this._nativeInteractionsEnabled = true;
|
---|
71 | /** Elements that can be used to drag the draggable item. */
|
---|
72 | this._handles = [];
|
---|
73 | /** Registered handles that are currently disabled. */
|
---|
74 | this._disabledHandles = new Set();
|
---|
75 | /** Layout direction of the item. */
|
---|
76 | this._direction = 'ltr';
|
---|
77 | /**
|
---|
78 | * Amount of milliseconds to wait after the user has put their
|
---|
79 | * pointer down before starting to drag the element.
|
---|
80 | */
|
---|
81 | this.dragStartDelay = 0;
|
---|
82 | this._disabled = false;
|
---|
83 | /** Emits as the drag sequence is being prepared. */
|
---|
84 | this.beforeStarted = new Subject();
|
---|
85 | /** Emits when the user starts dragging the item. */
|
---|
86 | this.started = new Subject();
|
---|
87 | /** Emits when the user has released a drag item, before any animations have started. */
|
---|
88 | this.released = new Subject();
|
---|
89 | /** Emits when the user stops dragging an item in the container. */
|
---|
90 | this.ended = new Subject();
|
---|
91 | /** Emits when the user has moved the item into a new container. */
|
---|
92 | this.entered = new Subject();
|
---|
93 | /** Emits when the user removes the item its container by dragging it into another container. */
|
---|
94 | this.exited = new Subject();
|
---|
95 | /** Emits when the user drops the item inside a container. */
|
---|
96 | this.dropped = new Subject();
|
---|
97 | /**
|
---|
98 | * Emits as the user is dragging the item. Use with caution,
|
---|
99 | * because this event will fire for every pixel that the user has dragged.
|
---|
100 | */
|
---|
101 | this.moved = this._moveEvents;
|
---|
102 | /** Handler for the `mousedown`/`touchstart` events. */
|
---|
103 | this._pointerDown = (event) => {
|
---|
104 | this.beforeStarted.next();
|
---|
105 | // Delegate the event based on whether it started from a handle or the element itself.
|
---|
106 | if (this._handles.length) {
|
---|
107 | const targetHandle = this._handles.find(handle => {
|
---|
108 | const target = _getEventTarget(event);
|
---|
109 | return !!target && (target === handle || handle.contains(target));
|
---|
110 | });
|
---|
111 | if (targetHandle && !this._disabledHandles.has(targetHandle) && !this.disabled) {
|
---|
112 | this._initializeDragSequence(targetHandle, event);
|
---|
113 | }
|
---|
114 | }
|
---|
115 | else if (!this.disabled) {
|
---|
116 | this._initializeDragSequence(this._rootElement, event);
|
---|
117 | }
|
---|
118 | };
|
---|
119 | /** Handler that is invoked when the user moves their pointer after they've initiated a drag. */
|
---|
120 | this._pointerMove = (event) => {
|
---|
121 | const pointerPosition = this._getPointerPositionOnPage(event);
|
---|
122 | if (!this._hasStartedDragging) {
|
---|
123 | const distanceX = Math.abs(pointerPosition.x - this._pickupPositionOnPage.x);
|
---|
124 | const distanceY = Math.abs(pointerPosition.y - this._pickupPositionOnPage.y);
|
---|
125 | const isOverThreshold = distanceX + distanceY >= this._config.dragStartThreshold;
|
---|
126 | // Only start dragging after the user has moved more than the minimum distance in either
|
---|
127 | // direction. Note that this is preferrable over doing something like `skip(minimumDistance)`
|
---|
128 | // in the `pointerMove` subscription, because we're not guaranteed to have one move event
|
---|
129 | // per pixel of movement (e.g. if the user moves their pointer quickly).
|
---|
130 | if (isOverThreshold) {
|
---|
131 | const isDelayElapsed = Date.now() >= this._dragStartTime + this._getDragStartDelay(event);
|
---|
132 | const container = this._dropContainer;
|
---|
133 | if (!isDelayElapsed) {
|
---|
134 | this._endDragSequence(event);
|
---|
135 | return;
|
---|
136 | }
|
---|
137 | // Prevent other drag sequences from starting while something in the container is still
|
---|
138 | // being dragged. This can happen while we're waiting for the drop animation to finish
|
---|
139 | // and can cause errors, because some elements might still be moving around.
|
---|
140 | if (!container || (!container.isDragging() && !container.isReceiving())) {
|
---|
141 | // Prevent the default action as soon as the dragging sequence is considered as
|
---|
142 | // "started" since waiting for the next event can allow the device to begin scrolling.
|
---|
143 | event.preventDefault();
|
---|
144 | this._hasStartedDragging = true;
|
---|
145 | this._ngZone.run(() => this._startDragSequence(event));
|
---|
146 | }
|
---|
147 | }
|
---|
148 | return;
|
---|
149 | }
|
---|
150 | // We only need the preview dimensions if we have a boundary element.
|
---|
151 | if (this._boundaryElement) {
|
---|
152 | // Cache the preview element rect if we haven't cached it already or if
|
---|
153 | // we cached it too early before the element dimensions were computed.
|
---|
154 | if (!this._previewRect || (!this._previewRect.width && !this._previewRect.height)) {
|
---|
155 | this._previewRect = (this._preview || this._rootElement).getBoundingClientRect();
|
---|
156 | }
|
---|
157 | }
|
---|
158 | // We prevent the default action down here so that we know that dragging has started. This is
|
---|
159 | // important for touch devices where doing this too early can unnecessarily block scrolling,
|
---|
160 | // if there's a dragging delay.
|
---|
161 | event.preventDefault();
|
---|
162 | const constrainedPointerPosition = this._getConstrainedPointerPosition(pointerPosition);
|
---|
163 | this._hasMoved = true;
|
---|
164 | this._lastKnownPointerPosition = pointerPosition;
|
---|
165 | this._updatePointerDirectionDelta(constrainedPointerPosition);
|
---|
166 | if (this._dropContainer) {
|
---|
167 | this._updateActiveDropContainer(constrainedPointerPosition, pointerPosition);
|
---|
168 | }
|
---|
169 | else {
|
---|
170 | const activeTransform = this._activeTransform;
|
---|
171 | activeTransform.x =
|
---|
172 | constrainedPointerPosition.x - this._pickupPositionOnPage.x + this._passiveTransform.x;
|
---|
173 | activeTransform.y =
|
---|
174 | constrainedPointerPosition.y - this._pickupPositionOnPage.y + this._passiveTransform.y;
|
---|
175 | this._applyRootElementTransform(activeTransform.x, activeTransform.y);
|
---|
176 | // Apply transform as attribute if dragging and svg element to work for IE
|
---|
177 | if (typeof SVGElement !== 'undefined' && this._rootElement instanceof SVGElement) {
|
---|
178 | const appliedTransform = `translate(${activeTransform.x} ${activeTransform.y})`;
|
---|
179 | this._rootElement.setAttribute('transform', appliedTransform);
|
---|
180 | }
|
---|
181 | }
|
---|
182 | // Since this event gets fired for every pixel while dragging, we only
|
---|
183 | // want to fire it if the consumer opted into it. Also we have to
|
---|
184 | // re-enter the zone because we run all of the events on the outside.
|
---|
185 | if (this._moveEvents.observers.length) {
|
---|
186 | this._ngZone.run(() => {
|
---|
187 | this._moveEvents.next({
|
---|
188 | source: this,
|
---|
189 | pointerPosition: constrainedPointerPosition,
|
---|
190 | event,
|
---|
191 | distance: this._getDragDistance(constrainedPointerPosition),
|
---|
192 | delta: this._pointerDirectionDelta
|
---|
193 | });
|
---|
194 | });
|
---|
195 | }
|
---|
196 | };
|
---|
197 | /** Handler that is invoked when the user lifts their pointer up, after initiating a drag. */
|
---|
198 | this._pointerUp = (event) => {
|
---|
199 | this._endDragSequence(event);
|
---|
200 | };
|
---|
201 | this.withRootElement(element).withParent(_config.parentDragRef || null);
|
---|
202 | this._parentPositions = new ParentPositionTracker(_document, _viewportRuler);
|
---|
203 | _dragDropRegistry.registerDragItem(this);
|
---|
204 | }
|
---|
205 | /** Whether starting to drag this element is disabled. */
|
---|
206 | get disabled() {
|
---|
207 | return this._disabled || !!(this._dropContainer && this._dropContainer.disabled);
|
---|
208 | }
|
---|
209 | set disabled(value) {
|
---|
210 | const newValue = coerceBooleanProperty(value);
|
---|
211 | if (newValue !== this._disabled) {
|
---|
212 | this._disabled = newValue;
|
---|
213 | this._toggleNativeDragInteractions();
|
---|
214 | this._handles.forEach(handle => toggleNativeDragInteractions(handle, newValue));
|
---|
215 | }
|
---|
216 | }
|
---|
217 | /**
|
---|
218 | * Returns the element that is being used as a placeholder
|
---|
219 | * while the current element is being dragged.
|
---|
220 | */
|
---|
221 | getPlaceholderElement() {
|
---|
222 | return this._placeholder;
|
---|
223 | }
|
---|
224 | /** Returns the root draggable element. */
|
---|
225 | getRootElement() {
|
---|
226 | return this._rootElement;
|
---|
227 | }
|
---|
228 | /**
|
---|
229 | * Gets the currently-visible element that represents the drag item.
|
---|
230 | * While dragging this is the placeholder, otherwise it's the root element.
|
---|
231 | */
|
---|
232 | getVisibleElement() {
|
---|
233 | return this.isDragging() ? this.getPlaceholderElement() : this.getRootElement();
|
---|
234 | }
|
---|
235 | /** Registers the handles that can be used to drag the element. */
|
---|
236 | withHandles(handles) {
|
---|
237 | this._handles = handles.map(handle => coerceElement(handle));
|
---|
238 | this._handles.forEach(handle => toggleNativeDragInteractions(handle, this.disabled));
|
---|
239 | this._toggleNativeDragInteractions();
|
---|
240 | // Delete any lingering disabled handles that may have been destroyed. Note that we re-create
|
---|
241 | // the set, rather than iterate over it and filter out the destroyed handles, because while
|
---|
242 | // the ES spec allows for sets to be modified while they're being iterated over, some polyfills
|
---|
243 | // use an array internally which may throw an error.
|
---|
244 | const disabledHandles = new Set();
|
---|
245 | this._disabledHandles.forEach(handle => {
|
---|
246 | if (this._handles.indexOf(handle) > -1) {
|
---|
247 | disabledHandles.add(handle);
|
---|
248 | }
|
---|
249 | });
|
---|
250 | this._disabledHandles = disabledHandles;
|
---|
251 | return this;
|
---|
252 | }
|
---|
253 | /**
|
---|
254 | * Registers the template that should be used for the drag preview.
|
---|
255 | * @param template Template that from which to stamp out the preview.
|
---|
256 | */
|
---|
257 | withPreviewTemplate(template) {
|
---|
258 | this._previewTemplate = template;
|
---|
259 | return this;
|
---|
260 | }
|
---|
261 | /**
|
---|
262 | * Registers the template that should be used for the drag placeholder.
|
---|
263 | * @param template Template that from which to stamp out the placeholder.
|
---|
264 | */
|
---|
265 | withPlaceholderTemplate(template) {
|
---|
266 | this._placeholderTemplate = template;
|
---|
267 | return this;
|
---|
268 | }
|
---|
269 | /**
|
---|
270 | * Sets an alternate drag root element. The root element is the element that will be moved as
|
---|
271 | * the user is dragging. Passing an alternate root element is useful when trying to enable
|
---|
272 | * dragging on an element that you might not have access to.
|
---|
273 | */
|
---|
274 | withRootElement(rootElement) {
|
---|
275 | const element = coerceElement(rootElement);
|
---|
276 | if (element !== this._rootElement) {
|
---|
277 | if (this._rootElement) {
|
---|
278 | this._removeRootElementListeners(this._rootElement);
|
---|
279 | }
|
---|
280 | this._ngZone.runOutsideAngular(() => {
|
---|
281 | element.addEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
|
---|
282 | element.addEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
---|
283 | });
|
---|
284 | this._initialTransform = undefined;
|
---|
285 | this._rootElement = element;
|
---|
286 | }
|
---|
287 | if (typeof SVGElement !== 'undefined' && this._rootElement instanceof SVGElement) {
|
---|
288 | this._ownerSVGElement = this._rootElement.ownerSVGElement;
|
---|
289 | }
|
---|
290 | return this;
|
---|
291 | }
|
---|
292 | /**
|
---|
293 | * Element to which the draggable's position will be constrained.
|
---|
294 | */
|
---|
295 | withBoundaryElement(boundaryElement) {
|
---|
296 | this._boundaryElement = boundaryElement ? coerceElement(boundaryElement) : null;
|
---|
297 | this._resizeSubscription.unsubscribe();
|
---|
298 | if (boundaryElement) {
|
---|
299 | this._resizeSubscription = this._viewportRuler
|
---|
300 | .change(10)
|
---|
301 | .subscribe(() => this._containInsideBoundaryOnResize());
|
---|
302 | }
|
---|
303 | return this;
|
---|
304 | }
|
---|
305 | /** Sets the parent ref that the ref is nested in. */
|
---|
306 | withParent(parent) {
|
---|
307 | this._parentDragRef = parent;
|
---|
308 | return this;
|
---|
309 | }
|
---|
310 | /** Removes the dragging functionality from the DOM element. */
|
---|
311 | dispose() {
|
---|
312 | this._removeRootElementListeners(this._rootElement);
|
---|
313 | // Do this check before removing from the registry since it'll
|
---|
314 | // stop being considered as dragged once it is removed.
|
---|
315 | if (this.isDragging()) {
|
---|
316 | // Since we move out the element to the end of the body while it's being
|
---|
317 | // dragged, we have to make sure that it's removed if it gets destroyed.
|
---|
318 | removeNode(this._rootElement);
|
---|
319 | }
|
---|
320 | removeNode(this._anchor);
|
---|
321 | this._destroyPreview();
|
---|
322 | this._destroyPlaceholder();
|
---|
323 | this._dragDropRegistry.removeDragItem(this);
|
---|
324 | this._removeSubscriptions();
|
---|
325 | this.beforeStarted.complete();
|
---|
326 | this.started.complete();
|
---|
327 | this.released.complete();
|
---|
328 | this.ended.complete();
|
---|
329 | this.entered.complete();
|
---|
330 | this.exited.complete();
|
---|
331 | this.dropped.complete();
|
---|
332 | this._moveEvents.complete();
|
---|
333 | this._handles = [];
|
---|
334 | this._disabledHandles.clear();
|
---|
335 | this._dropContainer = undefined;
|
---|
336 | this._resizeSubscription.unsubscribe();
|
---|
337 | this._parentPositions.clear();
|
---|
338 | this._boundaryElement = this._rootElement = this._ownerSVGElement = this._placeholderTemplate =
|
---|
339 | this._previewTemplate = this._anchor = this._parentDragRef = null;
|
---|
340 | }
|
---|
341 | /** Checks whether the element is currently being dragged. */
|
---|
342 | isDragging() {
|
---|
343 | return this._hasStartedDragging && this._dragDropRegistry.isDragging(this);
|
---|
344 | }
|
---|
345 | /** Resets a standalone drag item to its initial position. */
|
---|
346 | reset() {
|
---|
347 | this._rootElement.style.transform = this._initialTransform || '';
|
---|
348 | this._activeTransform = { x: 0, y: 0 };
|
---|
349 | this._passiveTransform = { x: 0, y: 0 };
|
---|
350 | }
|
---|
351 | /**
|
---|
352 | * Sets a handle as disabled. While a handle is disabled, it'll capture and interrupt dragging.
|
---|
353 | * @param handle Handle element that should be disabled.
|
---|
354 | */
|
---|
355 | disableHandle(handle) {
|
---|
356 | if (!this._disabledHandles.has(handle) && this._handles.indexOf(handle) > -1) {
|
---|
357 | this._disabledHandles.add(handle);
|
---|
358 | toggleNativeDragInteractions(handle, true);
|
---|
359 | }
|
---|
360 | }
|
---|
361 | /**
|
---|
362 | * Enables a handle, if it has been disabled.
|
---|
363 | * @param handle Handle element to be enabled.
|
---|
364 | */
|
---|
365 | enableHandle(handle) {
|
---|
366 | if (this._disabledHandles.has(handle)) {
|
---|
367 | this._disabledHandles.delete(handle);
|
---|
368 | toggleNativeDragInteractions(handle, this.disabled);
|
---|
369 | }
|
---|
370 | }
|
---|
371 | /** Sets the layout direction of the draggable item. */
|
---|
372 | withDirection(direction) {
|
---|
373 | this._direction = direction;
|
---|
374 | return this;
|
---|
375 | }
|
---|
376 | /** Sets the container that the item is part of. */
|
---|
377 | _withDropContainer(container) {
|
---|
378 | this._dropContainer = container;
|
---|
379 | }
|
---|
380 | /**
|
---|
381 | * Gets the current position in pixels the draggable outside of a drop container.
|
---|
382 | */
|
---|
383 | getFreeDragPosition() {
|
---|
384 | const position = this.isDragging() ? this._activeTransform : this._passiveTransform;
|
---|
385 | return { x: position.x, y: position.y };
|
---|
386 | }
|
---|
387 | /**
|
---|
388 | * Sets the current position in pixels the draggable outside of a drop container.
|
---|
389 | * @param value New position to be set.
|
---|
390 | */
|
---|
391 | setFreeDragPosition(value) {
|
---|
392 | this._activeTransform = { x: 0, y: 0 };
|
---|
393 | this._passiveTransform.x = value.x;
|
---|
394 | this._passiveTransform.y = value.y;
|
---|
395 | if (!this._dropContainer) {
|
---|
396 | this._applyRootElementTransform(value.x, value.y);
|
---|
397 | }
|
---|
398 | return this;
|
---|
399 | }
|
---|
400 | /**
|
---|
401 | * Sets the container into which to insert the preview element.
|
---|
402 | * @param value Container into which to insert the preview.
|
---|
403 | */
|
---|
404 | withPreviewContainer(value) {
|
---|
405 | this._previewContainer = value;
|
---|
406 | return this;
|
---|
407 | }
|
---|
408 | /** Updates the item's sort order based on the last-known pointer position. */
|
---|
409 | _sortFromLastPointerPosition() {
|
---|
410 | const position = this._lastKnownPointerPosition;
|
---|
411 | if (position && this._dropContainer) {
|
---|
412 | this._updateActiveDropContainer(this._getConstrainedPointerPosition(position), position);
|
---|
413 | }
|
---|
414 | }
|
---|
415 | /** Unsubscribes from the global subscriptions. */
|
---|
416 | _removeSubscriptions() {
|
---|
417 | this._pointerMoveSubscription.unsubscribe();
|
---|
418 | this._pointerUpSubscription.unsubscribe();
|
---|
419 | this._scrollSubscription.unsubscribe();
|
---|
420 | }
|
---|
421 | /** Destroys the preview element and its ViewRef. */
|
---|
422 | _destroyPreview() {
|
---|
423 | if (this._preview) {
|
---|
424 | removeNode(this._preview);
|
---|
425 | }
|
---|
426 | if (this._previewRef) {
|
---|
427 | this._previewRef.destroy();
|
---|
428 | }
|
---|
429 | this._preview = this._previewRef = null;
|
---|
430 | }
|
---|
431 | /** Destroys the placeholder element and its ViewRef. */
|
---|
432 | _destroyPlaceholder() {
|
---|
433 | if (this._placeholder) {
|
---|
434 | removeNode(this._placeholder);
|
---|
435 | }
|
---|
436 | if (this._placeholderRef) {
|
---|
437 | this._placeholderRef.destroy();
|
---|
438 | }
|
---|
439 | this._placeholder = this._placeholderRef = null;
|
---|
440 | }
|
---|
441 | /**
|
---|
442 | * Clears subscriptions and stops the dragging sequence.
|
---|
443 | * @param event Browser event object that ended the sequence.
|
---|
444 | */
|
---|
445 | _endDragSequence(event) {
|
---|
446 | // Note that here we use `isDragging` from the service, rather than from `this`.
|
---|
447 | // The difference is that the one from the service reflects whether a dragging sequence
|
---|
448 | // has been initiated, whereas the one on `this` includes whether the user has passed
|
---|
449 | // the minimum dragging threshold.
|
---|
450 | if (!this._dragDropRegistry.isDragging(this)) {
|
---|
451 | return;
|
---|
452 | }
|
---|
453 | this._removeSubscriptions();
|
---|
454 | this._dragDropRegistry.stopDragging(this);
|
---|
455 | this._toggleNativeDragInteractions();
|
---|
456 | if (this._handles) {
|
---|
457 | this._rootElement.style.webkitTapHighlightColor = this._rootElementTapHighlight;
|
---|
458 | }
|
---|
459 | if (!this._hasStartedDragging) {
|
---|
460 | return;
|
---|
461 | }
|
---|
462 | this.released.next({ source: this });
|
---|
463 | if (this._dropContainer) {
|
---|
464 | // Stop scrolling immediately, instead of waiting for the animation to finish.
|
---|
465 | this._dropContainer._stopScrolling();
|
---|
466 | this._animatePreviewToPlaceholder().then(() => {
|
---|
467 | this._cleanupDragArtifacts(event);
|
---|
468 | this._cleanupCachedDimensions();
|
---|
469 | this._dragDropRegistry.stopDragging(this);
|
---|
470 | });
|
---|
471 | }
|
---|
472 | else {
|
---|
473 | // Convert the active transform into a passive one. This means that next time
|
---|
474 | // the user starts dragging the item, its position will be calculated relatively
|
---|
475 | // to the new passive transform.
|
---|
476 | this._passiveTransform.x = this._activeTransform.x;
|
---|
477 | const pointerPosition = this._getPointerPositionOnPage(event);
|
---|
478 | this._passiveTransform.y = this._activeTransform.y;
|
---|
479 | this._ngZone.run(() => {
|
---|
480 | this.ended.next({
|
---|
481 | source: this,
|
---|
482 | distance: this._getDragDistance(pointerPosition),
|
---|
483 | dropPoint: pointerPosition
|
---|
484 | });
|
---|
485 | });
|
---|
486 | this._cleanupCachedDimensions();
|
---|
487 | this._dragDropRegistry.stopDragging(this);
|
---|
488 | }
|
---|
489 | }
|
---|
490 | /** Starts the dragging sequence. */
|
---|
491 | _startDragSequence(event) {
|
---|
492 | if (isTouchEvent(event)) {
|
---|
493 | this._lastTouchEventTime = Date.now();
|
---|
494 | }
|
---|
495 | this._toggleNativeDragInteractions();
|
---|
496 | const dropContainer = this._dropContainer;
|
---|
497 | if (dropContainer) {
|
---|
498 | const element = this._rootElement;
|
---|
499 | const parent = element.parentNode;
|
---|
500 | const placeholder = this._placeholder = this._createPlaceholderElement();
|
---|
501 | const anchor = this._anchor = this._anchor || this._document.createComment('');
|
---|
502 | // Needs to happen before the root element is moved.
|
---|
503 | const shadowRoot = this._getShadowRoot();
|
---|
504 | // Insert an anchor node so that we can restore the element's position in the DOM.
|
---|
505 | parent.insertBefore(anchor, element);
|
---|
506 | // There's no risk of transforms stacking when inside a drop container so
|
---|
507 | // we can keep the initial transform up to date any time dragging starts.
|
---|
508 | this._initialTransform = element.style.transform || '';
|
---|
509 | // Create the preview after the initial transform has
|
---|
510 | // been cached, because it can be affected by the transform.
|
---|
511 | this._preview = this._createPreviewElement();
|
---|
512 | // We move the element out at the end of the body and we make it hidden, because keeping it in
|
---|
513 | // place will throw off the consumer's `:last-child` selectors. We can't remove the element
|
---|
514 | // from the DOM completely, because iOS will stop firing all subsequent events in the chain.
|
---|
515 | toggleVisibility(element, false, dragImportantProperties);
|
---|
516 | this._document.body.appendChild(parent.replaceChild(placeholder, element));
|
---|
517 | this._getPreviewInsertionPoint(parent, shadowRoot).appendChild(this._preview);
|
---|
518 | this.started.next({ source: this }); // Emit before notifying the container.
|
---|
519 | dropContainer.start();
|
---|
520 | this._initialContainer = dropContainer;
|
---|
521 | this._initialIndex = dropContainer.getItemIndex(this);
|
---|
522 | }
|
---|
523 | else {
|
---|
524 | this.started.next({ source: this });
|
---|
525 | this._initialContainer = this._initialIndex = undefined;
|
---|
526 | }
|
---|
527 | // Important to run after we've called `start` on the parent container
|
---|
528 | // so that it has had time to resolve its scrollable parents.
|
---|
529 | this._parentPositions.cache(dropContainer ? dropContainer.getScrollableParents() : []);
|
---|
530 | }
|
---|
531 | /**
|
---|
532 | * Sets up the different variables and subscriptions
|
---|
533 | * that will be necessary for the dragging sequence.
|
---|
534 | * @param referenceElement Element that started the drag sequence.
|
---|
535 | * @param event Browser event object that started the sequence.
|
---|
536 | */
|
---|
537 | _initializeDragSequence(referenceElement, event) {
|
---|
538 | // Stop propagation if the item is inside another
|
---|
539 | // draggable so we don't start multiple drag sequences.
|
---|
540 | if (this._parentDragRef) {
|
---|
541 | event.stopPropagation();
|
---|
542 | }
|
---|
543 | const isDragging = this.isDragging();
|
---|
544 | const isTouchSequence = isTouchEvent(event);
|
---|
545 | const isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
|
---|
546 | const rootElement = this._rootElement;
|
---|
547 | const target = _getEventTarget(event);
|
---|
548 | const isSyntheticEvent = !isTouchSequence && this._lastTouchEventTime &&
|
---|
549 | this._lastTouchEventTime + MOUSE_EVENT_IGNORE_TIME > Date.now();
|
---|
550 | const isFakeEvent = isTouchSequence ? isFakeTouchstartFromScreenReader(event) :
|
---|
551 | isFakeMousedownFromScreenReader(event);
|
---|
552 | // If the event started from an element with the native HTML drag&drop, it'll interfere
|
---|
553 | // with our own dragging (e.g. `img` tags do it by default). Prevent the default action
|
---|
554 | // to stop it from happening. Note that preventing on `dragstart` also seems to work, but
|
---|
555 | // it's flaky and it fails if the user drags it away quickly. Also note that we only want
|
---|
556 | // to do this for `mousedown` since doing the same for `touchstart` will stop any `click`
|
---|
557 | // events from firing on touch devices.
|
---|
558 | if (target && target.draggable && event.type === 'mousedown') {
|
---|
559 | event.preventDefault();
|
---|
560 | }
|
---|
561 | // Abort if the user is already dragging or is using a mouse button other than the primary one.
|
---|
562 | if (isDragging || isAuxiliaryMouseButton || isSyntheticEvent || isFakeEvent) {
|
---|
563 | return;
|
---|
564 | }
|
---|
565 | // If we've got handles, we need to disable the tap highlight on the entire root element,
|
---|
566 | // otherwise iOS will still add it, even though all the drag interactions on the handle
|
---|
567 | // are disabled.
|
---|
568 | if (this._handles.length) {
|
---|
569 | this._rootElementTapHighlight = rootElement.style.webkitTapHighlightColor || '';
|
---|
570 | rootElement.style.webkitTapHighlightColor = 'transparent';
|
---|
571 | }
|
---|
572 | this._hasStartedDragging = this._hasMoved = false;
|
---|
573 | // Avoid multiple subscriptions and memory leaks when multi touch
|
---|
574 | // (isDragging check above isn't enough because of possible temporal and/or dimensional delays)
|
---|
575 | this._removeSubscriptions();
|
---|
576 | this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
|
---|
577 | this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
|
---|
578 | this._scrollSubscription = this._dragDropRegistry
|
---|
579 | .scrolled(this._getShadowRoot())
|
---|
580 | .subscribe(scrollEvent => this._updateOnScroll(scrollEvent));
|
---|
581 | if (this._boundaryElement) {
|
---|
582 | this._boundaryRect = getMutableClientRect(this._boundaryElement);
|
---|
583 | }
|
---|
584 | // If we have a custom preview we can't know ahead of time how large it'll be so we position
|
---|
585 | // it next to the cursor. The exception is when the consumer has opted into making the preview
|
---|
586 | // the same size as the root element, in which case we do know the size.
|
---|
587 | const previewTemplate = this._previewTemplate;
|
---|
588 | this._pickupPositionInElement = previewTemplate && previewTemplate.template &&
|
---|
589 | !previewTemplate.matchSize ? { x: 0, y: 0 } :
|
---|
590 | this._getPointerPositionInElement(referenceElement, event);
|
---|
591 | const pointerPosition = this._pickupPositionOnPage = this._lastKnownPointerPosition =
|
---|
592 | this._getPointerPositionOnPage(event);
|
---|
593 | this._pointerDirectionDelta = { x: 0, y: 0 };
|
---|
594 | this._pointerPositionAtLastDirectionChange = { x: pointerPosition.x, y: pointerPosition.y };
|
---|
595 | this._dragStartTime = Date.now();
|
---|
596 | this._dragDropRegistry.startDragging(this, event);
|
---|
597 | }
|
---|
598 | /** Cleans up the DOM artifacts that were added to facilitate the element being dragged. */
|
---|
599 | _cleanupDragArtifacts(event) {
|
---|
600 | // Restore the element's visibility and insert it at its old position in the DOM.
|
---|
601 | // It's important that we maintain the position, because moving the element around in the DOM
|
---|
602 | // can throw off `NgFor` which does smart diffing and re-creates elements only when necessary,
|
---|
603 | // while moving the existing elements in all other cases.
|
---|
604 | toggleVisibility(this._rootElement, true, dragImportantProperties);
|
---|
605 | this._anchor.parentNode.replaceChild(this._rootElement, this._anchor);
|
---|
606 | this._destroyPreview();
|
---|
607 | this._destroyPlaceholder();
|
---|
608 | this._boundaryRect = this._previewRect = this._initialTransform = undefined;
|
---|
609 | // Re-enter the NgZone since we bound `document` events on the outside.
|
---|
610 | this._ngZone.run(() => {
|
---|
611 | const container = this._dropContainer;
|
---|
612 | const currentIndex = container.getItemIndex(this);
|
---|
613 | const pointerPosition = this._getPointerPositionOnPage(event);
|
---|
614 | const distance = this._getDragDistance(pointerPosition);
|
---|
615 | const isPointerOverContainer = container._isOverContainer(pointerPosition.x, pointerPosition.y);
|
---|
616 | this.ended.next({ source: this, distance, dropPoint: pointerPosition });
|
---|
617 | this.dropped.next({
|
---|
618 | item: this,
|
---|
619 | currentIndex,
|
---|
620 | previousIndex: this._initialIndex,
|
---|
621 | container: container,
|
---|
622 | previousContainer: this._initialContainer,
|
---|
623 | isPointerOverContainer,
|
---|
624 | distance,
|
---|
625 | dropPoint: pointerPosition
|
---|
626 | });
|
---|
627 | container.drop(this, currentIndex, this._initialIndex, this._initialContainer, isPointerOverContainer, distance, pointerPosition);
|
---|
628 | this._dropContainer = this._initialContainer;
|
---|
629 | });
|
---|
630 | }
|
---|
631 | /**
|
---|
632 | * Updates the item's position in its drop container, or moves it
|
---|
633 | * into a new one, depending on its current drag position.
|
---|
634 | */
|
---|
635 | _updateActiveDropContainer({ x, y }, { x: rawX, y: rawY }) {
|
---|
636 | // Drop container that draggable has been moved into.
|
---|
637 | let newContainer = this._initialContainer._getSiblingContainerFromPosition(this, x, y);
|
---|
638 | // If we couldn't find a new container to move the item into, and the item has left its
|
---|
639 | // initial container, check whether the it's over the initial container. This handles the
|
---|
640 | // case where two containers are connected one way and the user tries to undo dragging an
|
---|
641 | // item into a new container.
|
---|
642 | if (!newContainer && this._dropContainer !== this._initialContainer &&
|
---|
643 | this._initialContainer._isOverContainer(x, y)) {
|
---|
644 | newContainer = this._initialContainer;
|
---|
645 | }
|
---|
646 | if (newContainer && newContainer !== this._dropContainer) {
|
---|
647 | this._ngZone.run(() => {
|
---|
648 | // Notify the old container that the item has left.
|
---|
649 | this.exited.next({ item: this, container: this._dropContainer });
|
---|
650 | this._dropContainer.exit(this);
|
---|
651 | // Notify the new container that the item has entered.
|
---|
652 | this._dropContainer = newContainer;
|
---|
653 | this._dropContainer.enter(this, x, y, newContainer === this._initialContainer &&
|
---|
654 | // If we're re-entering the initial container and sorting is disabled,
|
---|
655 | // put item the into its starting index to begin with.
|
---|
656 | newContainer.sortingDisabled ? this._initialIndex : undefined);
|
---|
657 | this.entered.next({
|
---|
658 | item: this,
|
---|
659 | container: newContainer,
|
---|
660 | currentIndex: newContainer.getItemIndex(this)
|
---|
661 | });
|
---|
662 | });
|
---|
663 | }
|
---|
664 | // Dragging may have been interrupted as a result of the events above.
|
---|
665 | if (this.isDragging()) {
|
---|
666 | this._dropContainer._startScrollingIfNecessary(rawX, rawY);
|
---|
667 | this._dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
|
---|
668 | this._applyPreviewTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
|
---|
669 | }
|
---|
670 | }
|
---|
671 | /**
|
---|
672 | * Creates the element that will be rendered next to the user's pointer
|
---|
673 | * and will be used as a preview of the element that is being dragged.
|
---|
674 | */
|
---|
675 | _createPreviewElement() {
|
---|
676 | const previewConfig = this._previewTemplate;
|
---|
677 | const previewClass = this.previewClass;
|
---|
678 | const previewTemplate = previewConfig ? previewConfig.template : null;
|
---|
679 | let preview;
|
---|
680 | if (previewTemplate && previewConfig) {
|
---|
681 | // Measure the element before we've inserted the preview
|
---|
682 | // since the insertion could throw off the measurement.
|
---|
683 | const rootRect = previewConfig.matchSize ? this._rootElement.getBoundingClientRect() : null;
|
---|
684 | const viewRef = previewConfig.viewContainer.createEmbeddedView(previewTemplate, previewConfig.context);
|
---|
685 | viewRef.detectChanges();
|
---|
686 | preview = getRootNode(viewRef, this._document);
|
---|
687 | this._previewRef = viewRef;
|
---|
688 | if (previewConfig.matchSize) {
|
---|
689 | matchElementSize(preview, rootRect);
|
---|
690 | }
|
---|
691 | else {
|
---|
692 | preview.style.transform =
|
---|
693 | getTransform(this._pickupPositionOnPage.x, this._pickupPositionOnPage.y);
|
---|
694 | }
|
---|
695 | }
|
---|
696 | else {
|
---|
697 | const element = this._rootElement;
|
---|
698 | preview = deepCloneNode(element);
|
---|
699 | matchElementSize(preview, element.getBoundingClientRect());
|
---|
700 | if (this._initialTransform) {
|
---|
701 | preview.style.transform = this._initialTransform;
|
---|
702 | }
|
---|
703 | }
|
---|
704 | extendStyles(preview.style, {
|
---|
705 | // It's important that we disable the pointer events on the preview, because
|
---|
706 | // it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
|
---|
707 | 'pointer-events': 'none',
|
---|
708 | // We have to reset the margin, because it can throw off positioning relative to the viewport.
|
---|
709 | 'margin': '0',
|
---|
710 | 'position': 'fixed',
|
---|
711 | 'top': '0',
|
---|
712 | 'left': '0',
|
---|
713 | 'z-index': `${this._config.zIndex || 1000}`
|
---|
714 | }, dragImportantProperties);
|
---|
715 | toggleNativeDragInteractions(preview, false);
|
---|
716 | preview.classList.add('cdk-drag-preview');
|
---|
717 | preview.setAttribute('dir', this._direction);
|
---|
718 | if (previewClass) {
|
---|
719 | if (Array.isArray(previewClass)) {
|
---|
720 | previewClass.forEach(className => preview.classList.add(className));
|
---|
721 | }
|
---|
722 | else {
|
---|
723 | preview.classList.add(previewClass);
|
---|
724 | }
|
---|
725 | }
|
---|
726 | return preview;
|
---|
727 | }
|
---|
728 | /**
|
---|
729 | * Animates the preview element from its current position to the location of the drop placeholder.
|
---|
730 | * @returns Promise that resolves when the animation completes.
|
---|
731 | */
|
---|
732 | _animatePreviewToPlaceholder() {
|
---|
733 | // If the user hasn't moved yet, the transitionend event won't fire.
|
---|
734 | if (!this._hasMoved) {
|
---|
735 | return Promise.resolve();
|
---|
736 | }
|
---|
737 | const placeholderRect = this._placeholder.getBoundingClientRect();
|
---|
738 | // Apply the class that adds a transition to the preview.
|
---|
739 | this._preview.classList.add('cdk-drag-animating');
|
---|
740 | // Move the preview to the placeholder position.
|
---|
741 | this._applyPreviewTransform(placeholderRect.left, placeholderRect.top);
|
---|
742 | // If the element doesn't have a `transition`, the `transitionend` event won't fire. Since
|
---|
743 | // we need to trigger a style recalculation in order for the `cdk-drag-animating` class to
|
---|
744 | // apply its style, we take advantage of the available info to figure out whether we need to
|
---|
745 | // bind the event in the first place.
|
---|
746 | const duration = getTransformTransitionDurationInMs(this._preview);
|
---|
747 | if (duration === 0) {
|
---|
748 | return Promise.resolve();
|
---|
749 | }
|
---|
750 | return this._ngZone.runOutsideAngular(() => {
|
---|
751 | return new Promise(resolve => {
|
---|
752 | const handler = ((event) => {
|
---|
753 | var _a;
|
---|
754 | if (!event || (_getEventTarget(event) === this._preview &&
|
---|
755 | event.propertyName === 'transform')) {
|
---|
756 | (_a = this._preview) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionend', handler);
|
---|
757 | resolve();
|
---|
758 | clearTimeout(timeout);
|
---|
759 | }
|
---|
760 | });
|
---|
761 | // If a transition is short enough, the browser might not fire the `transitionend` event.
|
---|
762 | // Since we know how long it's supposed to take, add a timeout with a 50% buffer that'll
|
---|
763 | // fire if the transition hasn't completed when it was supposed to.
|
---|
764 | const timeout = setTimeout(handler, duration * 1.5);
|
---|
765 | this._preview.addEventListener('transitionend', handler);
|
---|
766 | });
|
---|
767 | });
|
---|
768 | }
|
---|
769 | /** Creates an element that will be shown instead of the current element while dragging. */
|
---|
770 | _createPlaceholderElement() {
|
---|
771 | const placeholderConfig = this._placeholderTemplate;
|
---|
772 | const placeholderTemplate = placeholderConfig ? placeholderConfig.template : null;
|
---|
773 | let placeholder;
|
---|
774 | if (placeholderTemplate) {
|
---|
775 | this._placeholderRef = placeholderConfig.viewContainer.createEmbeddedView(placeholderTemplate, placeholderConfig.context);
|
---|
776 | this._placeholderRef.detectChanges();
|
---|
777 | placeholder = getRootNode(this._placeholderRef, this._document);
|
---|
778 | }
|
---|
779 | else {
|
---|
780 | placeholder = deepCloneNode(this._rootElement);
|
---|
781 | }
|
---|
782 | placeholder.classList.add('cdk-drag-placeholder');
|
---|
783 | return placeholder;
|
---|
784 | }
|
---|
785 | /**
|
---|
786 | * Figures out the coordinates at which an element was picked up.
|
---|
787 | * @param referenceElement Element that initiated the dragging.
|
---|
788 | * @param event Event that initiated the dragging.
|
---|
789 | */
|
---|
790 | _getPointerPositionInElement(referenceElement, event) {
|
---|
791 | const elementRect = this._rootElement.getBoundingClientRect();
|
---|
792 | const handleElement = referenceElement === this._rootElement ? null : referenceElement;
|
---|
793 | const referenceRect = handleElement ? handleElement.getBoundingClientRect() : elementRect;
|
---|
794 | const point = isTouchEvent(event) ? event.targetTouches[0] : event;
|
---|
795 | const scrollPosition = this._getViewportScrollPosition();
|
---|
796 | const x = point.pageX - referenceRect.left - scrollPosition.left;
|
---|
797 | const y = point.pageY - referenceRect.top - scrollPosition.top;
|
---|
798 | return {
|
---|
799 | x: referenceRect.left - elementRect.left + x,
|
---|
800 | y: referenceRect.top - elementRect.top + y
|
---|
801 | };
|
---|
802 | }
|
---|
803 | /** Determines the point of the page that was touched by the user. */
|
---|
804 | _getPointerPositionOnPage(event) {
|
---|
805 | const scrollPosition = this._getViewportScrollPosition();
|
---|
806 | const point = isTouchEvent(event) ?
|
---|
807 | // `touches` will be empty for start/end events so we have to fall back to `changedTouches`.
|
---|
808 | // Also note that on real devices we're guaranteed for either `touches` or `changedTouches`
|
---|
809 | // to have a value, but Firefox in device emulation mode has a bug where both can be empty
|
---|
810 | // for `touchstart` and `touchend` so we fall back to a dummy object in order to avoid
|
---|
811 | // throwing an error. The value returned here will be incorrect, but since this only
|
---|
812 | // breaks inside a developer tool and the value is only used for secondary information,
|
---|
813 | // we can get away with it. See https://bugzilla.mozilla.org/show_bug.cgi?id=1615824.
|
---|
814 | (event.touches[0] || event.changedTouches[0] || { pageX: 0, pageY: 0 }) : event;
|
---|
815 | const x = point.pageX - scrollPosition.left;
|
---|
816 | const y = point.pageY - scrollPosition.top;
|
---|
817 | // if dragging SVG element, try to convert from the screen coordinate system to the SVG
|
---|
818 | // coordinate system
|
---|
819 | if (this._ownerSVGElement) {
|
---|
820 | const svgMatrix = this._ownerSVGElement.getScreenCTM();
|
---|
821 | if (svgMatrix) {
|
---|
822 | const svgPoint = this._ownerSVGElement.createSVGPoint();
|
---|
823 | svgPoint.x = x;
|
---|
824 | svgPoint.y = y;
|
---|
825 | return svgPoint.matrixTransform(svgMatrix.inverse());
|
---|
826 | }
|
---|
827 | }
|
---|
828 | return { x, y };
|
---|
829 | }
|
---|
830 | /** Gets the pointer position on the page, accounting for any position constraints. */
|
---|
831 | _getConstrainedPointerPosition(point) {
|
---|
832 | const dropContainerLock = this._dropContainer ? this._dropContainer.lockAxis : null;
|
---|
833 | let { x, y } = this.constrainPosition ? this.constrainPosition(point, this) : point;
|
---|
834 | if (this.lockAxis === 'x' || dropContainerLock === 'x') {
|
---|
835 | y = this._pickupPositionOnPage.y;
|
---|
836 | }
|
---|
837 | else if (this.lockAxis === 'y' || dropContainerLock === 'y') {
|
---|
838 | x = this._pickupPositionOnPage.x;
|
---|
839 | }
|
---|
840 | if (this._boundaryRect) {
|
---|
841 | const { x: pickupX, y: pickupY } = this._pickupPositionInElement;
|
---|
842 | const boundaryRect = this._boundaryRect;
|
---|
843 | const previewRect = this._previewRect;
|
---|
844 | const minY = boundaryRect.top + pickupY;
|
---|
845 | const maxY = boundaryRect.bottom - (previewRect.height - pickupY);
|
---|
846 | const minX = boundaryRect.left + pickupX;
|
---|
847 | const maxX = boundaryRect.right - (previewRect.width - pickupX);
|
---|
848 | x = clamp(x, minX, maxX);
|
---|
849 | y = clamp(y, minY, maxY);
|
---|
850 | }
|
---|
851 | return { x, y };
|
---|
852 | }
|
---|
853 | /** Updates the current drag delta, based on the user's current pointer position on the page. */
|
---|
854 | _updatePointerDirectionDelta(pointerPositionOnPage) {
|
---|
855 | const { x, y } = pointerPositionOnPage;
|
---|
856 | const delta = this._pointerDirectionDelta;
|
---|
857 | const positionSinceLastChange = this._pointerPositionAtLastDirectionChange;
|
---|
858 | // Amount of pixels the user has dragged since the last time the direction changed.
|
---|
859 | const changeX = Math.abs(x - positionSinceLastChange.x);
|
---|
860 | const changeY = Math.abs(y - positionSinceLastChange.y);
|
---|
861 | // Because we handle pointer events on a per-pixel basis, we don't want the delta
|
---|
862 | // to change for every pixel, otherwise anything that depends on it can look erratic.
|
---|
863 | // To make the delta more consistent, we track how much the user has moved since the last
|
---|
864 | // delta change and we only update it after it has reached a certain threshold.
|
---|
865 | if (changeX > this._config.pointerDirectionChangeThreshold) {
|
---|
866 | delta.x = x > positionSinceLastChange.x ? 1 : -1;
|
---|
867 | positionSinceLastChange.x = x;
|
---|
868 | }
|
---|
869 | if (changeY > this._config.pointerDirectionChangeThreshold) {
|
---|
870 | delta.y = y > positionSinceLastChange.y ? 1 : -1;
|
---|
871 | positionSinceLastChange.y = y;
|
---|
872 | }
|
---|
873 | return delta;
|
---|
874 | }
|
---|
875 | /** Toggles the native drag interactions, based on how many handles are registered. */
|
---|
876 | _toggleNativeDragInteractions() {
|
---|
877 | if (!this._rootElement || !this._handles) {
|
---|
878 | return;
|
---|
879 | }
|
---|
880 | const shouldEnable = this._handles.length > 0 || !this.isDragging();
|
---|
881 | if (shouldEnable !== this._nativeInteractionsEnabled) {
|
---|
882 | this._nativeInteractionsEnabled = shouldEnable;
|
---|
883 | toggleNativeDragInteractions(this._rootElement, shouldEnable);
|
---|
884 | }
|
---|
885 | }
|
---|
886 | /** Removes the manually-added event listeners from the root element. */
|
---|
887 | _removeRootElementListeners(element) {
|
---|
888 | element.removeEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
|
---|
889 | element.removeEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
---|
890 | }
|
---|
891 | /**
|
---|
892 | * Applies a `transform` to the root element, taking into account any existing transforms on it.
|
---|
893 | * @param x New transform value along the X axis.
|
---|
894 | * @param y New transform value along the Y axis.
|
---|
895 | */
|
---|
896 | _applyRootElementTransform(x, y) {
|
---|
897 | const transform = getTransform(x, y);
|
---|
898 | // Cache the previous transform amount only after the first drag sequence, because
|
---|
899 | // we don't want our own transforms to stack on top of each other.
|
---|
900 | // Should be excluded none because none + translate3d(x, y, x) is invalid css
|
---|
901 | if (this._initialTransform == null) {
|
---|
902 | this._initialTransform = this._rootElement.style.transform
|
---|
903 | && this._rootElement.style.transform != 'none'
|
---|
904 | ? this._rootElement.style.transform
|
---|
905 | : '';
|
---|
906 | }
|
---|
907 | // Preserve the previous `transform` value, if there was one. Note that we apply our own
|
---|
908 | // transform before the user's, because things like rotation can affect which direction
|
---|
909 | // the element will be translated towards.
|
---|
910 | this._rootElement.style.transform = combineTransforms(transform, this._initialTransform);
|
---|
911 | }
|
---|
912 | /**
|
---|
913 | * Applies a `transform` to the preview, taking into account any existing transforms on it.
|
---|
914 | * @param x New transform value along the X axis.
|
---|
915 | * @param y New transform value along the Y axis.
|
---|
916 | */
|
---|
917 | _applyPreviewTransform(x, y) {
|
---|
918 | var _a;
|
---|
919 | // Only apply the initial transform if the preview is a clone of the original element, otherwise
|
---|
920 | // it could be completely different and the transform might not make sense anymore.
|
---|
921 | const initialTransform = ((_a = this._previewTemplate) === null || _a === void 0 ? void 0 : _a.template) ? undefined : this._initialTransform;
|
---|
922 | const transform = getTransform(x, y);
|
---|
923 | this._preview.style.transform = combineTransforms(transform, initialTransform);
|
---|
924 | }
|
---|
925 | /**
|
---|
926 | * Gets the distance that the user has dragged during the current drag sequence.
|
---|
927 | * @param currentPosition Current position of the user's pointer.
|
---|
928 | */
|
---|
929 | _getDragDistance(currentPosition) {
|
---|
930 | const pickupPosition = this._pickupPositionOnPage;
|
---|
931 | if (pickupPosition) {
|
---|
932 | return { x: currentPosition.x - pickupPosition.x, y: currentPosition.y - pickupPosition.y };
|
---|
933 | }
|
---|
934 | return { x: 0, y: 0 };
|
---|
935 | }
|
---|
936 | /** Cleans up any cached element dimensions that we don't need after dragging has stopped. */
|
---|
937 | _cleanupCachedDimensions() {
|
---|
938 | this._boundaryRect = this._previewRect = undefined;
|
---|
939 | this._parentPositions.clear();
|
---|
940 | }
|
---|
941 | /**
|
---|
942 | * Checks whether the element is still inside its boundary after the viewport has been resized.
|
---|
943 | * If not, the position is adjusted so that the element fits again.
|
---|
944 | */
|
---|
945 | _containInsideBoundaryOnResize() {
|
---|
946 | let { x, y } = this._passiveTransform;
|
---|
947 | if ((x === 0 && y === 0) || this.isDragging() || !this._boundaryElement) {
|
---|
948 | return;
|
---|
949 | }
|
---|
950 | const boundaryRect = this._boundaryElement.getBoundingClientRect();
|
---|
951 | const elementRect = this._rootElement.getBoundingClientRect();
|
---|
952 | // It's possible that the element got hidden away after dragging (e.g. by switching to a
|
---|
953 | // different tab). Don't do anything in this case so we don't clear the user's position.
|
---|
954 | if ((boundaryRect.width === 0 && boundaryRect.height === 0) ||
|
---|
955 | (elementRect.width === 0 && elementRect.height === 0)) {
|
---|
956 | return;
|
---|
957 | }
|
---|
958 | const leftOverflow = boundaryRect.left - elementRect.left;
|
---|
959 | const rightOverflow = elementRect.right - boundaryRect.right;
|
---|
960 | const topOverflow = boundaryRect.top - elementRect.top;
|
---|
961 | const bottomOverflow = elementRect.bottom - boundaryRect.bottom;
|
---|
962 | // If the element has become wider than the boundary, we can't
|
---|
963 | // do much to make it fit so we just anchor it to the left.
|
---|
964 | if (boundaryRect.width > elementRect.width) {
|
---|
965 | if (leftOverflow > 0) {
|
---|
966 | x += leftOverflow;
|
---|
967 | }
|
---|
968 | if (rightOverflow > 0) {
|
---|
969 | x -= rightOverflow;
|
---|
970 | }
|
---|
971 | }
|
---|
972 | else {
|
---|
973 | x = 0;
|
---|
974 | }
|
---|
975 | // If the element has become taller than the boundary, we can't
|
---|
976 | // do much to make it fit so we just anchor it to the top.
|
---|
977 | if (boundaryRect.height > elementRect.height) {
|
---|
978 | if (topOverflow > 0) {
|
---|
979 | y += topOverflow;
|
---|
980 | }
|
---|
981 | if (bottomOverflow > 0) {
|
---|
982 | y -= bottomOverflow;
|
---|
983 | }
|
---|
984 | }
|
---|
985 | else {
|
---|
986 | y = 0;
|
---|
987 | }
|
---|
988 | if (x !== this._passiveTransform.x || y !== this._passiveTransform.y) {
|
---|
989 | this.setFreeDragPosition({ y, x });
|
---|
990 | }
|
---|
991 | }
|
---|
992 | /** Gets the drag start delay, based on the event type. */
|
---|
993 | _getDragStartDelay(event) {
|
---|
994 | const value = this.dragStartDelay;
|
---|
995 | if (typeof value === 'number') {
|
---|
996 | return value;
|
---|
997 | }
|
---|
998 | else if (isTouchEvent(event)) {
|
---|
999 | return value.touch;
|
---|
1000 | }
|
---|
1001 | return value ? value.mouse : 0;
|
---|
1002 | }
|
---|
1003 | /** Updates the internal state of the draggable element when scrolling has occurred. */
|
---|
1004 | _updateOnScroll(event) {
|
---|
1005 | const scrollDifference = this._parentPositions.handleScroll(event);
|
---|
1006 | if (scrollDifference) {
|
---|
1007 | const target = _getEventTarget(event);
|
---|
1008 | // ClientRect dimensions are based on the scroll position of the page and its parent node so
|
---|
1009 | // we have to update the cached boundary ClientRect if the user has scrolled. Check for
|
---|
1010 | // the `document` specifically since IE doesn't support `contains` on it.
|
---|
1011 | if (this._boundaryRect && (target === this._document ||
|
---|
1012 | (target !== this._boundaryElement && target.contains(this._boundaryElement)))) {
|
---|
1013 | adjustClientRect(this._boundaryRect, scrollDifference.top, scrollDifference.left);
|
---|
1014 | }
|
---|
1015 | this._pickupPositionOnPage.x += scrollDifference.left;
|
---|
1016 | this._pickupPositionOnPage.y += scrollDifference.top;
|
---|
1017 | // If we're in free drag mode, we have to update the active transform, because
|
---|
1018 | // it isn't relative to the viewport like the preview inside a drop list.
|
---|
1019 | if (!this._dropContainer) {
|
---|
1020 | this._activeTransform.x -= scrollDifference.left;
|
---|
1021 | this._activeTransform.y -= scrollDifference.top;
|
---|
1022 | this._applyRootElementTransform(this._activeTransform.x, this._activeTransform.y);
|
---|
1023 | }
|
---|
1024 | }
|
---|
1025 | }
|
---|
1026 | /** Gets the scroll position of the viewport. */
|
---|
1027 | _getViewportScrollPosition() {
|
---|
1028 | const cachedPosition = this._parentPositions.positions.get(this._document);
|
---|
1029 | return cachedPosition ? cachedPosition.scrollPosition :
|
---|
1030 | this._viewportRuler.getViewportScrollPosition();
|
---|
1031 | }
|
---|
1032 | /**
|
---|
1033 | * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
|
---|
1034 | * than saving it in property directly on init, because we want to resolve it as late as possible
|
---|
1035 | * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
|
---|
1036 | * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
|
---|
1037 | */
|
---|
1038 | _getShadowRoot() {
|
---|
1039 | if (this._cachedShadowRoot === undefined) {
|
---|
1040 | this._cachedShadowRoot = _getShadowRoot(this._rootElement);
|
---|
1041 | }
|
---|
1042 | return this._cachedShadowRoot;
|
---|
1043 | }
|
---|
1044 | /** Gets the element into which the drag preview should be inserted. */
|
---|
1045 | _getPreviewInsertionPoint(initialParent, shadowRoot) {
|
---|
1046 | const previewContainer = this._previewContainer || 'global';
|
---|
1047 | if (previewContainer === 'parent') {
|
---|
1048 | return initialParent;
|
---|
1049 | }
|
---|
1050 | if (previewContainer === 'global') {
|
---|
1051 | const documentRef = this._document;
|
---|
1052 | // We can't use the body if the user is in fullscreen mode,
|
---|
1053 | // because the preview will render under the fullscreen element.
|
---|
1054 | // TODO(crisbeto): dedupe this with the `FullscreenOverlayContainer` eventually.
|
---|
1055 | return shadowRoot ||
|
---|
1056 | documentRef.fullscreenElement ||
|
---|
1057 | documentRef.webkitFullscreenElement ||
|
---|
1058 | documentRef.mozFullScreenElement ||
|
---|
1059 | documentRef.msFullscreenElement ||
|
---|
1060 | documentRef.body;
|
---|
1061 | }
|
---|
1062 | return coerceElement(previewContainer);
|
---|
1063 | }
|
---|
1064 | }
|
---|
1065 | /**
|
---|
1066 | * Gets a 3d `transform` that can be applied to an element.
|
---|
1067 | * @param x Desired position of the element along the X axis.
|
---|
1068 | * @param y Desired position of the element along the Y axis.
|
---|
1069 | */
|
---|
1070 | function getTransform(x, y) {
|
---|
1071 | // Round the transforms since some browsers will
|
---|
1072 | // blur the elements for sub-pixel transforms.
|
---|
1073 | return `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`;
|
---|
1074 | }
|
---|
1075 | /** Clamps a value between a minimum and a maximum. */
|
---|
1076 | function clamp(value, min, max) {
|
---|
1077 | return Math.max(min, Math.min(max, value));
|
---|
1078 | }
|
---|
1079 | /**
|
---|
1080 | * Helper to remove a node from the DOM and to do all the necessary null checks.
|
---|
1081 | * @param node Node to be removed.
|
---|
1082 | */
|
---|
1083 | function removeNode(node) {
|
---|
1084 | if (node && node.parentNode) {
|
---|
1085 | node.parentNode.removeChild(node);
|
---|
1086 | }
|
---|
1087 | }
|
---|
1088 | /** Determines whether an event is a touch event. */
|
---|
1089 | function isTouchEvent(event) {
|
---|
1090 | // This function is called for every pixel that the user has dragged so we need it to be
|
---|
1091 | // as fast as possible. Since we only bind mouse events and touch events, we can assume
|
---|
1092 | // that if the event's name starts with `t`, it's a touch event.
|
---|
1093 | return event.type[0] === 't';
|
---|
1094 | }
|
---|
1095 | /**
|
---|
1096 | * Gets the root HTML element of an embedded view.
|
---|
1097 | * If the root is not an HTML element it gets wrapped in one.
|
---|
1098 | */
|
---|
1099 | function getRootNode(viewRef, _document) {
|
---|
1100 | const rootNodes = viewRef.rootNodes;
|
---|
1101 | if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
|
---|
1102 | return rootNodes[0];
|
---|
1103 | }
|
---|
1104 | const wrapper = _document.createElement('div');
|
---|
1105 | rootNodes.forEach(node => wrapper.appendChild(node));
|
---|
1106 | return wrapper;
|
---|
1107 | }
|
---|
1108 | /**
|
---|
1109 | * Matches the target element's size to the source's size.
|
---|
1110 | * @param target Element that needs to be resized.
|
---|
1111 | * @param sourceRect Dimensions of the source element.
|
---|
1112 | */
|
---|
1113 | function matchElementSize(target, sourceRect) {
|
---|
1114 | target.style.width = `${sourceRect.width}px`;
|
---|
1115 | target.style.height = `${sourceRect.height}px`;
|
---|
1116 | target.style.transform = getTransform(sourceRect.left, sourceRect.top);
|
---|
1117 | }
|
---|
1118 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZy1yZWYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL2RyYWctZHJvcC9kcmFnLXJlZi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFLSCxPQUFPLEVBQ0wsK0JBQStCLEVBQy9CLGVBQWUsRUFDZixjQUFjLEdBQ2YsTUFBTSx1QkFBdUIsQ0FBQztBQUMvQixPQUFPLEVBQUMscUJBQXFCLEVBQUUsYUFBYSxFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDM0UsT0FBTyxFQUNMLCtCQUErQixFQUMvQixnQ0FBZ0MsR0FDakMsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEVBQUMsWUFBWSxFQUFFLE9BQU8sRUFBYSxNQUFNLE1BQU0sQ0FBQztBQUd2RCxPQUFPLEVBQ0wsaUJBQWlCLEVBQ2pCLFlBQVksRUFDWiw0QkFBNEIsRUFDNUIsZ0JBQWdCLEdBQ2pCLE1BQU0sZ0JBQWdCLENBQUM7QUFDeEIsT0FBTyxFQUFDLGtDQUFrQyxFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDekUsT0FBTyxFQUFDLG9CQUFvQixFQUFFLGdCQUFnQixFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ3JFLE9BQU8sRUFBQyxxQkFBcUIsRUFBQyxNQUFNLDJCQUEyQixDQUFDO0FBQ2hFLE9BQU8sRUFBQyxhQUFhLEVBQUMsTUFBTSxjQUFjLENBQUM7QUF1QjNDLGlFQUFpRTtBQUNqRSxNQUFNLDJCQU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