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

round rotate near 90 multiple degrees angles #928

Open
Nonoizz opened this issue May 23, 2023 · 8 comments
Open

round rotate near 90 multiple degrees angles #928

Nonoizz opened this issue May 23, 2023 · 8 comments

Comments

@Nonoizz
Copy link

Nonoizz commented May 23, 2023

Environments

  • Framework name: Angular
  • Framework version: 14
  • Moveable Component version: ^0.43.1

Description

When using rotate, i would like the 90 degrees angle (0, 90, 180, 270) to be blocked when the value is close.
For example

  • with a rotate angle of 55, it stays at 55
  • with a rotate angle between 87 and 93, i would like the rotation to stay at 90
  • with an angle of 100, it stays at 100

It only rounds when the value is close of 0, 90, 180, 270

check this for inspiration:
rotation

What's the best solution to achieve this kind of behavior ?

Thanks for reading

@daybrush
Copy link
Owner

@Nonoizz

Sounds like a good idea.

I'll add it in the next update.

@daybrush daybrush added this to the 0.48.0 milestone May 31, 2023
@jadiagaurang
Copy link

@Nonoizz @daybrush

Yes, This is a very good idea. I am also looking forward to add to improve UX.

Possible config:

snapRotation: true,
snapRotationThreshold: 1,	// +/- 1 deg
snapRotationDegrees: [
  0,
  90,
  180,
  270
]

@daybrush
Copy link
Owner

daybrush commented Jun 4, 2023

@jadiagaurang @Nonoizz

  • 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.
snapRotationThreshold (default: 5), snapRotationDegrees (default: []) props are added

See this example:
https://daybrush.com/moveable/storybook/?path=/story/snap-bound--snap-rotations

@Nonoizz
Copy link
Author

Nonoizz commented Jun 5, 2023

Amazing! nice job!

@jadiagaurang
Copy link

@daybrush

I tried this new config. It worked very well. Thanks again!

@davidalejandroaguilar
Copy link

@daybrush You accidentally named this snapRotationDegress instead of snapRotationDegrees, even though in the Storybook you shared its spelled correctly.

image

@daybrush
Copy link
Owner

daybrush commented Jun 20, 2023

@davidalejandroaguilar

Oh sorry, I'll fix it in the next version.

@daybrush daybrush modified the milestones: 0.48.0, 0.49.0 Jun 20, 2023
@daybrush
Copy link
Owner

@jadiagaurang @Nonoizz @davidalejandroaguilar

  • croact-moveable 0.5.0
  • @moveable/helper 0.1.3
  • lit-moveable 0.26.0
  • moveable 0.49.0
  • preact-moveable 0.51.0
  • react-moveable 0.52.0
  • svelte-moveable 0.41.0
  • vue-moveable 2.0.0-beta.77
  • vue3-moveable 0.24.0
  • ngx-moveable 0.46.0

moveable's new version is released.

Change prop name snapRotationDegress to snapRotationDegrees.
Check it again.

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

No branches or pull requests

4 participants