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

Scalables are broken when persisted with zero width or zero height #927

Closed
vlorian-de opened this issue May 22, 2023 · 3 comments
Closed
Labels
bug Something isn't working complete
Milestone

Comments

@vlorian-de
Copy link

Environments

Framework name: React
Framework version: 18.2
Moveable Component version: 0.48.0
Testable Address: https://codesandbox.io/s/react-moveable-forked-6g9109?file=/src/App.tsx

Description

When working with Scalables, we've noticed a glitch. This occurs when the Scalable has a zero width or height. Even though the dimensions still appear correct, the position exhibits an odd offset. Once this kind of scale is persisted, it seems to break the Scalable completely. It becomes impossible to return it to a non-zero height/width, and it assumes a random position when a user attempts to rescale it.
image
(Position for non-zero heights is marked with yellow cross)

Interestingly, we don't encounter this issue when working with Resizables.
We tried to implement a workaround using Resizables but were unable to get the flipping over the axis to work.
Has anyone else been able to successfully implement this?

@daybrush daybrush added the bug Something isn't working label May 31, 2023
@daybrush daybrush added this to the 0.48.0 milestone May 31, 2023
daybrush added a commit that referenced this issue Jun 3, 2023
@daybrush
Copy link
Owner

daybrush commented Jun 4, 2023

@vlorian-de

  • croact-moveable 0.4.0
  • @moveable/helper 0.1.2
  • lit-moveable 0.25.0
  • moveable 0.48.0
  • preact-moveable 0.50.0
  • react-moveable 0.51.0
  • svelte-moveable 0.40.0
  • vue-moveable 2.0.0-beta.76
  • vue3-moveable 0.23.0
  • ngx-moveable 0.45.0

moveable's new version is released. Try it agian.

@daybrush
Copy link
Owner

daybrush commented Jun 4, 2023

@vlorian-de

But if the size is 0, the ratio is unknown.

If you want to use keepRatio

Try using e.setRatio(1); in onScaleStart.

@vlorian-de
Copy link
Author

Hello @daybrush
I have tested it both in the sandbox and in our project. The bug no longer occurs in either.
It's totally impressive how fast you fixed the bug and released the new release.
Thank you very much.

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