daybrush / moveable

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

Rotatable + uneven side = not correct rotation? #562

Open gaterin opened 2 years ago

gaterin commented 2 years ago

I am not sure if this is a bug or mathematical problem?

when I rotate an object with uneven sides it does not align anymore with throttledrag value?

demo in this gif

gridsize = 25 px throttledrag = gridsize big rectangle (1-54) = (20 x gridsize) x (5 x gridsize) small rectangle (1-37) = (20 x gridsize) x (4x gridsize)

the same thing happens with an uneven group+moveable rotateable_problem

daybrush commented 2 years ago

@gaterin

throttleDrag is applied to the value of translate.

Try using snapGridWidth and snapGridHeight instead of throttleDrag.

snapGridWidth={25} snapGridHeight={25}

gaterin commented 2 years ago

@daybrush

I have the exact same issue...

what now?

gaterin commented 2 years ago

This is the effect with snapgrid, it works soemtimes but sometimes not

snapGrid_bug