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

relativeY in click and dblclick events does not have the correct value #3687

Closed
joaopslins opened this issue May 2, 2024 · 2 comments · Fixed by #3688
Closed

relativeY in click and dblclick events does not have the correct value #3687

joaopslins opened this issue May 2, 2024 · 2 comments · Fixed by #3688
Labels

Comments

@joaopslins
Copy link
Contributor

Bug description

Seems like due to a copy-paste the y variable is not initialized with the correct value.

const getClickPosition = (e: MouseEvent): [number, number] => {
const rect = this.wrapper.getBoundingClientRect()
const x = e.clientX - rect.left
const y = e.clientX - rect.left
const relativeX = x / rect.width
const relativeY = y / rect.height
return [relativeX, relativeY]
}

const y = e.clientX - rect.left
Perhaps should have been:
const y = e.clientY - rect.top

Environment

  • Browser: Chrome

Minimal code snippet

Expected result

y value should be correct

Obtained result

y value is not correct

Screenshots

@joaopslins joaopslins added the bug label May 2, 2024
@katspaugh
Copy link
Owner

Oh good catch 🙈
Please feel free to open a PR, I’ll get to it on the weekend otherwise.

@joaopslins
Copy link
Contributor Author

I managed to open a PR. Please feel free to take a look when you can.
Thank you!

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

Successfully merging a pull request may close this issue.

2 participants