anseki / plain-draggable

The simple and high performance library to allow HTML/SVG element to be dragged.
https://anseki.github.io/plain-draggable/
MIT License
765 stars 96 forks source link

translate and rotate at a time. #34

Closed niteshvaidya591 closed 4 years ago

niteshvaidya591 commented 4 years ago

Hi anseki, thank you for the awesome library . I added drag function to the div element , the same element i need to rotate , am unable to rotate the div element because of inline transform: translate style . how can i chain the css style like this with both rotate and drag functionality. .rotate { transform-origin: left; transform: translate(x, y) rotate(90deg) ; }

anseki commented 4 years ago

Hi @niteshvaidya591, thank you for the comment.

You can use leftTop option to avoid using translate function. For example: https://jsfiddle.net/ztofLb6p/ Note that this may be performance degradation.

anseki commented 4 years ago

Or, you can use a wrapper for translate function to avoid performance degradation. For example: https://jsfiddle.net/x1w9due3/

You have to adjust the same size and position of the draggable item and the wrapper. For example: https://jsfiddle.net/9k1rb7pq/

You can also adjust those by JS. For example: https://jsfiddle.net/26kbrycg/

niteshvaidya591 commented 4 years ago

Thank You so much for your examples I really appreciate it and once again thank you for the awesome library.

anseki commented 4 years ago

:smile: