Jump to content
Search Community

Combination of dragging and rotating

Antdev test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Hello

I would like to have a modal that the user can drag and also rotate. Imagine a photo on a table that is at an angle to me and I want to drag it closer to me but also to rotate it so it is straight.

 

Is there a way to use both the rotate and drag functionality at the same time with Draggable.

 

My quick test didn't work.

 

Thanks

 

Anthony

 

See the Pen MWONJmW by antdev (@antdev) on CodePen

Link to comment
Share on other sites

  • Solution

Welcome to the forums @Antdev

 

You can cannot combine different types of Draggables like that. There can only be 1 Draggable instance per element, so your rotation one just gets killed off. You can designate a place on your element to do rotation as shown in this thread.

 

 

  • Like 1
Link to comment
Share on other sites

Yeah, that's just creating a Draggable around the containing element and the element inside of it, but as you can tell it's hard to control the rotation. The rotation is based on where the cursor is in relation to the center of the element, but when you drag on the x/y axis, your mouse doesn't say locked to the same position of the card, so it's a little funky to control. Fun, but definitely funky.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...