Skip to content

Commit

Permalink
feat(useDraggable): improve component props (#3075)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-Skyblue committed May 9, 2023
1 parent b17010f commit 6b6701c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/useDraggable/component.ts
Expand Up @@ -31,6 +31,9 @@ export const UseDraggable = /*#__PURE__*/ defineComponent<UseDraggableProps>({
'as',
'handle',
'axis',
'onStart',
'onMove',
'onEnd',
] as unknown as undefined,
setup(props, { slots }) {
const target = ref()
Expand All @@ -45,7 +48,8 @@ export const UseDraggable = /*#__PURE__*/ defineComponent<UseDraggableProps>({
: undefined,
)
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 }
const onEnd = (position: Position) => {
const onEnd = (position: Position, event: PointerEvent) => {
props.onEnd?.(position, event)
if (!storageValue)
return
storageValue.value.x = position.x
Expand Down

0 comments on commit 6b6701c

Please sign in to comment.