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);