MCPcopy Create free account
hub / github.com/WallBreaker2/op / DragPath

Method DragPath

libop/input/mouse/WinMouse.cpp:494–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494long WinMouse::DragPath(const std::wstring &path_text, int duration) {
495 std::vector<POINT> key_points;
496 const int resolved_duration = resolve_trajectory_duration(duration);
497 if (resolved_duration < 0 || !parse_mouse_path(path_text, key_points))
498 return 0;
499
500 const std::vector<POINT> path = expand_mouse_path(key_points);
501 if (path.size() < 2)
502 return 0;
503 if (!MoveTo(path.front().x, path.front().y))
504 return 0;
505
506 const long down_ret = LeftDown();
507 if (!down_ret)
508 return 0;
509
510 delay_if_needed(_trajectory_start_delay);
511 std::vector<POINT> moving_path(path.begin() + 1, path.end());
512 const long move_ret =
513 run_mouse_path(moving_path, resolved_duration, [this](POINT pt) { return MoveTo(pt.x, pt.y); });
514 // 拖拽到终点后先停一下再松手,更接近按住后确认落点的操作习惯。
515 delay_if_needed(_trajectory_end_delay);
516 const long up_ret = LeftUp();
517 return move_ret && up_ret ? 1 : 0;
518}
519
520long WinMouse::SetMouseTrajectory(int mode, int min_duration, int max_duration, int jitter, int start_delay,
521 int end_delay) {

Callers

nothing calls this directly

Calls 7

parse_mouse_pathFunction · 0.85
expand_mouse_pathFunction · 0.85
delay_if_neededFunction · 0.85
run_mouse_pathFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected