daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.08k stars 618 forks source link

Idea how to keep throttleDrag when element is snapped #789

Closed rasfront closed 1 year ago

rasfront commented 1 year ago

@daybrush i have an idea how to keep throttleDrag then element is snapped. Look. The snappable is workign in 2 axis - horizontal and vertical. When element snapping by x or y or both axises you turn off throttleDrag to make accurancy snapping (in most cases you need turn off throttleDrag to make correct elements position depends on snapping elements). So you can go by another way. You can turn off throttleDrag to x axis or y axis depends on which axis is snapping. Whe we have horizontalSnaping you can turn off y axis of throttleDrag, when we have verticalSnapping you can turn off x axis of throttleDrag.

Do you understand my idea?

rasfront commented 1 year ago

Yes it is work. Here is my code screenshot

image

daybrush commented 1 year ago

@Raserad

I know what you mean. However, when rotated, it becomes difficult to distinguish between vertical and horizontal.

The behavior of throttleDrag will change. Instead of the values of beforeTranslate and translate, it is changed based on the screen.

daybrush commented 1 year ago

@Raserad

I fixed it according to your suggestion. Check it again.