@@ -1470,34 +1470,41 @@ describe('Standalone CdkDrag', () => {
1470
1470
cleanup ( ) ;
1471
1471
} ) ) ;
1472
1472
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 ( ) ;
1479
1476
1480
- const cleanup = makeScrollable ( ) ;
1481
- const dragElement = fixture . componentInstance . dragElement . nativeElement ;
1477
+ const cleanup = makeScrollable ( ) ;
1478
+ const dragElement = fixture . componentInstance . dragElement . nativeElement ;
1482
1479
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 ( ) ;
1487
1484
1488
- expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 100px, 0px)' ) ;
1485
+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 100px, 0px)' ) ;
1489
1486
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 ( ) ;
1495
1492
1496
- expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 700px, 0px)' ) ;
1493
+ expect ( dragElement . style . transform ) . toBe ( 'translate3d(50px, 700px, 0px)' ) ;
1497
1494
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
+ } ) ) ;
1501
1508
1502
1509
describe ( 'with a handle' , ( ) => {
1503
1510
it ( 'should not be able to drag the entire element if it has a handle' , fakeAsync ( ( ) => {
@@ -1718,6 +1725,7 @@ describe('Standalone CdkDrag', () => {
1718
1725
[cdkDragFreeDragPosition]="freeDragPosition"
1719
1726
[cdkDragDisabled]="dragDisabled()"
1720
1727
[cdkDragLockAxis]="dragLockAxis()"
1728
+ [cdkDragScale]="scale"
1721
1729
(cdkDragStarted)="startedSpy($event)"
1722
1730
(cdkDragReleased)="releasedSpy($event)"
1723
1731
(cdkDragEnded)="endedSpy($event)"
@@ -1745,6 +1753,7 @@ class StandaloneDraggable {
1745
1753
freeDragPosition ?: { x : number ; y : number } ;
1746
1754
dragDisabled = signal ( false ) ;
1747
1755
dragLockAxis = signal < DragAxis | undefined > ( undefined ) ;
1756
+ scale = 1 ;
1748
1757
}
1749
1758
1750
1759
@Component ( {
0 commit comments