Skip to content

Commit

Permalink
Use clientX/clientY in useDraggable
Browse files Browse the repository at this point in the history
Follows upstream change: vueuse/vueuse#2054
  • Loading branch information
mvdbeek committed Jan 4, 2023
1 parent 4c369f4 commit ca1d693
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -42,8 +42,8 @@ export function useDraggable(target, options = {}) {
}
const rect = resolveUnref(target)?.getBoundingClientRect();
const pos = {
x: e.pageX - rect.left,
y: e.pageY - rect.top,
x: e.clientX - rect.left,
y: e.clientY - rect.top,
};
if (options.onStart?.(pos, e) === false) {
return;
Expand All @@ -59,8 +59,8 @@ export function useDraggable(target, options = {}) {
return;
}
position.value = {
x: e.pageX - pressedDelta.value.x,
y: e.pageY - pressedDelta.value.y,
x: e.clientX - pressedDelta.value.x,
y: e.clientY - pressedDelta.value.y,
};
options.onMove?.(position.value, e);
handleEvent(e);
Expand Down

0 comments on commit ca1d693

Please sign in to comment.