We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 062be3f commit a3346abCopy full SHA for a3346ab
src/robotjs.cc
@@ -199,7 +199,22 @@ NAN_METHOD(scrollMouse)
199
if(info.Length() == 2)
200
{
201
int scrollMagnitude = info[0]->Int32Value();
202
- int scrollDirection = info[1]->Int32Value();
+ char *s = (*v8::String::Utf8Value(info[1]->ToString()));
203
+
204
+ MMMouseWheelDirection scrollDirection;
205
206
+ if (strcmp(s, "up") == 0)
207
+ {
208
+ scrollDirection = DIRECTION_UP;
209
+ }
210
+ else if (strcmp(s, "down") == 0)
211
212
+ scrollDirection = DIRECTION_DOWN;
213
214
+ else
215
216
+ return Nan::ThrowError("Invalid scroll direction specified.");
217
218
219
scrollMouse(scrollMagnitude, scrollDirection);
220
microsleep(mouseDelay);
0 commit comments