Skip to content

Commit 7ca6ef5

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 7ca6ef5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,12 @@ 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 = (
304+
userPointerPosition: Point,
305+
dragRef: DragRef,
306+
dimensions: DOMRect,
307+
pickupPositionInElement: Point,
308+
) => Point;
304309

305310
// @public
306311
export class DragDrop {

0 commit comments

Comments
 (0)