Compare commits

..

No commits in common. "719fd5b1300534c66149db197595a5085e221e87" and "23f70e0477164bcde58d7c1b6645d0eeafad8e5d" have entirely different histories.

7 changed files with 6 additions and 8 deletions

View File

@ -269,7 +269,7 @@ TypedConfig :: struct {
id: ElementId, id: ElementId,
} }
ErrorType :: enum EnumBackingType { ErrorType :: enum {
TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED, TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED,
ARENA_CAPACITY_EXCEEDED, ARENA_CAPACITY_EXCEEDED,
ELEMENTS_CAPACITY_EXCEEDED, ELEMENTS_CAPACITY_EXCEEDED,

Binary file not shown.

Binary file not shown.

Binary file not shown.

12
clay.h
View File

@ -399,7 +399,7 @@ CLAY__TYPEDEF(Clay_Border, struct {
Clay_Color color; Clay_Color color;
}); });
struct Clay_BorderElementConfig { CLAY__TYPEDEF(Clay_BorderElementConfig, struct {
Clay_Border left; Clay_Border left;
Clay_Border right; Clay_Border right;
Clay_Border top; Clay_Border top;
@ -409,8 +409,7 @@ struct Clay_BorderElementConfig {
#ifdef CLAY_EXTEND_CONFIG_BORDER #ifdef CLAY_EXTEND_CONFIG_BORDER
CLAY_EXTEND_CONFIG_BORDER CLAY_EXTEND_CONFIG_BORDER
#endif #endif
}; });
CLAY__TYPEDEF(Clay_BorderElementConfig, struct Clay_BorderElementConfig);
CLAY__TYPEDEF(Clay_ElementConfigUnion, union { CLAY__TYPEDEF(Clay_ElementConfigUnion, union {
Clay_RectangleElementConfig *rectangleElementConfig; Clay_RectangleElementConfig *rectangleElementConfig;
@ -2804,8 +2803,7 @@ void Clay__CalculateFinalLayout() {
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) {
Clay_RectangleElementConfig *rectangleConfig = Clay__StoreRectangleElementConfig(CLAY__INIT(Clay_RectangleElementConfig) {.color = borderConfig->betweenChildren.color}); Clay_RectangleElementConfig *rectangleConfig = Clay__StoreRectangleElementConfig(CLAY__INIT(Clay_RectangleElementConfig) {.color = borderConfig->betweenChildren.color});
float halfGap = layoutConfig->childGap / 2; Clay_Vector2 borderOffset = { (float)layoutConfig->padding.x, (float)layoutConfig->padding.y };
Clay_Vector2 borderOffset = { (float)layoutConfig->padding.x - halfGap, (float)layoutConfig->padding.y - halfGap };
if (layoutConfig->layoutDirection == CLAY_LEFT_TO_RIGHT) { if (layoutConfig->layoutDirection == CLAY_LEFT_TO_RIGHT) {
for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) { for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) {
Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, currentElement->childrenOrTextContent.children.elements[i]); Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, currentElement->childrenOrTextContent.children.elements[i]);
@ -2817,7 +2815,7 @@ void Clay__CalculateFinalLayout() {
.commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE, .commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
}); });
} }
borderOffset.x += (childElement->dimensions.width + (float)layoutConfig->childGap); borderOffset.x += (childElement->dimensions.width + (float)layoutConfig->childGap / 2);
} }
} else { } else {
for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) { for (int32_t i = 0; i < currentElement->childrenOrTextContent.children.length; ++i) {
@ -2830,7 +2828,7 @@ void Clay__CalculateFinalLayout() {
.commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE, .commandType = CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
}); });
} }
borderOffset.y += (childElement->dimensions.height + (float)layoutConfig->childGap); borderOffset.y += (childElement->dimensions.height + (float)layoutConfig->childGap / 2);
} }
} }
} }