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

mouseMove 960, 540 does not move to center of screen 1920x1080 #740

Open
Ober3550 opened this issue May 19, 2023 · 2 comments
Open

mouseMove 960, 540 does not move to center of screen 1920x1080 #740

Ober3550 opened this issue May 19, 2023 · 2 comments

Comments

@Ober3550
Copy link

Ober3550 commented May 19, 2023

Expected Behavior

Mouse moves to center of screen

Current Behavior

Mouse moves to 125% of coordinates

Possible Solution

Within my script multiplying x,y coords by 4/5 gets to the correct location

Steps to Reproduce (for bugs)

robot.mouseMove(960, 540);
vs
robot.moveMouse((960 * 4) / 5, (540 * 4) / 5);

Your Environment

  • RobotJS version: 0.6.0
  • Node.js version: v18.15.0
  • npm version: 9.5.0
  • Operating System: Windows 11
@plaili
Copy link

plaili commented Jul 2, 2023

Do you have scaling set to 100%? If not, you have to correct for the scaling factor
const display = electron.screen.getPrimaryDisplay()
robot.moveMouse(display.size.width * display.scaleFactor, display.size.height * display.scaleFactor)

@Muffeter
Copy link

@plaili thank u! I think this should be written in doc. People always ignore scaling.

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

3 participants