Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Rotate #717

Open
renzhiVivio opened this issue Apr 17, 2023 · 3 comments
Open

Cannot Rotate #717

renzhiVivio opened this issue Apr 17, 2023 · 3 comments

Comments

@renzhiVivio
Copy link

I create a DOM in react-draggable, now I rotate the DOM

since react-draggable will set a transform property inside the DOM when render, it makes my transform rotate properties not working properly

for example, the DOM css is transform: translate(265px, 262px), but what I want is transform: translate(265px, 262px) rotate(33deg)

how can I acquire?

image
the blue rect shadow DOM indicating react-draggable, which doesn't rotate

@svasighi
Copy link

svasighi commented Jul 12, 2023

Hello renzhiVivio,

I have solved the problem using the following approach:

const dragHandler = (e: DraggableEvent, data: DraggableData): void => {
        data.node.style.rotate = ${360 + (data.x / 50)}deg;
}

Please let me know if you have any questions or concerns.

@lamhungypl
Copy link

Hi @svasighi , could you provide how to use the dragHandler

@salfel
Copy link

salfel commented Feb 7, 2024

If someone has the same problem as above, replace Draggable with DraggableCore, because Draggable implements some display logic and is a wrapper around DraggableCore, when now using DraggableCore, you have full control of the placement of the draggable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants