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

[useMouse()] mouse.y is off by 0.5 and shows as -0.5 when at the very top of the tracked element #232

Open
c0dezer019 opened this issue Aug 29, 2022 · 0 comments

Comments

@c0dezer019
Copy link

Describe the bug
Regardless of position, position increments as 1 and starts at 0.5, so 1.5, 2.5, 3.5 etc. Will track to -0.5 before pos value is set to none (when mouse is slightly just above the element).

To Reproduce
Steps to reproduce the behavior:

  1. Setup a div as specified in the instructions. Add <p>x: {mouse.x} y: {mouse.y}</p> to display pos within element.
  2. Start from the top
  3. Move mouse down the tracked div.
  4. Reverse steps.

Expected behavior
y is not offset by 0.5 and that the numbers either freeze (preferably freeze) or not displayed when pos is exactly 0.

Screenshots
error

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Brave
  • Version: 1.42.97

Additional context
Done with Next.JS and on a styled-component element. Not sure that this would be a cause though.

@c0dezer019 c0dezer019 changed the title mouse.y is off by 0.5 and shows as -0.5 when at the very top of the tracked element [useMouse()] mouse.y is off by 0.5 and shows as -0.5 when at the very top of the tracked element Aug 29, 2022
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

No branches or pull requests

1 participant