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

Individual transform properties #969

Open
ssvendsen opened this issue Jul 4, 2023 · 6 comments
Open

Individual transform properties #969

ssvendsen opened this issue Jul 4, 2023 · 6 comments
Labels
bug Something isn't working complete

Comments

@ssvendsen
Copy link

Is it possible to make Moveable work with individual transform properties, such as https://developer.mozilla.org/en-US/docs/Web/CSS/rotate? If the target element has rotations applied using the "rotate" CSS property instead of the "transform" CSS property, Moveable doesn't seem to render the control box with the correct initial rotation. Thanks!

@daybrush daybrush added bug Something isn't working WIP-complete labels Jul 4, 2023
daybrush added a commit that referenced this issue Jul 4, 2023
@daybrush
Copy link
Owner

daybrush commented Jul 4, 2023

@ssvendsen

  • croact-moveable 0.6.2
  • @moveable/helper 0.1.3
  • lit-moveable 0.27.2
  • moveable 0.50.2
  • preact-moveable 0.52.2
  • react-moveable 0.53.2
  • svelte-moveable 0.42.2
  • vue-moveable 2.0.0-beta.81
  • vue3-moveable 0.25.2
  • ngx-moveable 0.47.2

moveable's new version iis released.

Rendering will work.

However, support for the value of individual transform is planned in the future.

@ssvendsen
Copy link
Author

Thanks for the quick response. This seems to cover our use case. We'll try it out within a few days and let you know.

@ssvendsen
Copy link
Author

I gave the updates a try. I wonder if there are some issues with matrix calculations in the internal getMatrixStackInfo() function when applying the new style rotate prop in isolation. If I apply the classic transform prop (e.g. transform: translate(0,0)) at the same time things work fine. What I see in the error case is that the Moveable rectangle + handles do not render. I got a feeling it is related to 2d vs 3d matrix handling in mentioned function but I might be wrong.
Other than that I realize that the individual transform properties are always applied before the classic transform property (by the browser), causing some challenges in my particular case. But that is another story.

@daybrush
Copy link
Owner

@ssvendsen

moveable's new version is released. Check it again.

If not, can you tell me the address where I can test it?

@ssvendsen
Copy link
Author

Yes, with 0.54.1 the Moveable rectangle renders as expected when individual rotate is used - thanks.
As I mentioned above, I realized my use case in any case poses some challenges. In my case I apply the transform reported by Moveable in onDrag to the target element during the drag operation, but in onDragEnd I clear the transform and set the 'left' and 'top' style props of the target element instead. But with an individual rotate set on the target element, the 'left' and 'top' props reported in by Moveable in onDragEnd are 'rotated' as well, which complicates things a bit. But I should be able to do the math to make it work. Thanks for the help, you can close this if you want.

@daybrush
Copy link
Owner

@ssvendsen

left, top are very inaccurate.

The browser rounds up and renders in units of 1px.

So you have to use translate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working complete
Projects
None yet
Development

No branches or pull requests

2 participants