fix dropdown sizing

This commit is contained in:
2026-03-03 10:37:59 -05:00
parent 9bf5131d27
commit cde77e6ae6

View File

@@ -683,16 +683,26 @@ B32 ui_dropdown(const char *id, const char **options, S32 count, S32 *selected)
}
}
// Draw dropdown list if open
// Draw dropdown list if open (floating so it escapes modal/container clipping)
if (is_open) {
Clay_ElementId list_id = WIDI(id, 502);
float header_width = Clay_GetElementData(eid).boundingBox.width;
CLAY(list_id,
.layout = {
.sizing = { .width = CLAY_SIZING_GROW(), .height = CLAY_SIZING_FIT() },
.sizing = { .width = CLAY_SIZING_FIT(.min = header_width), .height = CLAY_SIZING_FIT() },
.layoutDirection = CLAY_TOP_TO_BOTTOM,
},
.backgroundColor = g_theme.bg_dark,
.border = { .color = g_theme.border, .width = { 1, 1, 1, 1 } }
.border = { .color = g_theme.border, .width = { 1, 1, 1, 1 } },
.floating = {
.parentId = eid.id,
.zIndex = 2000,
.attachPoints = {
.element = CLAY_ATTACH_POINT_LEFT_TOP,
.parent = CLAY_ATTACH_POINT_LEFT_BOTTOM,
},
.attachTo = CLAY_ATTACH_TO_ELEMENT_WITH_ID,
}
) {
for (S32 i = 0; i < count; i++) {
B32 is_item_selected = (*selected == i);