Rotatable: setting the center of rotation
Environments
- Framework name: React
- Framework version: 17.0.2
- Moveable Component version: 0.34
- Testable Address(optional):
Description
Is it possible to change the center of the rotation? For example if instead of rotating around the center of the target, I'd like to rotate the element around a point [x, y] within the element?
@miina
you can use setFixedDirection on rotateStart
https://daybrush.com/moveable/storybook2/?path=/story/advanced-rotatable--rotate-with-custom-origin
@miina
you can use setFixedDirection on rotateStart
https://daybrush.com/moveable/storybook2/?path=/story/advanced-rotatable--rotate-with-custom-origin
Ah, thank you, I saw the storybook in the code for it but didn't find the story for some reason, wasn't sure it was for that. Does setFixedDirection use pixels as unit? Or looking at the code perhaps values from -1 to 1 where [0, 0] is the center, [-1, -1] is the left top?
@miina
Since it is a direction, it is determined according to the direction and is relative to offsetWidth and offsetHeight.
[0, 0] is center [-1, -1] left, top [1, -1] right top [-1, 1] left bottom [1, 1,] right bottom
@daybrush
Since it is a direction, it is determined according to the direction and is relative to offsetWidth and offsetHeight.
[0, 0] is center [-1, -1] left, top [1, -1] right top [-1, 1] right bottom [1, 1,] right bottom
[-1, 1] right bottom is it suppose to be left bottom?
@ngocducdim
right. my typo