mirror of
https://github.com/nicbarker/clay.git
synced 2026-08-04 14:19:10 +00:00
Make sure exiting floating element does not increase the parent's size
This commit is contained in:
parent
4c2c778861
commit
451ea281f7
1 changed files with 5 additions and 3 deletions
8
clay.h
8
clay.h
|
|
@ -4472,7 +4472,9 @@ Clay_RenderCommandArray Clay_EndLayout(float deltaTime) {
|
|||
}
|
||||
|
||||
// Reattach the inserted subtree to its previous parent if it still exists
|
||||
if (parentHashMapItem->generation > context->generation) {
|
||||
// and the exiting element is not floating
|
||||
Clay_FloatingElementConfig* floatingConfig = &hashMapItem->layoutElement->config.floating;
|
||||
if (parentHashMapItem->generation > context->generation && floatingConfig->attachTo == CLAY_ATTACH_TO_NONE) {
|
||||
Clay_LayoutElement *parentElement = parentHashMapItem->layoutElement;
|
||||
int32_t newChildrenStartIndex = context->layoutElementChildren.length;
|
||||
bool found = false;
|
||||
|
|
@ -4496,8 +4498,8 @@ Clay_RenderCommandArray Clay_EndLayout(float deltaTime) {
|
|||
} else {
|
||||
Clay__LayoutElementTreeRootArray_Add(&context->layoutElementTreeRoots, CLAY__INIT(Clay__LayoutElementTreeRoot) {
|
||||
.layoutElementIndex = (int32_t)(data->elementThisFrame - context->layoutElements.internalArray),
|
||||
.parentId = Clay__HashString(CLAY_STRING("Clay__RootContainer"), 0).id,
|
||||
.zIndex = 1,
|
||||
.parentId = floatingConfig->attachTo != CLAY_ATTACH_TO_NONE ? floatingConfig->parentId : Clay__HashString(CLAY_STRING("Clay__RootContainer"), 0).id,
|
||||
.zIndex = floatingConfig->attachTo != CLAY_ATTACH_TO_NONE ? floatingConfig->zIndex : 1,
|
||||
});
|
||||
}
|
||||
// Parent exited, just delete child without exit transition
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue