@@ -578,24 +578,11 @@ func Drag(x, y int, args ...string) {
578578func DragSmooth (x , y int , args ... interface {}) {
579579 Toggle ("left" )
580580 MilliSleep (50 )
581- MoveSmooth (x , y , args ... )
581+ smoothMove (x , y , true , args ... )
582582 Toggle ("left" , "up" )
583583}
584584
585- // MoveSmooth move the mouse smooth,
586- // moves mouse to x, y human like, with the mouse button up.
587- //
588- // robotgo.MoveSmooth(x, y int, low, high float64, mouseDelay int)
589- //
590- // Examples:
591- //
592- // robotgo.MoveSmooth(10, 10)
593- // robotgo.MoveSmooth(10, 10, 1.0, 2.0)
594- func MoveSmooth (x , y int , args ... interface {}) bool {
595- // if runtime.GOOS == "windows" {
596- // f := ScaleF()
597- // x, y = Scaled0(x, f), Scaled0(y, f)
598- // }
585+ func smoothMove (x , y int , drag bool , args ... interface {}) bool {
599586 x , y = MoveScale (x , y )
600587
601588 cx := C .int32_t (x )
@@ -619,12 +606,30 @@ func MoveSmooth(x, y int, args ...interface{}) bool {
619606 high = 3.0
620607 }
621608
622- cbool := C .smoothlyMoveMouse (C .MMPointInt32Make (cx , cy ), low , high )
609+ var cbool C.bool
610+ if drag {
611+ cbool = C .smoothlyDragMouse (C .MMPointInt32Make (cx , cy ), low , high , C .LEFT_BUTTON )
612+ } else {
613+ cbool = C .smoothlyMoveMouse (C .MMPointInt32Make (cx , cy ), low , high )
614+ }
623615 MilliSleep (MouseSleep + mouseDelay )
624616
625617 return bool (cbool )
626618}
627619
620+ // MoveSmooth move the mouse smooth,
621+ // moves mouse to x, y human like, with the mouse button up.
622+ //
623+ // robotgo.MoveSmooth(x, y int, low, high float64, mouseDelay int)
624+ //
625+ // Examples:
626+ //
627+ // robotgo.MoveSmooth(10, 10)
628+ // robotgo.MoveSmooth(10, 10, 1.0, 2.0)
629+ func MoveSmooth (x , y int , args ... interface {}) bool {
630+ return smoothMove (x , y , false , args ... )
631+ }
632+
628633// MoveArgs get the mouse relative args
629634func MoveArgs (x , y int ) (int , int ) {
630635 mx , my := Location ()
0 commit comments