Skip to content

Commit ecdd16a

Browse files
committed
Added mouseMoveSmooth.
1 parent 39ef2f7 commit ecdd16a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/robotjs.cc

+19
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ NAN_METHOD(moveMouse)
3333
NanReturnValue(NanNew("1"));
3434
}
3535

36+
NAN_METHOD(moveMouseSmooth)
37+
{
38+
NanScope();
39+
if (args.Length() < 2)
40+
{
41+
return NanThrowError("Invalid number of arguments");
42+
}
43+
size_t x = args[0]->Int32Value();
44+
size_t y = args[1]->Int32Value();
45+
46+
MMPoint point;
47+
point = MMPointMake(x, y);
48+
smoothlyMoveMouse(point);
49+
NanReturnValue(NanNew("1"));
50+
}
51+
3652
NAN_METHOD(getMousePos)
3753
{
3854
NanScope();
@@ -99,6 +115,9 @@ void init(Handle<Object> target)
99115
target->Set(NanNew<String>("moveMouse"),
100116
NanNew<FunctionTemplate>(moveMouse)->GetFunction());
101117

118+
target->Set(NanNew<String>("moveMouseSmooth"),
119+
NanNew<FunctionTemplate>(moveMouseSmooth)->GetFunction());
120+
102121
target->Set(NanNew<String>("getMousePos"),
103122
NanNew<FunctionTemplate>(getMousePos)->GetFunction());
104123

0 commit comments

Comments
 (0)