mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-05 00:03:55 +00:00
remove duplicate code
This commit is contained in:
parent
de187609d7
commit
2348a44ad6
35
robotgo.go
35
robotgo.go
@ -66,7 +66,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version string = "v0.49.0.600, Olympus Mons!"
|
version string = "v0.49.0.607, Olympus Mons!"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -359,9 +359,7 @@ func SaveCapture(spath string, args ...int) {
|
|||||||
// MoveMouse move the mouse
|
// MoveMouse move the mouse
|
||||||
func MoveMouse(x, y int) {
|
func MoveMouse(x, y int) {
|
||||||
// C.size_t int
|
// C.size_t int
|
||||||
cx := C.size_t(x)
|
Move(x, y)
|
||||||
cy := C.size_t(y)
|
|
||||||
C.move_mouse(cx, cy)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move move the mouse
|
// Move move the mouse
|
||||||
@ -373,9 +371,7 @@ func Move(x, y int) {
|
|||||||
|
|
||||||
// DragMouse drag the mouse
|
// DragMouse drag the mouse
|
||||||
func DragMouse(x, y int) {
|
func DragMouse(x, y int) {
|
||||||
cx := C.size_t(x)
|
Drag(x, y)
|
||||||
cy := C.size_t(y)
|
|
||||||
C.drag_mouse(cx, cy)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drag drag the mouse
|
// Drag drag the mouse
|
||||||
@ -388,30 +384,7 @@ func Drag(x, y int) {
|
|||||||
// MoveMouseSmooth move the mouse smooth,
|
// MoveMouseSmooth move the mouse smooth,
|
||||||
// moves mouse to x, y human like, with the mouse button up.
|
// moves mouse to x, y human like, with the mouse button up.
|
||||||
func MoveMouseSmooth(x, y int, args ...interface{}) bool {
|
func MoveMouseSmooth(x, y int, args ...interface{}) bool {
|
||||||
cx := C.size_t(x)
|
return MoveSmooth(x, y, args...)
|
||||||
cy := C.size_t(y)
|
|
||||||
|
|
||||||
var (
|
|
||||||
mouseDelay = 10
|
|
||||||
low C.double
|
|
||||||
high C.double
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(args) > 2 {
|
|
||||||
mouseDelay = args[2].(int)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(args) > 1 {
|
|
||||||
low = C.double(args[0].(float64))
|
|
||||||
high = C.double(args[1].(float64))
|
|
||||||
} else {
|
|
||||||
low = 1.0
|
|
||||||
high = 3.0
|
|
||||||
}
|
|
||||||
|
|
||||||
cbool := C.move_mouse_smooth(cx, cy, low, high, C.int(mouseDelay))
|
|
||||||
|
|
||||||
return bool(cbool)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveSmooth move the mouse smooth,
|
// MoveSmooth move the mouse smooth,
|
||||||
|
Loading…
Reference in New Issue
Block a user