daybrush / moveable

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

Couldn't work as expected on snapThreshold setting to 0. #774

Closed zhbhun closed 1 year ago

zhbhun commented 1 year ago

Environments

Description

When setting snapThreshold to 0, the drag target's guidelines should only be displayed if it exactly matches the coordinates of the guide element.

https://codesandbox.io/s/funny-glitter-ug3qu6?file=/src/styles.css

BTW: I found moveable force snapThreshold to 1.

https://github.com/daybrush/moveable/blob/d96d5ce7ceb0c3b74824703ee7000d530db4d2df/packages/react-moveable/src/react-moveable/ables/Snappable.tsx#L664

https://github.com/daybrush/moveable/blob/d96d5ce7ceb0c3b74824703ee7000d530db4d2df/packages/react-moveable/src/react-moveable/ables/snappable/snap.ts#L145-L148

daybrush commented 1 year ago

@zhbhun Because it is expected that there will be cases where the distance is less than 0.1, the guideline may not be displayed properly. So I set the minimum distance to 1. are you okay?

zhbhun commented 1 year ago

Get it, perhaps a separate configuration could be provided to distinguish snapThreshold, which is used to control the precision of the display of the guide lines.

daybrush commented 1 year ago

@zhbhun

moveable's new version is released.

snapRenderThreshold prop is added (default: 1)