mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update mouse click and fix moveClick and movesClick args
This commit is contained in:
parent
dd65a1d6cb
commit
4705619e99
42
robotgo.go
42
robotgo.go
@ -455,40 +455,17 @@ func GetMousePos() (int, int) {
|
|||||||
|
|
||||||
// MouseClick click the mouse
|
// MouseClick click the mouse
|
||||||
func MouseClick(args ...interface{}) {
|
func MouseClick(args ...interface{}) {
|
||||||
var (
|
Click(args...)
|
||||||
button C.MMMouseButton
|
|
||||||
double C.bool
|
|
||||||
)
|
|
||||||
|
|
||||||
Try(func() {
|
|
||||||
// button = args[0].(C.MMMouseButton)
|
|
||||||
if args[0].(string) == "left" {
|
|
||||||
button = C.LEFT_BUTTON
|
|
||||||
}
|
|
||||||
if args[0].(string) == "center" {
|
|
||||||
button = C.CENTER_BUTTON
|
|
||||||
}
|
|
||||||
if args[0].(string) == "right" {
|
|
||||||
button = C.RIGHT_BUTTON
|
|
||||||
}
|
|
||||||
double = C.bool(args[1].(bool))
|
|
||||||
}, func(e interface{}) {
|
|
||||||
// fmt.Println("err:::", e)
|
|
||||||
button = C.LEFT_BUTTON
|
|
||||||
double = false
|
|
||||||
})
|
|
||||||
|
|
||||||
C.mouse_click(button, double)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click click the mouse
|
// Click click the mouse
|
||||||
func Click(args ...interface{}) {
|
func Click(args ...interface{}) {
|
||||||
var (
|
var (
|
||||||
button C.MMMouseButton
|
button C.MMMouseButton = C.LEFT_BUTTON
|
||||||
double C.bool
|
double C.bool
|
||||||
)
|
)
|
||||||
|
|
||||||
Try(func() {
|
if len(args) > 0 {
|
||||||
// button = args[0].(C.MMMouseButton)
|
// button = args[0].(C.MMMouseButton)
|
||||||
if args[0].(string) == "left" {
|
if args[0].(string) == "left" {
|
||||||
button = C.LEFT_BUTTON
|
button = C.LEFT_BUTTON
|
||||||
@ -499,12 +476,11 @@ func Click(args ...interface{}) {
|
|||||||
if args[0].(string) == "right" {
|
if args[0].(string) == "right" {
|
||||||
button = C.RIGHT_BUTTON
|
button = C.RIGHT_BUTTON
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(args) > 1 {
|
||||||
double = C.bool(args[1].(bool))
|
double = C.bool(args[1].(bool))
|
||||||
}, func(e interface{}) {
|
}
|
||||||
// fmt.Println("err:::", e)
|
|
||||||
button = C.LEFT_BUTTON
|
|
||||||
double = false
|
|
||||||
})
|
|
||||||
|
|
||||||
C.mouse_click(button, double)
|
C.mouse_click(button, double)
|
||||||
}
|
}
|
||||||
@ -512,13 +488,13 @@ func Click(args ...interface{}) {
|
|||||||
// MoveClick move and click the mouse
|
// MoveClick move and click the mouse
|
||||||
func MoveClick(x, y int, args ...interface{}) {
|
func MoveClick(x, y int, args ...interface{}) {
|
||||||
MoveMouse(x, y)
|
MoveMouse(x, y)
|
||||||
MouseClick(args)
|
MouseClick(args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MovesClick move smooth and click the mouse
|
// MovesClick move smooth and click the mouse
|
||||||
func MovesClick(x, y int, args ...interface{}) {
|
func MovesClick(x, y int, args ...interface{}) {
|
||||||
MoveSmooth(x, y)
|
MoveSmooth(x, y)
|
||||||
MouseClick(args)
|
MouseClick(args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseToggle toggle the mouse
|
// MouseToggle toggle the mouse
|
||||||
|
Loading…
Reference in New Issue
Block a user