}, { { "name" } } };
auto generateTapFunction = [&](size_t tapCount) {
- Optional<EvaluationValue> defValue;
- if (tapCount > 1)
- defValue = EvaluationValue{};
+
return EvaluationValueFunction{ [ &, tapCount](EvaluationValue target, EvaluationValue fingers) -> EvaluationValue {
+
auto root = getVisibleRoot();
if (!root) throw EvaluationFailure{} << "no visible root (context changed didn't happen)";
ASSERT(root->getObject());
coord = getUIElementPosition(dest).getCenterPoint();
} else
{
- if (tapCount == 1)
- throw EvaluationFailure{} << "no target value passed (you need target to do single tap)";
+ if (tapCount == 1 && fingers == 1)
+ throw EvaluationFailure{} << "no target value passed (you need target to do one finger single tap)";
}
auto sleep_until = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds{ 400 };
std::this_thread::sleep_until(sleep_until);
return EvaluationValue{};
- }, { { "target", defValue }, { "fingers", 1 } } };
+ }, { { "target", EvaluationValue{} }, { "fingers", 1 } } };
};
variables["TAP"] = generateTapFunction(1);
variables["DOUBLE_TAP"] = generateTapFunction(2);