From 0c154c14cc81eb307530558dd2186e8dfff27ec4 Mon Sep 17 00:00:00 2001 From: tri777ki Date: Thu, 26 Mar 2026 14:12:45 +0300 Subject: [PATCH] Fix pointer press visibility in hover callbacks --- clay.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/clay.h b/clay.h index 80d8393..863fe5c 100644 --- a/clay.h +++ b/clay.h @@ -3974,6 +3974,19 @@ void Clay_SetPointerState(Clay_Vector2 position, bool isPointerDown) { } context->pointerInfo.position = position; context->pointerOverIds.length = 0; + if (isPointerDown) { + if (context->pointerInfo.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { + context->pointerInfo.state = CLAY_POINTER_DATA_PRESSED; + } else if (context->pointerInfo.state != CLAY_POINTER_DATA_PRESSED) { + context->pointerInfo.state = CLAY_POINTER_DATA_PRESSED_THIS_FRAME; + } + } else { + if (context->pointerInfo.state == CLAY_POINTER_DATA_RELEASED_THIS_FRAME) { + context->pointerInfo.state = CLAY_POINTER_DATA_RELEASED; + } else if (context->pointerInfo.state != CLAY_POINTER_DATA_RELEASED) { + context->pointerInfo.state = CLAY_POINTER_DATA_RELEASED_THIS_FRAME; + } + } Clay__int32_tArray dfsBuffer = context->layoutElementChildrenBuffer; for (int32_t rootIndex = context->layoutElementTreeRoots.length - 1; rootIndex >= 0; --rootIndex) { dfsBuffer.length = 0; @@ -4022,19 +4035,6 @@ void Clay_SetPointerState(Clay_Vector2 position, bool isPointerDown) { } } - if (isPointerDown) { - if (context->pointerInfo.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { - context->pointerInfo.state = CLAY_POINTER_DATA_PRESSED; - } else if (context->pointerInfo.state != CLAY_POINTER_DATA_PRESSED) { - context->pointerInfo.state = CLAY_POINTER_DATA_PRESSED_THIS_FRAME; - } - } else { - if (context->pointerInfo.state == CLAY_POINTER_DATA_RELEASED_THIS_FRAME) { - context->pointerInfo.state = CLAY_POINTER_DATA_RELEASED; - } else if (context->pointerInfo.state != CLAY_POINTER_DATA_RELEASED) { - context->pointerInfo.state = CLAY_POINTER_DATA_RELEASED_THIS_FRAME; - } - } } CLAY_WASM_EXPORT("Clay_Initialize")