reverse order of root traversal

This commit is contained in:
Nic Barker 2024-12-21 06:04:21 +13:00
parent 418579e376
commit a1b5cde928

2
clay.h
View File

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