Skip to content

Commit 60a7fbd

Browse files
authored
Merge branch 'nicbarker:main' into main
2 parents 6e379a7 + 588b931 commit 60a7fbd

File tree

8 files changed

+156
-135
lines changed

8 files changed

+156
-135
lines changed

README.md

Lines changed: 144 additions & 131 deletions
Large diffs are not rendered by default.
32 Bytes
Binary file not shown.
40 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.
748 Bytes
Binary file not shown.
48 Bytes
Binary file not shown.

clay.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ typedef struct {
11461146
Clay_LayoutConfig *layoutConfig;
11471147
Clay__ElementConfigArraySlice elementConfigs;
11481148
uint32_t id;
1149+
uint16_t floatingChildrenCount;
11491150
} Clay_LayoutElement;
11501151

11511152
CLAY__ARRAY_DEFINE(Clay_LayoutElement, Clay_LayoutElementArray)
@@ -1776,7 +1777,8 @@ Clay_LayoutElementHashMapItem *Clay__GetHashMapItem(uint32_t id) {
17761777
Clay_ElementId Clay__GenerateIdForAnonymousElement(Clay_LayoutElement *openLayoutElement) {
17771778
Clay_Context* context = Clay_GetCurrentContext();
17781779
Clay_LayoutElement *parentElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 2));
1779-
Clay_ElementId elementId = Clay__HashNumber(parentElement->childrenOrTextContent.children.length, parentElement->id);
1780+
uint32_t offset = parentElement->childrenOrTextContent.children.length + parentElement->floatingChildrenCount;
1781+
Clay_ElementId elementId = Clay__HashNumber(offset, parentElement->id);
17801782
openLayoutElement->id = elementId.id;
17811783
Clay__AddHashMapItem(elementId, openLayoutElement);
17821784
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
@@ -1917,9 +1919,15 @@ void Clay__CloseElement(void) {
19171919

19181920
// Close the currently open element
19191921
int32_t closingElementIndex = Clay__int32_tArray_RemoveSwapback(&context->openLayoutElementStack, (int)context->openLayoutElementStack.length - 1);
1922+
1923+
// Get the currently open parent
19201924
openLayoutElement = Clay__GetOpenLayoutElement();
19211925

1922-
if (!elementIsFloating && context->openLayoutElementStack.length > 1) {
1926+
if (context->openLayoutElementStack.length > 1) {
1927+
if(elementIsFloating) {
1928+
openLayoutElement->floatingChildrenCount++;
1929+
return;
1930+
}
19231931
openLayoutElement->childrenOrTextContent.children.length++;
19241932
Clay__int32_tArray_Add(&context->layoutElementChildrenBuffer, closingElementIndex);
19251933
}

examples/termbox2-image-demo/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set(FETCHCONTENT_QUIET FALSE)
1010
FetchContent_Declare(
1111
termbox2
1212
GIT_REPOSITORY "https://github.com/termbox/termbox2.git"
13-
GIT_TAG "9c9281a9a4c971a2be57f8645e828ec99fd555e8"
13+
GIT_TAG "ffd159c2a6106dd5eef338a6702ad15d4d4aa809"
1414
GIT_PROGRESS TRUE
1515
GIT_SHALLOW TRUE
1616
)
@@ -19,7 +19,7 @@ FetchContent_MakeAvailable(termbox2)
1919
FetchContent_Declare(
2020
stb
2121
GIT_REPOSITORY "https://github.com/nothings/stb.git"
22-
GIT_TAG "f58f558c120e9b32c217290b80bad1a0729fbb2c"
22+
GIT_TAG "fede005abaf93d9d7f3a679d1999b2db341b360f"
2323
GIT_PROGRESS TRUE
2424
GIT_SHALLOW TRUE
2525
)

0 commit comments

Comments
 (0)