Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.tsx #736

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update index.tsx #736

wants to merge 2 commits into from

Conversation

montekaka
Copy link

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 });

fix the typo on onDrag method, and make it match with the return result of onDragStop
@bokuweb
Copy link
Owner

bokuweb commented Aug 29, 2020

@montekaka Thanks 👍

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

Why do you think so?

@montekaka
Copy link
Author

montekaka commented Aug 29, 2020

@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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants