Giter Site home page Giter Site logo

Comments (6)

JoonasVali avatar JoonasVali commented on May 23, 2024

Not sure I completely understand what you are asking, but the library itself uses java Robot underneath by default, which is also replacable by anything else.

If you need to press any mouse button, then usual Robot mouse API will be sufficient, the library does not have a wrapper for mouse buttons as it only addresses movement.

from naturalmousemotion.

pihomeserver avatar pihomeserver commented on May 23, 2024

Thank you @JoonasVali
I tried to use the standard robot function to simulate the click but then the mouse goes back to the previous location where i used the robot. So after each use of naturalmouse i have to call the move function of the robot
I guess that i am doing something wrong

from naturalmousemotion.

JoonasVali avatar JoonasVali commented on May 23, 2024

Hmm, that sounds wrong. I've never seen Robot behaving like that. I would search for logic mistakes in the code. A click should not affect position at all.

The code for a click should look something like that

robot.mousePress(InputEvent.BUTTON1_MASK);
Thread.sleep((int)(Math.random * 20)) 
robot.mouseRelease(InputEvent.BUTTON1_MASK);

If the issue persists, can you try set the Robot to the MouseMotionFactory and use that same Robot for clicking and see if it makes any difference?

This should look something like:

MouseMotionNature nature = factory.getNature();
SystemCalls systemCalls = new DefaultSystemCalls(myRobot);
nature.setSystemCalls(systemCalls);

from naturalmousemotion.

pihomeserver avatar pihomeserver commented on May 23, 2024

Your solution works !
In the mouse handler constructor i added

        MouseMotionNature nature = mouseFactory.getNature();
        SystemCalls systemCalls = new DefaultSystemCalls(robot);
        nature.setSystemCalls(systemCalls);
        mouseFactory.setNature(nature);

Thank you

from naturalmousemotion.

JoonasVali avatar JoonasVali commented on May 23, 2024

Good to know. I think this is something I haven't yet faced and maybe a larger issue in hiding. Thanks.

from naturalmousemotion.

pihomeserver avatar pihomeserver commented on May 23, 2024

In case of : Mac OS 10.14 with Java 13

from naturalmousemotion.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.