From 222fe3c0b12cf8dc49430c132bd1741fd4038215 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 22 Feb 2025 15:07:38 +0100 Subject: [PATCH] improve --- client/eventsSDL/InputSourceTouch.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/eventsSDL/InputSourceTouch.cpp b/client/eventsSDL/InputSourceTouch.cpp index 0c0425063..c8bc7ac58 100644 --- a/client/eventsSDL/InputSourceTouch.cpp +++ b/client/eventsSDL/InputSourceTouch.cpp @@ -64,7 +64,7 @@ void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfin motionAccumulatedY[tfinger.fingerId] += tfinger.dy; float motionThreshold = 1.0 / std::min(screenSize.x, screenSize.y); - if(motionAccumulatedX[tfinger.fingerId] < motionThreshold && motionAccumulatedY[tfinger.fingerId] < motionThreshold && motionAccumulatedX[tfinger.fingerId] > -motionThreshold && motionAccumulatedY[tfinger.fingerId] > -motionThreshold) + if(std::abs(motionAccumulatedX[tfinger.fingerId]) < motionThreshold && std::abs(motionAccumulatedY[tfinger.fingerId]) < motionThreshold) return; if (CCS && CCS->curh && settings["video"]["cursor"].String() == "software" && state != TouchState::RELATIVE_MODE) @@ -121,8 +121,10 @@ void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfin } } - motionAccumulatedX[tfinger.fingerId] = 0; - motionAccumulatedY[tfinger.fingerId] = 0; + if(std::abs(motionAccumulatedX[tfinger.fingerId]) >= motionThreshold) + motionAccumulatedX[tfinger.fingerId] = 0; + if(std::abs(motionAccumulatedY[tfinger.fingerId]) >= motionThreshold) + motionAccumulatedY[tfinger.fingerId] = 0; } void InputSourceTouch::handleEventFingerDown(const SDL_TouchFingerEvent & tfinger)