mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-19 22:33:55 +00:00
add move mouse and move smooth relative code
This commit is contained in:
parent
f632105618
commit
82dcb4ec53
20
robotgo.go
20
robotgo.go
@ -433,6 +433,26 @@ func MoveSmooth(x, y int, args ...interface{}) bool {
|
|||||||
return bool(cbool)
|
return bool(cbool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MoveArgs move mose relative args
|
||||||
|
func MoveArgs(x, y int) (int, int) {
|
||||||
|
mx, my := GetMousePos()
|
||||||
|
mx = mx + x
|
||||||
|
my = my + y
|
||||||
|
|
||||||
|
return mx, my
|
||||||
|
}
|
||||||
|
|
||||||
|
// MoveRelative move mose relative
|
||||||
|
func MoveRelative(x, y int) {
|
||||||
|
Move(MoveArgs(x, y))
|
||||||
|
}
|
||||||
|
|
||||||
|
// MoveSmoothRelative move mose smooth relative
|
||||||
|
func MoveSmoothRelative(x, y int, args ...interface{}) {
|
||||||
|
mx, my := MoveArgs(x, y)
|
||||||
|
MoveSmooth(mx, my, args...)
|
||||||
|
}
|
||||||
|
|
||||||
// GetMousePos get mouse's portion
|
// GetMousePos get mouse's portion
|
||||||
func GetMousePos() (int, int) {
|
func GetMousePos() (int, int) {
|
||||||
pos := C.get_mouse_pos()
|
pos := C.get_mouse_pos()
|
||||||
|
Loading…
Reference in New Issue
Block a user