From 42474ab3e98c575f499bb58581dcc79ba1497357 Mon Sep 17 00:00:00 2001 From: tritao Date: Thu, 24 Apr 2025 19:06:54 +0100 Subject: [PATCH] [Core] Add `Clay_GetPointerData` function to the public API. This adds a new `Clay_GetPointerData` function to the public API that returns information on the current state of pointer interactions. --- clay.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/clay.h b/clay.h index 9f19d5d..7c4256c 100644 --- a/clay.h +++ b/clay.h @@ -844,6 +844,8 @@ CLAY_DLL_EXPORT void Clay_OnHover(void (*onHoverFunction)(Clay_ElementId element // An imperative function that returns true if the pointer position provided by Clay_SetPointerState is within the element with the provided ID's bounding box. // This ID can be calculated either with CLAY_ID() for string literal IDs, or Clay_GetElementId for dynamic strings. CLAY_DLL_EXPORT bool Clay_PointerOver(Clay_ElementId elementId); +// Returns information on the current state of pointer interactions. +CLAY_DLL_EXPORT Clay_PointerData Clay_GetPointerData(void); // Returns data representing the state of the scrolling element with the provided ID. // The returned Clay_ScrollContainerData contains a `found` bool that will be true if a scroll element was found with the provided ID. // An imperative function that returns true if the pointer position provided by Clay_SetPointerState is within the element with the provided ID's bounding box. @@ -3054,6 +3056,12 @@ void Clay__CalculateFinalLayout(void) { } } +CLAY_WASM_EXPORT("Clay_GetPointerData") +CLAY_DLL_EXPORT Clay_PointerData Clay_GetPointerData(void) { + Clay_Context* context = Clay_GetCurrentContext(); + return context->pointerInfo; +} + #pragma region DebugTools Clay_Color CLAY__DEBUGVIEW_COLOR_1 = {58, 56, 52, 255}; Clay_Color CLAY__DEBUGVIEW_COLOR_2 = {62, 60, 58, 255};