react-rnd
react-rnd copied to clipboard
Update index.tsx
There is a typo on the onDrag method returns
return this.props.onDrag(e, { ...data, x: data.x - offset.left, y: data.y - offset.top });
I think it should be return the same result as the onDragStop
return this.props.onDragStop(e, { ...data, x: data.x + left, y: data.y + top });
@montekaka Thanks 👍
I think it should be return the same result as the onDragStop
Why do you think so?
@bokuweb I would like to use the onDrag method to detect the current coordinates, and I expect the last onDrag will return the same coordinates as the onDragStop. But I see a different result. e.g.
Should I not use onDrag for such purpose?
Please advise.
For example, this one, you can see the onDrag and onDragStop have different coordinates
https://codesandbox.io/s/compassionate-feistel-nfpdb?fontsize=14&hidenavigation=1&theme=dark