variables["DOUBLE_TAP"] = generateTapFunction(2);
variables["TRIPLE_TAP"] = generateTapFunction(3);
- auto generateFlickFunction = [&](int dx, int dy) {
- return EvaluationValueFunction{ [ &, dx, dy](EvaluationValue fingers) -> EvaluationValue {
+ auto generateFlickFunction = [&](int dx, int dy, int steps) {
+ return EvaluationValueFunction{ [ &, dx, dy, steps](EvaluationValue fingers) -> EvaluationValue {
auto root = getVisibleRoot();
if (!root) throw EvaluationFailure{} << "no visible root (context changed didn't happen)";
ASSERT(root->getObject());
auto x1 = x0 + dx;
auto y0 = mx.y - dy / 2;
auto y1 = y0 + dy;
- utils::generateDragGesture(x0, y0, x1, y1, 20, 0.0, fingerCount);
+ utils::generateDragGesture(x0, y0, x1, y1, steps, 0.0, fingerCount);
});
std::this_thread::sleep_for(std::chrono::milliseconds{ 600 });
return EvaluationValue{};
}, { { "fingers", 1 } } };
};
- variables["FLICK_RIGHT"] = generateFlickFunction(300, 0);
- variables["FLICK_LEFT"] = generateFlickFunction(-300, 0);
- variables["FLICK_UP"] = generateFlickFunction(0, -300);
- variables["FLICK_DOWN"] = generateFlickFunction(0, 300);
+
+ auto size = Singleton<UniversalSwitch>::instance().getMainWindow()->getDimensions().size;
+
+ // 280 = 360 - 2 * 40 ( 40 - left margin to emulate regular flick but not flick from side of the screen )
+ // 250 = 360 - 2 * 55 ( 55 - top margin to emulate regular flick but not flick from side of the screen )
+ // 360 x 360 - dimensions of wearable screen
+ auto width = size.width * 280 / 360;
+ auto height = size.height * 250 / 360;
+
+ // For flick gesture we set the step value to 20.
+ variables["FLICK_RIGHT"] = generateFlickFunction(width, 0, 20);
+ variables["FLICK_LEFT"] = generateFlickFunction(-width, 0, 20);
+ variables["FLICK_UP"] = generateFlickFunction(0, -height, 20);
+ variables["FLICK_DOWN"] = generateFlickFunction(0, height, 20);
+
+ // For drag gesture we set the step value to 60.
+ variables["DRAG_RIGHT"] = generateFlickFunction(width, 0, 60);
+ variables["DRAG_LEFT"] = generateFlickFunction(-width, 0, 60);
+ variables["DRAG_UP"] = generateFlickFunction(0, -height, 60);
+ variables["DRAG_DOWN"] = generateFlickFunction(0, height, 60);
auto generateWheelTurnFunction = [&]() {
return EvaluationValueFunction{ [&](bool clockwise, int multiplicity) -> EvaluationValue {