Fix a bug with borders that could cause duplicate IDs

This commit is contained in:
Nic Barker 2024-12-12 10:31:41 +13:00
parent d2e6be64a9
commit ff3b69d94f

4
clay.h
View File

@ -2683,10 +2683,10 @@ void Clay__CalculateFinalLayout() {
Clay_BoundingBox currentElementBoundingBox = currentElementData->boundingBox; Clay_BoundingBox currentElementBoundingBox = currentElementData->boundingBox;
Clay_BorderElementConfig *borderConfig = Clay__FindElementConfigWithType(currentElement, CLAY__ELEMENT_CONFIG_TYPE_BORDER_CONTAINER).borderElementConfig; Clay_BorderElementConfig *borderConfig = Clay__FindElementConfigWithType(currentElement, CLAY__ELEMENT_CONFIG_TYPE_BORDER_CONTAINER).borderElementConfig;
Clay_RenderCommand renderCommand = CLAY__INIT(Clay_RenderCommand) { Clay_RenderCommand renderCommand = CLAY__INIT(Clay_RenderCommand) {
.commandType = CLAY_RENDER_COMMAND_TYPE_BORDER,
.boundingBox = currentElementBoundingBox, .boundingBox = currentElementBoundingBox,
.config = { .borderElementConfig = borderConfig }, .config = { .borderElementConfig = borderConfig },
.id = currentElement->id, .id = Clay__RehashWithNumber(currentElement->id, 4),
.commandType = CLAY_RENDER_COMMAND_TYPE_BORDER,
}; };
Clay__AddRenderCommand(renderCommand); Clay__AddRenderCommand(renderCommand);
if (borderConfig->betweenChildren.width > 0 && borderConfig->betweenChildren.color.a > 0) { if (borderConfig->betweenChildren.width > 0 && borderConfig->betweenChildren.color.a > 0) {