Skip to content

Commit 683d5ff

Browse files
committed
made drag offset optional
1 parent 8eb6896 commit 683d5ff

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/dragdrop/src/index.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -828,12 +828,18 @@ namespace Private {
828828

829829
/**
830830
* Find the drag scroll target under the mouse, if any.
831+
*
832+
* @param event - The mouse event related to the action.
833+
*
834+
* @param dragOffsetX - the number of pixels to offset the drag in the x direction.
835+
*
836+
* @param dragOffsetY - the number of pixels to offset the drag in the y direction.
831837
*/
832838
export
833-
function findScrollTarget(event: MouseEvent, dragOffsetX: number, dragOffsetY: number): IScrollTarget | null {
839+
function findScrollTarget(event: MouseEvent, dragOffsetX?: number, dragOffsetY?: number): IScrollTarget | null {
834840
// Look up the client mouse position.
835-
const x = event.clientX + dragOffsetX;
836-
const y = event.clientY + dragOffsetY;
841+
const x = event.clientX + (dragOffsetX !== undefined ? dragOffsetX : 0);
842+
const y = event.clientY + (dragOffsetY !== undefined ? dragOffsetY : 0);
837843

838844
// Get the element under the mouse.
839845
let element: Element | null = document.elementFromPoint(x, y);

0 commit comments

Comments
 (0)