override fun moveMouse()

in robot-server-core/src/main/kotlin/com/intellij/remoterobot/robot/SmoothRobot.kt [238:257]


    override fun moveMouse(x: Int, y: Int) {
        val pauseConstMs = settings().delayBetweenEvents().toLong()
        val n = 20
        val start = MouseInfo.getPointerInfo().location
        val dx = (x - start.x) / n.toDouble()
        val dy = (y - start.y) / n.toDouble()
        for (step in 1..n) {
            try {
                pause(pauseConstMs)
            } catch (e: InterruptedException) {
                e.printStackTrace()
            }

            basicRobot.moveMouse(
                (start.x + dx * ((ln(1.0 * step / n) - ln(1.0 / n)) * n / (0 - ln(1.0 / n)))).toInt(),
                (start.y + dy * ((ln(1.0 * step / n) - ln(1.0 / n)) * n / (0 - ln(1.0 / n)))).toInt()
            )
        }
        basicRobot.moveMouse(x, y)
    }