mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-16 19:28:06 +00:00
[Core] Update debug view for new non rectangle API
This commit is contained in:
parent
0468243ac7
commit
bd2ce4b833
28
clay.h
28
clay.h
@ -2212,10 +2212,10 @@ void Clay__CalculateFinalLayout(void) {
|
|||||||
sortMax--;
|
sortMax--;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool emitRectangle;
|
bool emitRectangle = false;
|
||||||
// Create the render commands for this element
|
// Create the render commands for this element
|
||||||
Clay_SharedElementConfig *sharedConfig = Clay__FindElementConfigWithType(currentElement, CLAY__ELEMENT_CONFIG_TYPE_SHARED).sharedElementConfig;
|
Clay_SharedElementConfig *sharedConfig = Clay__FindElementConfigWithType(currentElement, CLAY__ELEMENT_CONFIG_TYPE_SHARED).sharedElementConfig;
|
||||||
if (sharedConfig) {
|
if (sharedConfig && sharedConfig->backgroundColor.a > 0) {
|
||||||
emitRectangle = true;
|
emitRectangle = true;
|
||||||
}
|
}
|
||||||
else if (!sharedConfig) {
|
else if (!sharedConfig) {
|
||||||
@ -2248,7 +2248,7 @@ void Clay__CalculateFinalLayout(void) {
|
|||||||
renderCommand.commandType = CLAY_RENDER_COMMAND_TYPE_IMAGE;
|
renderCommand.commandType = CLAY_RENDER_COMMAND_TYPE_IMAGE;
|
||||||
renderCommand.renderData = CLAY__INIT(Clay_RenderData) {
|
renderCommand.renderData = CLAY__INIT(Clay_RenderData) {
|
||||||
.image = {
|
.image = {
|
||||||
.backgroundColor = emitRectangle ? sharedConfig->backgroundColor : CLAY__INIT(Clay_Color) { 255, 255, 255, 255 },
|
.backgroundColor = sharedConfig->backgroundColor,
|
||||||
.cornerRadius = sharedConfig->cornerRadius,
|
.cornerRadius = sharedConfig->cornerRadius,
|
||||||
.sourceDimensions = elementConfig->config.imageElementConfig->sourceDimensions,
|
.sourceDimensions = elementConfig->config.imageElementConfig->sourceDimensions,
|
||||||
.imageData = elementConfig->config.imageElementConfig->imageData,
|
.imageData = elementConfig->config.imageElementConfig->imageData,
|
||||||
@ -2647,6 +2647,23 @@ Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialR
|
|||||||
}
|
}
|
||||||
for (int32_t elementConfigIndex = 0; elementConfigIndex < currentElement->elementConfigs.length; ++elementConfigIndex) {
|
for (int32_t elementConfigIndex = 0; elementConfigIndex < currentElement->elementConfigs.length; ++elementConfigIndex) {
|
||||||
Clay_ElementConfig *elementConfig = Clay__ElementConfigArraySlice_Get(¤tElement->elementConfigs, elementConfigIndex);
|
Clay_ElementConfig *elementConfig = Clay__ElementConfigArraySlice_Get(¤tElement->elementConfigs, elementConfigIndex);
|
||||||
|
if (elementConfig->type == CLAY__ELEMENT_CONFIG_TYPE_SHARED) {
|
||||||
|
Clay_Color labelColor = {243,134,48,90};
|
||||||
|
labelColor.a = 90;
|
||||||
|
Clay_Color backgroundColor = elementConfig->config.sharedElementConfig->backgroundColor;
|
||||||
|
Clay_CornerRadius radius = elementConfig->config.sharedElementConfig->cornerRadius;
|
||||||
|
if (backgroundColor.a > 0) {
|
||||||
|
CLAY({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = labelColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = labelColor, .width = { 1, 1, 1, 1 } } }) {
|
||||||
|
CLAY_TEXT(CLAY_STRING("Color"), CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (radius.bottomLeft > 0) {
|
||||||
|
CLAY({ .layout = { .padding = { 8, 8, 2, 2 } }, .backgroundColor = labelColor, .cornerRadius = CLAY_CORNER_RADIUS(4), .border = { .color = labelColor, .width = { 1, 1, 1, 1 } } }) {
|
||||||
|
CLAY_TEXT(CLAY_STRING("Radius"), CLAY_TEXT_CONFIG({ .textColor = offscreen ? CLAY__DEBUGVIEW_COLOR_3 : CLAY__DEBUGVIEW_COLOR_4, .fontSize = 16 }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Clay__DebugElementConfigTypeLabelConfig config = Clay__DebugGetElementConfigTypeLabel(elementConfig->type);
|
Clay__DebugElementConfigTypeLabelConfig config = Clay__DebugGetElementConfigTypeLabel(elementConfig->type);
|
||||||
Clay_Color backgroundColor = config.color;
|
Clay_Color backgroundColor = config.color;
|
||||||
backgroundColor.a = 90;
|
backgroundColor.a = 90;
|
||||||
@ -2964,8 +2981,11 @@ void Clay__RenderDebugView(void) {
|
|||||||
case CLAY__ELEMENT_CONFIG_TYPE_SHARED: {
|
case CLAY__ELEMENT_CONFIG_TYPE_SHARED: {
|
||||||
Clay_SharedElementConfig *sharedConfig = elementConfig->config.sharedElementConfig;
|
Clay_SharedElementConfig *sharedConfig = elementConfig->config.sharedElementConfig;
|
||||||
CLAY({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
CLAY({ .layout = { .padding = attributeConfigPadding, .childGap = 8, .layoutDirection = CLAY_TOP_TO_BOTTOM }}) {
|
||||||
|
// .backgroundColor
|
||||||
|
CLAY_TEXT(CLAY_STRING("Background Color"), infoTitleConfig);
|
||||||
|
Clay__RenderDebugViewColor(sharedConfig->backgroundColor, infoTextConfig);
|
||||||
// .cornerRadius
|
// .cornerRadius
|
||||||
CLAY_TEXT(CLAY_STRING("Color"), infoTitleConfig);
|
CLAY_TEXT(CLAY_STRING("Corner Radius"), infoTitleConfig);
|
||||||
Clay__RenderDebugViewCornerRadius(sharedConfig->cornerRadius, infoTextConfig);
|
Clay__RenderDebugViewCornerRadius(sharedConfig->cornerRadius, infoTextConfig);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user