From a1b5cde9286579daa41775a990dad7fff1a4d8bb Mon Sep 17 00:00:00 2001 From: Nic Barker Date: Sat, 21 Dec 2024 06:04:21 +1300 Subject: [PATCH] reverse order of root traversal --- clay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clay.h b/clay.h index 8a275a9..bfedfe6 100644 --- a/clay.h +++ b/clay.h @@ -3520,7 +3520,7 @@ void Clay_SetPointerState(Clay_Vector2 position, bool isPointerDown) { Clay__pointerInfo.position = position; Clay__pointerOverIds.length = 0; Clay__int32_tArray dfsBuffer = Clay__layoutElementChildrenBuffer; - for (int rootIndex = 0; rootIndex < Clay__layoutElementTreeRoots.length; ++rootIndex) { + for (int rootIndex = Clay__layoutElementTreeRoots.length - 1; rootIndex >= 0; --rootIndex) { dfsBuffer.length = 0; Clay__LayoutElementTreeRoot *root = Clay__LayoutElementTreeRootArray_Get(&Clay__layoutElementTreeRoots, rootIndex); Clay__int32_tArray_Add(&dfsBuffer, (int32_t)root->layoutElementIndex);