Class DefaultOvershootManager

    • Field Detail

      • OVERSHOOT_SPEEDUP_DIVIDER

        public static final double OVERSHOOT_SPEEDUP_DIVIDER
        See Also:
        Constant Field Values
      • MIN_OVERSHOOT_MOVEMENT_MS

        public static final int MIN_OVERSHOOT_MOVEMENT_MS
        See Also:
        Constant Field Values
      • OVERSHOOT_RANDOM_MODIFIER_DIVIDER

        public static final int OVERSHOOT_RANDOM_MODIFIER_DIVIDER
        See Also:
        Constant Field Values
      • MIN_DISTANCE_FOR_OVERSHOOTS

        public static final int MIN_DISTANCE_FOR_OVERSHOOTS
        See Also:
        Constant Field Values
      • DEFAULT_OVERSHOOT_AMOUNT

        public static final int DEFAULT_OVERSHOOT_AMOUNT
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultOvershootManager

        public DefaultOvershootManager​(java.util.Random random)
    • Method Detail

      • getOvershoots

        public int getOvershoots​(Flow flow,
                                 long mouseMovementMs,
                                 double distance)
        Description copied from interface: OvershootManager
        Get the maximum amount of overshoots the cursor does before reaching its final destination.
        Specified by:
        getOvershoots in interface OvershootManager
        Parameters:
        flow - the flow which is planned to be used to reach the target. (If returned overshoots > 0, then a new flow will be calculated for each overshoot.). This flow could be analyzed if overshooting is suitable. It is not available as a parameter in overshootAmount calculation, because flow itself is calculated from the movement distance, which is dependent on the overshoot amount.
        mouseMovementMs - the planned time for reaching the real target
        distance - the distance between mouse position and real target
        Returns:
        the number of maximum overshoots used or 0 if no overshoots
      • getOvershootAmount

        public java.awt.Point getOvershootAmount​(double distanceToRealTargetX,
                                                 double distanceToRealTargetY,
                                                 long mouseMovementMs,
                                                 int overshootsRemaining)
        Description copied from interface: OvershootManager
        Returns the overshoot amount which will be added to real target, thus getting the overshoot target.
        Specified by:
        getOvershootAmount in interface OvershootManager
        Parameters:
        distanceToRealTargetX - distance to real target X-coordinate
        distanceToRealTargetY - distance to real target Y-coordinate
        mouseMovementMs - the time planned for reaching the real target
        overshootsRemaining - the amount of overshoots remaining, current included. Values from (n to 1), where n >= 1
        Returns:
        the amount which will be added to real target, thus getting the overshoot target.
      • deriveNextMouseMovementTimeMs

        public long deriveNextMouseMovementTimeMs​(long mouseMovementMs,
                                                  int overshootsRemaining)
        Description copied from interface: OvershootManager
        Once the mouse reaches the overshoot target, new trajectory with new speed is calculated for next target (can be real or overshoot target, if the next target is real target, the overshootsRemaining value is 0)
        Specified by:
        deriveNextMouseMovementTimeMs in interface OvershootManager
        Parameters:
        mouseMovementMs - the last mouse movement in ms
        overshootsRemaining - the amount of overshoots remaining, including this. Values from (n to 0), where n >= 0
        Returns:
        the next mouse movement time in ms
      • getMinOvershootMovementMs

        public long getMinOvershootMovementMs()
      • setMinOvershootMovementMs

        public void setMinOvershootMovementMs​(long minOvershootMovementMs)
      • getOvershootRandomModifierDivider

        public double getOvershootRandomModifierDivider()
      • setOvershootRandomModifierDivider

        public void setOvershootRandomModifierDivider​(double overshootRandomModifierDivider)
      • getOvershootSpeedupDivider

        public double getOvershootSpeedupDivider()
      • setOvershootSpeedupDivider

        public void setOvershootSpeedupDivider​(double overshootSpeedupDivider)
      • getOvershoots

        public int getOvershoots()
      • setOvershoots

        public void setOvershoots​(int overshoots)
      • getMinDistanceForOvershoots

        public long getMinDistanceForOvershoots()
      • setMinDistanceForOvershoots

        public void setMinDistanceForOvershoots​(long minDistanceForOvershoots)