Skip to content

Commit 0abfecd

Browse files
committed
fix(cdk/drag-drop): incorrect type DragConstrainPosition
Fixes type DragConstrainPosition, which of сorrect configuration of CdkDrag is not possible when using in providers Fixes #30509
1 parent 3d7f271 commit 0abfecd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/cdk/drag-drop/directives/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ export type DragStartDelay = number | {touch: number; mouse: number};
1616
export type DragAxis = 'x' | 'y';
1717

1818
/** Function that can be used to constrain the position of a dragged element. */
19-
export type DragConstrainPosition = (point: Point, dragRef: DragRef) => Point;
19+
export type DragConstrainPosition = (
20+
userPointerPosition: Point,
21+
dragRef: DragRef,
22+
dimensions: DOMRect,
23+
pickupPositionInElement: Point,
24+
) => Point;
2025

2126
/** Possible orientations for a drop list. */
2227
export type DropListOrientation = 'horizontal' | 'vertical' | 'mixed';

tools/public_api_guard/cdk/drag-drop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export function copyArrayItem<T = any>(currentArray: T[], targetArray: T[], curr
300300
export type DragAxis = 'x' | 'y';
301301

302302
// @public
303-
export type DragConstrainPosition = (point: Point, dragRef: DragRef) => Point;
303+
export type DragConstrainPosition = (userPointerPosition: Point, dragRef: DragRef, dimensions: DOMRect, pickupPositionInElement: Point) => Point;
304304

305305
// @public
306306
export class DragDrop {

0 commit comments

Comments
 (0)