From 700e2c5e5db90702d7787c3cc231fc41f97d8de6 Mon Sep 17 00:00:00 2001 From: Asdqwe Date: Thu, 14 Nov 2024 06:49:35 -0300 Subject: [PATCH] Fix touch count reset (#4488) --- src/platforms/rcore_web.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index e15d3f5b..f9d93e5a 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -1778,11 +1778,14 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent // Gesture data is sent to gestures system for processing ProcessGestureEvent(gestureEvent); - - // Reset the pointCount for web, if it was the last Touch End event - if (eventType == EMSCRIPTEN_EVENT_TOUCHEND && CORE.Input.Touch.pointCount == 1) CORE.Input.Touch.pointCount = 0; #endif + if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) + { + CORE.Input.Touch.pointCount--; + if (CORE.Input.Touch.pointCount < 0) CORE.Input.Touch.pointCount = 0; + } + return 1; // The event was consumed by the callback handler }