react-rnd icon indicating copy to clipboard operation
react-rnd copied to clipboard

Update index.tsx

Open montekaka opened this issue 4 years ago • 3 comments

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 avatar Aug 29 '20 03:08 montekaka

@montekaka Thanks 👍

I think it should be return the same result as the onDragStop

Why do you think so?

bokuweb avatar Aug 29 '20 12:08 bokuweb

@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. Screen Shot 2020-08-29 at 12 36 46 PM

Should I not use onDrag for such purpose?

Please advise.

montekaka avatar Aug 29 '20 19:08 montekaka

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

montekaka avatar Aug 29 '20 20:08 montekaka