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

Wrong information for elementY when scrolling #4180

Closed
7 tasks done
leoatfentech opened this issue Aug 29, 2024 · 1 comment · Fixed by #4244
Closed
7 tasks done

Wrong information for elementY when scrolling #4180

leoatfentech opened this issue Aug 29, 2024 · 1 comment · Fixed by #4244

Comments

@leoatfentech
Copy link

Describe the bug

When scrolling, the elementY get changed, if we stop scrolling and move the cursor again the value goes back to its normal.

Enregistrement.de.l.ecran.2024-08-29.a.10.37.22.mov

Reproduction

https://vueuse.org/core/useMouseInElement/#usemouseinelement

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M3
    Memory: 106.08 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.7.3 - ~/.nvm/versions/node/v21.7.3/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v21.7.3/bin/npm
  Browsers:
    Chrome: 128.0.6613.85
    Safari: 17.6
  npmPackages:
    @vueuse/components: ^10.10.0 => 10.10.0
    @vueuse/core: ^10.10.0 => 10.10.0
    vue: ^3.4.21 => 3.4.27

Used Package Manager

npm

Validations

@pkc918
Copy link
Contributor

pkc918 commented Sep 2, 2024

It seems to be an issue with useMouse. When the page has already been scrolled and the mouse moves to get new coordinates, then scrolling again triggers an issue caused by executing pos[1] + window.scrollY. To resolve this, the last scroll position of the page needs to be recorded, and the difference between the two scrolls should be calculated.

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 a pull request may close this issue.

2 participants