@@ -1470,34 +1470,41 @@ describe('Standalone CdkDrag', () => {
14701470 cleanup ( ) ;
14711471 } ) ) ;
14721472
1473- it (
1474- 'should update the free drag position if the user moves their pointer after the page ' +
1475- 'is scrolled' ,
1476- fakeAsync ( ( ) => {
1477- const fixture = createComponent ( StandaloneDraggable ) ;
1478- fixture . detectChanges ( ) ;
1473+ it ( 'should update the free drag position if the user moves their pointer after the page is scrolled' , fakeAsync ( ( ) => {
1474+ const fixture = createComponent ( StandaloneDraggable ) ;
1475+ fixture . detectChanges ( ) ;
14791476
1480- const cleanup = makeScrollable ( ) ;
1481- const dragElement = fixture . componentInstance . dragElement . nativeElement ;
1477+ const cleanup = makeScrollable ( ) ;
1478+ const dragElement = fixture . componentInstance . dragElement . nativeElement ;
14821479
1483- expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
1484- startDraggingViaMouse ( fixture , dragElement , 0 , 0 ) ;
1485- dispatchMouseEvent ( document , 'mousemove' , 50 , 100 ) ;
1486- fixture . detectChanges ( ) ;
1480+ expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
1481+ startDraggingViaMouse ( fixture , dragElement , 0 , 0 ) ;
1482+ dispatchMouseEvent ( document , 'mousemove' , 50 , 100 ) ;
1483+ fixture . detectChanges ( ) ;
14871484
1488- expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 100px, 0px)' ) ;
1485+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 100px, 0px)' ) ;
14891486
1490- scrollTo ( 0 , 500 ) ;
1491- dispatchFakeEvent ( document , 'scroll' ) ;
1492- fixture . detectChanges ( ) ;
1493- dispatchMouseEvent ( document , 'mousemove' , 50 , 200 ) ;
1494- fixture . detectChanges ( ) ;
1487+ scrollTo ( 0 , 500 ) ;
1488+ dispatchFakeEvent ( document , 'scroll' ) ;
1489+ fixture . detectChanges ( ) ;
1490+ dispatchMouseEvent ( document , 'mousemove' , 50 , 200 ) ;
1491+ fixture . detectChanges ( ) ;
14951492
1496- expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 700px, 0px)' ) ;
1493+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 700px, 0px)' ) ;
14971494
1498- cleanup ( ) ;
1499- } ) ,
1500- ) ;
1495+ cleanup ( ) ;
1496+ } ) ) ;
1497+
1498+ it ( 'should account for scale when moving the element' , fakeAsync ( ( ) => {
1499+ const fixture = createComponent ( StandaloneDraggable ) ;
1500+ fixture . componentInstance . scale = 0.5 ;
1501+ fixture . detectChanges ( ) ;
1502+ const dragElement = fixture . componentInstance . dragElement . nativeElement ;
1503+
1504+ expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
1505+ dragElementViaMouse ( fixture , dragElement , 50 , 100 ) ;
1506+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(100px, 200px, 0px)' ) ;
1507+ } ) ) ;
15011508
15021509 describe ( 'with a handle' , ( ) => {
15031510 it ( 'should not be able to drag the entire element if it has a handle' , fakeAsync ( ( ) => {
@@ -1718,6 +1725,7 @@ describe('Standalone CdkDrag', () => {
17181725 [cdkDragFreeDragPosition]="freeDragPosition"
17191726 [cdkDragDisabled]="dragDisabled()"
17201727 [cdkDragLockAxis]="dragLockAxis()"
1728+ [cdkDragScale]="scale"
17211729 (cdkDragStarted)="startedSpy($event)"
17221730 (cdkDragReleased)="releasedSpy($event)"
17231731 (cdkDragEnded)="endedSpy($event)"
@@ -1745,6 +1753,7 @@ class StandaloneDraggable {
17451753 freeDragPosition ?: { x : number ; y : number } ;
17461754 dragDisabled = signal ( false ) ;
17471755 dragLockAxis = signal < DragAxis | undefined > ( undefined ) ;
1756+ scale = 1 ;
17481757}
17491758
17501759@Component ( {
0 commit comments