Skip to content

useDrag set x/y offset for setDragImage #5409

Open
@hipstersmoothie

Description

@hipstersmoothie

Provide a general summary of the feature here

Right now the useDrag hook provides no way to customize the position of the DragPreview. I tried a variety of ways in CSS to try to position the preview myself by was unsuccessful.

🤔 Expected Behavior?

I should have some way to set the x/y

😯 Current Behavior

This is not way to do this

💁 Possible Solution

I think what's needed is some extra options for the useDrag hook. Maybe something along the lines of the following

interface UseDragOptions {
  previewOffset?: { x: number; y: number } | 'center';
}

🔦 Context

I have a DragPreview that I can't position. If the above API looks like something you would merge I'd happily make the PR. If the API isn't quite right I'm also down to implement whatever would land!

💻 Examples

No response

🧢 Your Company/Team

Descript

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions