Compare commits

...

5 Commits

Author SHA1 Message Date
Cory
40ca3a379b
Merge e9d3125807 into 9b2d585499 2025-01-21 11:16:16 +05:00
Nic Barker
9b2d585499 Update odin and wasm bindings 2025-01-21 19:14:22 +13:00
Nic Barker
81589ad29b [Core] Fix layout bug in SIZING_PERCENT 2025-01-21 19:11:33 +13:00
Nic Barker
16f894bb4d Fix incorrect use of corner radius 2025-01-21 18:32:33 +13:00
Timothy Hoyt
9f07f5aac8
fixed video demo padding (#205) 2025-01-21 18:31:48 +13:00
8 changed files with 8 additions and 17 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

9
clay.h
View File

@ -2257,12 +2257,6 @@ void Clay__SizeContainersAlongAxis(bool xAxis) {
*childSize = (parentSize - totalPaddingAndChildGaps) * childSizing.size.percent; *childSize = (parentSize - totalPaddingAndChildGaps) * childSizing.size.percent;
if (sizingAlongAxis) { if (sizingAlongAxis) {
innerContentSize += *childSize; innerContentSize += *childSize;
if (childOffset > 0) {
innerContentSize += parentChildGap; // For children after index 0, the childAxisOffset is the gap from the previous child
totalPaddingAndChildGaps += parentChildGap;
}
} else {
innerContentSize = CLAY__MAX(*childSize, innerContentSize);
} }
} }
} }
@ -2483,9 +2477,6 @@ void Clay__CalculateFinalLayout() {
// DFS node has been visited, this is on the way back up to the root // DFS node has been visited, this is on the way back up to the root
Clay_LayoutConfig *layoutConfig = currentElement->layoutConfig; Clay_LayoutConfig *layoutConfig = currentElement->layoutConfig;
if (layoutConfig->sizing.height.type == CLAY__SIZING_TYPE_PERCENT) {
continue;
}
if (layoutConfig->layoutDirection == CLAY_LEFT_TO_RIGHT) { if (layoutConfig->layoutDirection == CLAY_LEFT_TO_RIGHT) {
// Resize any parent containers that have grown in height along their non layout axis // Resize any parent containers that have grown in height along their non layout axis
for (int32_t j = 0; j < currentElement->childrenOrTextContent.children.length; ++j) { for (int32_t j = 0; j < currentElement->childrenOrTextContent.children.length; ++j) {

View File

@ -117,7 +117,7 @@ int main(void) {
Clay_RectangleElementConfig contentBackgroundConfig = { Clay_RectangleElementConfig contentBackgroundConfig = {
.color = { 90, 90, 90, 255 }, .color = { 90, 90, 90, 255 },
.cornerRadius = 8 .cornerRadius = CLAY_CORNER_RADIUS(8)
}; };
Clay_BeginLayout(); Clay_BeginLayout();
@ -141,7 +141,7 @@ int main(void) {
.height = CLAY_SIZING_FIXED(60), .height = CLAY_SIZING_FIXED(60),
.width = CLAY_SIZING_GROW(0) .width = CLAY_SIZING_GROW(0)
}, },
.padding = { 16 }, .padding = { 16, 16, 0, 0 },
.childGap = 16, .childGap = 16,
.childAlignment = { .childAlignment = {
.y = CLAY_ALIGN_Y_CENTER .y = CLAY_ALIGN_Y_CENTER
@ -151,10 +151,10 @@ int main(void) {
// Header buttons go here // Header buttons go here
CLAY( CLAY(
CLAY_ID("FileButton"), CLAY_ID("FileButton"),
CLAY_LAYOUT({ .padding = { 16, 8 }}), CLAY_LAYOUT({ .padding = { 16, 16, 8, 8 }}),
CLAY_RECTANGLE({ CLAY_RECTANGLE({
.color = { 140, 140, 140, 255 }, .color = { 140, 140, 140, 255 },
.cornerRadius = 5 .cornerRadius = CLAY_CORNER_RADIUS(5)
}) })
) { ) {
CLAY_TEXT(CLAY_STRING("File"), CLAY_TEXT_CONFIG({ CLAY_TEXT(CLAY_STRING("File"), CLAY_TEXT_CONFIG({
@ -177,7 +177,7 @@ int main(void) {
}, },
}), }),
CLAY_LAYOUT({ CLAY_LAYOUT({
.padding = {0, 8 } .padding = {0, 0, 8, 8 }
}) })
) { ) {
CLAY( CLAY(
@ -189,7 +189,7 @@ int main(void) {
}), }),
CLAY_RECTANGLE({ CLAY_RECTANGLE({
.color = { 40, 40, 40, 255 }, .color = { 40, 40, 40, 255 },
.cornerRadius = 8 .cornerRadius = CLAY_CORNER_RADIUS(8)
}) })
) { ) {
// Render dropdown items here // Render dropdown items here
@ -236,7 +236,7 @@ int main(void) {
CLAY_LAYOUT(sidebarButtonLayout), CLAY_LAYOUT(sidebarButtonLayout),
CLAY_RECTANGLE({ CLAY_RECTANGLE({
.color = { 120, 120, 120, 255 }, .color = { 120, 120, 120, 255 },
.cornerRadius = 8, .cornerRadius = CLAY_CORNER_RADIUS(8),
}) })
) { ) {
CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({ CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({
@ -252,7 +252,7 @@ int main(void) {
Clay_Hovered() Clay_Hovered()
? CLAY_RECTANGLE({ ? CLAY_RECTANGLE({
.color = { 120, 120, 120, 120 }, .color = { 120, 120, 120, 120 },
.cornerRadius = 8 .cornerRadius = CLAY_CORNER_RADIUS(8)
}) })
: 0 : 0
) { ) {