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

fix mouse #154

Closed
wants to merge 1 commit into from
Closed

fix mouse #154

wants to merge 1 commit into from

Conversation

ekrenzin
Copy link
Contributor

@ekrenzin ekrenzin commented Feb 22, 2023

Description

I experienced the issue described in #126. I tested out the solution to the issue (listed in the original post) and confirmed that the provided change resolved the problem for me.

Steps to reproduce:

It's extremely easy to reproduce the bug, and notably, the x coordinate moves as well. To reproduce, run the following code:

function loop() {
 try {
   const mp = libnut.getMousePos()
   libnut.moveMouse(mp.x, mp.y)
   console.log('loop', mp)
   loop()
 } catch (e) {
   console.log('loop error', e)
 }
}

loop()

Expected:

The cursor should stay in the same position.

Result:

The cursor moves to "breakpoints" where it stops; if the cursor is moved from a "breakpoint," it will begin creeping towards the next one.

Comments

The solution worked well in testing, however, if this solution does not work for the repo, is there another solution that could be implemented?

I hope all is well @s1hofmann & thank you for maintaining!

@s1hofmann
Copy link
Member

Hi @ekrenzin 👋

everything is fine on my end, thanks for asking!

I will brush up on this topic once again before merging, thanks for opening the PR to get things rolling!

All the best

Simon

@ekrenzin
Copy link
Contributor Author

ekrenzin commented Mar 2, 2023

Hey @s1hofmann !

I wanted to follow up on this PR to see if there was anything blocking which I could help with looking into. I understand you are busy, so I truly appreciate the time you take to look into these issues.

Let me know what I can do to assist you :)

Best,
Ean

@s1hofmann
Copy link
Member

Hi @ekrenzin 👋

I had another look at both code and docs and came to the conclusion that the added addition just tips over the rounding process to avoid the drift.

I'd prefer wrapping the calculation into a call to ceil instead of the addition, did you give this a try yet?

Thanks for your contribution! ❤️

All the best

Simon

@s1hofmann
Copy link
Member

@s1hofmann s1hofmann closed this Mar 6, 2023
@ekrenzin
Copy link
Contributor Author

ekrenzin commented Mar 6, 2023

@s1hofmann I really appreciate you making that PR! I was about to sit down and work on the change you requested and saw it was done! Thank you so much!

@s1hofmann
Copy link
Member

@ekrenzin You're welcome. Took a while until I found the time to sit down and have a proper look.

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