[rcore][android] Fix GESTURE_NONE not being reported when touch point…

This commit is contained in:
duvvuvenkataramana 2025-11-26 01:14:31 +05:30 committed by GitHub
parent 8bc889380a
commit 548c4a134d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -370,7 +370,10 @@ void ProcessGestureEvent(GestureEvent event)
} }
else if (event.touchAction == TOUCH_ACTION_MOVE) else if (event.touchAction == TOUCH_ACTION_MOVE)
{ {
GESTURES.Pinch.distance = rgVector2Distance(GESTURES.Touch.moveDownPositionA, GESTURES.Touch.moveDownPositionB); GESTURES.Pinch.distance = rgVector2Distance(
GESTURES.Touch.moveDownPositionA,
GESTURES.Touch.moveDownPositionB
);
GESTURES.Touch.moveDownPositionA = event.position[0]; GESTURES.Touch.moveDownPositionA = event.position[0];
GESTURES.Touch.moveDownPositionB = event.position[1]; GESTURES.Touch.moveDownPositionB = event.position[1];
@ -378,10 +381,18 @@ void ProcessGestureEvent(GestureEvent event)
GESTURES.Pinch.vector.x = GESTURES.Touch.moveDownPositionB.x - GESTURES.Touch.moveDownPositionA.x; GESTURES.Pinch.vector.x = GESTURES.Touch.moveDownPositionB.x - GESTURES.Touch.moveDownPositionA.x;
GESTURES.Pinch.vector.y = GESTURES.Touch.moveDownPositionB.y - GESTURES.Touch.moveDownPositionA.y; GESTURES.Pinch.vector.y = GESTURES.Touch.moveDownPositionB.y - GESTURES.Touch.moveDownPositionA.y;
if ((rgVector2Distance(GESTURES.Touch.previousPositionA, GESTURES.Touch.moveDownPositionA) >= MINIMUM_PINCH) || (rgVector2Distance(GESTURES.Touch.previousPositionB, GESTURES.Touch.moveDownPositionB) >= MINIMUM_PINCH)) if ((rgVector2Distance(GESTURES.Touch.previousPositionA, GESTURES.Touch.moveDownPositionA) >= MINIMUM_PINCH) ||
(rgVector2Distance(GESTURES.Touch.previousPositionB, GESTURES.Touch.moveDownPositionB) >= MINIMUM_PINCH))
{ {
if ( rgVector2Distance(GESTURES.Touch.previousPositionA, GESTURES.Touch.previousPositionB) > rgVector2Distance(GESTURES.Touch.moveDownPositionA, GESTURES.Touch.moveDownPositionB) ) GESTURES.current = GESTURE_PINCH_IN; if (rgVector2Distance(GESTURES.Touch.previousPositionA, GESTURES.Touch.previousPositionB) >
else GESTURES.current = GESTURE_PINCH_OUT; rgVector2Distance(GESTURES.Touch.moveDownPositionA, GESTURES.Touch.moveDownPositionB))
{
GESTURES.current = GESTURE_PINCH_IN;
}
else
{
GESTURES.current = GESTURE_PINCH_OUT;
}
} }
else else
{ {
@ -390,7 +401,10 @@ void ProcessGestureEvent(GestureEvent event)
} }
// NOTE: Angle should be inverted in Y // NOTE: Angle should be inverted in Y
GESTURES.Pinch.angle = 360.0f - rgVector2Angle(GESTURES.Touch.moveDownPositionA, GESTURES.Touch.moveDownPositionB); GESTURES.Pinch.angle = 360.0f - rgVector2Angle(
GESTURES.Touch.moveDownPositionA,
GESTURES.Touch.moveDownPositionB
);
} }
else if (event.touchAction == TOUCH_ACTION_UP) else if (event.touchAction == TOUCH_ACTION_UP)
{ {
@ -400,7 +414,6 @@ void ProcessGestureEvent(GestureEvent event)
GESTURES.Touch.pointCount = 0; GESTURES.Touch.pointCount = 0;
GESTURES.current = GESTURE_NONE; GESTURES.current = GESTURE_NONE;
}
} }
else if (GESTURES.Touch.pointCount == 0) // No touch points else if (GESTURES.Touch.pointCount == 0) // No touch points
{ {
@ -410,7 +423,6 @@ void ProcessGestureEvent(GestureEvent event)
{ {
// TODO: Process gesture events for more than two points // TODO: Process gesture events for more than two points
} }
}
// Update gestures detected (must be called every frame) // Update gestures detected (must be called every frame)
void UpdateGestures(void) void UpdateGestures(void)