Add more information for pinch gestures on mobile (#15092)

This commit is contained in:
Brent Page 2026-06-21 20:30:50 -07:00 committed by GitHub
parent 941dda1ccd
commit 65091012b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 68 additions and 33 deletions

View file

@ -837,6 +837,8 @@ typedef struct SDL_TouchFingerEvent
/**
* Pinch event structure (event.pinch.*)
*
* span_(x/y) and focus_(x/y) are only available for pinch gestures on mobile devices
*/
typedef struct SDL_PinchFingerEvent
{
@ -845,6 +847,10 @@ typedef struct SDL_PinchFingerEvent
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
float scale; /**< The scale change since the last SDL_EVENT_PINCH_UPDATE. Scale < 1 is "zoom out". Scale > 1 is "zoom in". */
SDL_WindowID windowID; /**< The window underneath the finger, if any */
float span_x; /**< On mobile devices, the average X distance between each of the pointers forming the pinch in window coordinates. Otherwise, -1. */
float span_y; /**< On mobile devices, the average Y distance between each of the pointers forming the pinch in window coordinates. Otherwise, -1. */
float focus_x; /**< On mobile devices, the X coordinate of the current gesture's focal point in window coordinates. Otherwise, -1. */
float focus_y; /**< On mobile devices, the Y coordinate of the current gesture's focal point in window coordinates. Otherwise, -1. */
} SDL_PinchFingerEvent;
/**