@@ -27,7 +27,7 @@ import {
27
27
toggleVisibility ,
28
28
} from './dom/styling' ;
29
29
import { getTransformTransitionDurationInMs } from './dom/transition-duration' ;
30
- import { getMutableClientRect , adjustClientRect } from './dom/client -rect' ;
30
+ import { getMutableClientRect , adjustDomRect } from './dom/dom -rect' ;
31
31
import { ParentPositionTracker } from './dom/parent-position-tracker' ;
32
32
import { deepCloneNode } from './dom/clone-node' ;
33
33
@@ -234,13 +234,13 @@ export class DragRef<T = any> {
234
234
private _nativeInteractionsEnabled = true ;
235
235
236
236
/** Client rect of the root element when the dragging sequence has started. */
237
- private _initialClientRect ?: ClientRect ;
237
+ private _initialDomRect ?: DOMRect ;
238
238
239
239
/** Cached dimensions of the preview element. Should be read via `_getPreviewRect`. */
240
- private _previewRect ?: ClientRect ;
240
+ private _previewRect ?: DOMRect ;
241
241
242
242
/** Cached dimensions of the boundary element. */
243
- private _boundaryRect ?: ClientRect ;
243
+ private _boundaryRect ?: DOMRect ;
244
244
245
245
/** Element that will be used as a template to create the draggable item's preview. */
246
246
private _previewTemplate ?: DragPreviewTemplate | null ;
@@ -355,7 +355,7 @@ export class DragRef<T = any> {
355
355
constrainPosition ?: (
356
356
userPointerPosition : Point ,
357
357
dragRef : DragRef ,
358
- dimensions : ClientRect ,
358
+ dimensions : DOMRect ,
359
359
pickupPositionInElement : Point ,
360
360
) => Point ;
361
361
@@ -696,7 +696,7 @@ export class DragRef<T = any> {
696
696
} else {
697
697
// If there's a position constraint function, we want the element's top/left to be at the
698
698
// specific position on the page. Use the initial position as a reference if that's the case.
699
- const offset = this . constrainPosition ? this . _initialClientRect ! : this . _pickupPositionOnPage ;
699
+ const offset = this . constrainPosition ? this . _initialDomRect ! : this . _pickupPositionOnPage ;
700
700
const activeTransform = this . _activeTransform ;
701
701
activeTransform . x = constrainedPointerPosition . x - offset . x + this . _passiveTransform . x ;
702
702
activeTransform . y = constrainedPointerPosition . y - offset . y + this . _passiveTransform . y ;
@@ -885,7 +885,7 @@ export class DragRef<T = any> {
885
885
// Avoid multiple subscriptions and memory leaks when multi touch
886
886
// (isDragging check above isn't enough because of possible temporal and/or dimensional delays)
887
887
this . _removeSubscriptions ( ) ;
888
- this . _initialClientRect = this . _rootElement . getBoundingClientRect ( ) ;
888
+ this . _initialDomRect = this . _rootElement . getBoundingClientRect ( ) ;
889
889
this . _pointerMoveSubscription = this . _dragDropRegistry . pointerMove . subscribe ( this . _pointerMove ) ;
890
890
this . _pointerUpSubscription = this . _dragDropRegistry . pointerUp . subscribe ( this . _pointerUp ) ;
891
891
this . _scrollSubscription = this . _dragDropRegistry
@@ -903,7 +903,7 @@ export class DragRef<T = any> {
903
903
this . _pickupPositionInElement =
904
904
previewTemplate && previewTemplate . template && ! previewTemplate . matchSize
905
905
? { x : 0 , y : 0 }
906
- : this . _getPointerPositionInElement ( this . _initialClientRect , referenceElement , event ) ;
906
+ : this . _getPointerPositionInElement ( this . _initialDomRect , referenceElement , event ) ;
907
907
const pointerPosition =
908
908
( this . _pickupPositionOnPage =
909
909
this . _lastKnownPointerPosition =
@@ -925,7 +925,7 @@ export class DragRef<T = any> {
925
925
926
926
this . _destroyPreview ( ) ;
927
927
this . _destroyPlaceholder ( ) ;
928
- this . _initialClientRect =
928
+ this . _initialDomRect =
929
929
this . _boundaryRect =
930
930
this . _previewRect =
931
931
this . _initialTransform =
@@ -1043,7 +1043,7 @@ export class DragRef<T = any> {
1043
1043
if ( previewTemplate && previewConfig ) {
1044
1044
// Measure the element before we've inserted the preview
1045
1045
// since the insertion could throw off the measurement.
1046
- const rootRect = previewConfig . matchSize ? this . _initialClientRect : null ;
1046
+ const rootRect = previewConfig . matchSize ? this . _initialDomRect : null ;
1047
1047
const viewRef = previewConfig . viewContainer . createEmbeddedView (
1048
1048
previewTemplate ,
1049
1049
previewConfig . context ,
@@ -1061,7 +1061,7 @@ export class DragRef<T = any> {
1061
1061
}
1062
1062
} else {
1063
1063
preview = deepCloneNode ( this . _rootElement ) ;
1064
- matchElementSize ( preview , this . _initialClientRect ! ) ;
1064
+ matchElementSize ( preview , this . _initialDomRect ! ) ;
1065
1065
1066
1066
if ( this . _initialTransform ) {
1067
1067
preview . style . transform = this . _initialTransform ;
@@ -1179,7 +1179,7 @@ export class DragRef<T = any> {
1179
1179
* @param event Event that initiated the dragging.
1180
1180
*/
1181
1181
private _getPointerPositionInElement (
1182
- elementRect : ClientRect ,
1182
+ elementRect : DOMRect ,
1183
1183
referenceElement : HTMLElement ,
1184
1184
event : MouseEvent | TouchEvent ,
1185
1185
) : Point {
@@ -1232,7 +1232,7 @@ export class DragRef<T = any> {
1232
1232
private _getConstrainedPointerPosition ( point : Point ) : Point {
1233
1233
const dropContainerLock = this . _dropContainer ? this . _dropContainer . lockAxis : null ;
1234
1234
let { x, y} = this . constrainPosition
1235
- ? this . constrainPosition ( point , this , this . _initialClientRect ! , this . _pickupPositionInElement )
1235
+ ? this . constrainPosition ( point , this , this . _initialDomRect ! , this . _pickupPositionInElement )
1236
1236
: point ;
1237
1237
1238
1238
if ( this . lockAxis === 'x' || dropContainerLock === 'x' ) {
@@ -1452,14 +1452,14 @@ export class DragRef<T = any> {
1452
1452
if ( scrollDifference ) {
1453
1453
const target = _getEventTarget < HTMLElement | Document > ( event ) ! ;
1454
1454
1455
- // ClientRect dimensions are based on the scroll position of the page and its parent
1456
- // node so we have to update the cached boundary ClientRect if the user has scrolled.
1455
+ // DOMRect dimensions are based on the scroll position of the page and its parent
1456
+ // node so we have to update the cached boundary DOMRect if the user has scrolled.
1457
1457
if (
1458
1458
this . _boundaryRect &&
1459
1459
target !== this . _boundaryElement &&
1460
1460
target . contains ( this . _boundaryElement )
1461
1461
) {
1462
- adjustClientRect ( this . _boundaryRect , scrollDifference . top , scrollDifference . left ) ;
1462
+ adjustDomRect ( this . _boundaryRect , scrollDifference . top , scrollDifference . left ) ;
1463
1463
}
1464
1464
1465
1465
this . _pickupPositionOnPage . x += scrollDifference . left ;
@@ -1528,13 +1528,13 @@ export class DragRef<T = any> {
1528
1528
}
1529
1529
1530
1530
/** Lazily resolves and returns the dimensions of the preview. */
1531
- private _getPreviewRect ( ) : ClientRect {
1531
+ private _getPreviewRect ( ) : DOMRect {
1532
1532
// Cache the preview element rect if we haven't cached it already or if
1533
1533
// we cached it too early before the element dimensions were computed.
1534
1534
if ( ! this . _previewRect || ( ! this . _previewRect . width && ! this . _previewRect . height ) ) {
1535
1535
this . _previewRect = this . _preview
1536
1536
? this . _preview . getBoundingClientRect ( )
1537
- : this . _initialClientRect ! ;
1537
+ : this . _initialDomRect ! ;
1538
1538
}
1539
1539
1540
1540
return this . _previewRect ;
@@ -1608,7 +1608,7 @@ function getRootNode(viewRef: EmbeddedViewRef<any>, _document: Document): HTMLEl
1608
1608
* @param target Element that needs to be resized.
1609
1609
* @param sourceRect Dimensions of the source element.
1610
1610
*/
1611
- function matchElementSize ( target : HTMLElement , sourceRect : ClientRect ) : void {
1611
+ function matchElementSize ( target : HTMLElement , sourceRect : DOMRect ) : void {
1612
1612
target . style . width = `${ sourceRect . width } px` ;
1613
1613
target . style . height = `${ sourceRect . height } px` ;
1614
1614
target . style . transform = getTransform ( sourceRect . left , sourceRect . top ) ;
0 commit comments