Closed yairEO closed 3 years ago
Thanks for reporting! I've also identified the need for that and started to work on a new operation called relative(ref)
which will convert the coordinates to be relative to the given ref
. I'm still working out the details, but it will be part of v1.3
Found a bug related to this new change:
https://codesandbox.io/s/agitated-wind-5j6t9?file=/Example.jsx
https://user-images.githubusercontent.com/845031/118973858-d07e0300-b97a-11eb-9037-da299a5f4c28.mp4
When simply clicking the movable element (not dragging) - Update
callback is fired with undesired left
/top
values.
values should be an exact multiply of the snap
setting value (which is set to in this example 50
)
Need to investigate why this is happening and not simply round before sending the position values
{left: 199.9999771118164, top: 99.98579406738281}
This might seem insignificant, but is has huge impact on some use-cases
The
update
callback is fired withtop
&left
coordinates which are relative to the viewport, but in some situations it is preferred to be relative to the container (set in thecontain
operation). I suggest telling theMovable
component this, in some way. Perhaps add a 3rd parameter to thecontain
operation which will indicate this wish.