mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13:55 +00:00
add move smooth return
This commit is contained in:
parent
1b840c8102
commit
9412f8be63
@ -64,15 +64,14 @@ int drag_mouse(size_t x, size_t y){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int move_mouse_smooth(size_t x, size_t y, double lowSpeed,
|
||||
bool move_mouse_smooth(size_t x, size_t y, double lowSpeed,
|
||||
double highSpeed, int msDelay){
|
||||
MMPoint point;
|
||||
point = MMPointMake(x, y);
|
||||
smoothlyMoveMouse(point, lowSpeed, highSpeed);
|
||||
bool cbool = smoothlyMoveMouse(point, lowSpeed, highSpeed);
|
||||
microsleep(msDelay);
|
||||
|
||||
return 0;
|
||||
|
||||
return cbool;
|
||||
}
|
||||
|
||||
MMPoint get_mouse_pos(){
|
||||
|
@ -335,8 +335,8 @@ bool smoothlyMoveMouse(MMPoint endPoint, double lowSpeed, double highSpeed)
|
||||
double distance;
|
||||
|
||||
while ((distance =
|
||||
crude_hypot((double)pos.x - endPoint.x, (double)pos.y - endPoint.y))
|
||||
> 1.0) {
|
||||
crude_hypot((double)pos.x - endPoint.x, (double)pos.y - endPoint.y)
|
||||
) > 1.0) {
|
||||
|
||||
double gravity = DEADBEEF_UNIFORM(5.0, 500.0);
|
||||
// double gravity = DEADBEEF_UNIFORM(lowSpeed, highSpeed);
|
||||
|
14
robotgo.go
14
robotgo.go
@ -63,7 +63,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
version string = "v0.48.0.509, Ben Nevis!"
|
||||
version string = "v0.48.0.510, Ben Nevis!"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -375,7 +375,7 @@ func Drag(x, y int) {
|
||||
|
||||
// MoveMouseSmooth move the mouse smooth,
|
||||
// moves mouse to x, y human like, with the mouse button up.
|
||||
func MoveMouseSmooth(x, y int, args ...interface{}) {
|
||||
func MoveMouseSmooth(x, y int, args ...interface{}) bool {
|
||||
cx := C.size_t(x)
|
||||
cy := C.size_t(y)
|
||||
|
||||
@ -397,12 +397,14 @@ func MoveMouseSmooth(x, y int, args ...interface{}) {
|
||||
high = 3.0
|
||||
}
|
||||
|
||||
C.move_mouse_smooth(cx, cy, low, high, C.int(mouseDelay))
|
||||
cbool := C.move_mouse_smooth(cx, cy, low, high, C.int(mouseDelay))
|
||||
|
||||
return bool(cbool)
|
||||
}
|
||||
|
||||
// MoveSmooth move the mouse smooth,
|
||||
// moves mouse to x, y human like, with the mouse button up.
|
||||
func MoveSmooth(x, y int, args ...interface{}) {
|
||||
func MoveSmooth(x, y int, args ...interface{}) bool {
|
||||
cx := C.size_t(x)
|
||||
cy := C.size_t(y)
|
||||
|
||||
@ -424,7 +426,9 @@ func MoveSmooth(x, y int, args ...interface{}) {
|
||||
high = 3.0
|
||||
}
|
||||
|
||||
C.move_mouse_smooth(cx, cy, low, high, C.int(mouseDelay))
|
||||
cbool := C.move_mouse_smooth(cx, cy, low, high, C.int(mouseDelay))
|
||||
|
||||
return bool(cbool)
|
||||
}
|
||||
|
||||
// GetMousePos get mouse portion
|
||||
|
Loading…
Reference in New Issue
Block a user