mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-04-11 09:12:05 -07:00
feat: Add humanize:minTime
Set the minimum time of the cursor movement.
This commit is contained in:
parent
c448ec81ab
commit
3b996534d8
1 changed files with 8 additions and 1 deletions
|
|
@ -182,6 +182,13 @@ class HumanizeMouseTrajectory {
|
||||||
return 150;
|
return 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t getMinTime() const {
|
||||||
|
if (auto minTime = MaskConfig::GetDouble("humanize:minTime")) {
|
||||||
|
return static_cast<int32_t>(minTime.value() * 100);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::vector<double>> tweenPoints(
|
std::vector<std::vector<double>> tweenPoints(
|
||||||
const std::vector<std::vector<double>>& points) const {
|
const std::vector<std::vector<double>>& points) const {
|
||||||
assert(isListOfPoints(points) && "List of points not valid");
|
assert(isListOfPoints(points) && "List of points not valid");
|
||||||
|
|
@ -196,7 +203,7 @@ class HumanizeMouseTrajectory {
|
||||||
// Uses a power scale to keep the speed consistent
|
// Uses a power scale to keep the speed consistent
|
||||||
int targetPoints = std::min(
|
int targetPoints = std::min(
|
||||||
getMaxTime(),
|
getMaxTime(),
|
||||||
std::max(2, static_cast<int>(std::pow(totalLength, 0.25) * 20)));
|
std::max(getMinTime() + 2, static_cast<int>(std::pow(totalLength, 0.25) * 20)));
|
||||||
|
|
||||||
std::vector<std::vector<double>> res;
|
std::vector<std::vector<double>> res;
|
||||||
for (int i = 0; i < targetPoints; i++) {
|
for (int i = 0; i < targetPoints; i++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue