Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/gizmos/drag-controls.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type DragControlsProps = {
/** Drag end event */
onDragEnd?: () => void
children: React.ReactNode
dragConfig?: DragConfig
handlers?: Partial<Parameters<typeof useGesture>[0]>
}
```

Expand All @@ -51,3 +53,5 @@ return (
autoTransform={false}
onDrag={(localMatrix) => matrix.copy(localMatrix)}
```

You can pass options to the underlying [@use-gesture](https://use-gesture.netlify.app/docs/gestures/#usegesture-and-gesture) call with `dragConfig` and `handlers`.
3 changes: 3 additions & 0 deletions src/web/DragControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type DragControlsProps = {
onDragEnd?: () => void
children: React.ReactNode
dragConfig?: DragConfig
handlers?: Partial<Parameters<typeof useGesture>[0]>
}

export const DragControls: ForwardRefComponent<DragControlsProps, THREE.Group> = React.forwardRef<
Expand All @@ -56,6 +57,7 @@ export const DragControls: ForwardRefComponent<DragControlsProps, THREE.Group> =
onDragEnd,
children,
dragConfig,
handlers,
...props
},
fRef
Expand Down Expand Up @@ -150,6 +152,7 @@ export const DragControls: ForwardRefComponent<DragControlsProps, THREE.Group> =
onDragEnd && onDragEnd()
invalidate()
},
...(typeof handlers === 'object' ? handlers : {}),
},
{
drag: {
Expand Down