mirror of
https://github.com/nicbarker/clay.git
synced 2025-05-12 05:18:03 +00:00
Compare commits
5 Commits
14083db747
...
40ca3a379b
Author | SHA1 | Date | |
---|---|---|---|
|
40ca3a379b | ||
|
9b2d585499 | ||
|
81589ad29b | ||
|
16f894bb4d | ||
|
9f07f5aac8 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9
clay.h
9
clay.h
@ -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) {
|
||||||
|
Binary file not shown.
@ -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
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user