mirror of
https://github.com/nicbarker/clay.git
synced 2026-07-26 12:58:36 +00:00
re-add max element exceeded warning for debug view
This commit is contained in:
parent
0df6ad3e2f
commit
5d0649efc2
1 changed files with 23 additions and 3 deletions
26
clay.h
26
clay.h
|
|
@ -4627,8 +4627,18 @@ Clay_RenderCommandArray Clay_EndLayout(float deltaTime) {
|
|||
context->warningsEnabled = true;
|
||||
}
|
||||
|
||||
Clay__CalculateFinalLayout(deltaTime, true, true);
|
||||
Clay__CloneElementsWithExitTransition();
|
||||
if (context->booleanWarnings.maxElementsExceeded) {
|
||||
Clay_String message;
|
||||
message = CLAY_STRING("Clay Error: Debug view caused layout element count to exceed Clay__maxElementCount");
|
||||
Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand ) {
|
||||
.boundingBox = { context->layoutDimensions.width / 2 - 59 * 4, context->layoutDimensions.height / 2, 0, 0 },
|
||||
.renderData = { .text = { .stringContents = CLAY__INIT(Clay_StringSlice) { .length = message.length, .chars = message.chars, .baseChars = message.chars }, .textColor = {255, 0, 0, 255}, .fontSize = 16 } },
|
||||
.commandType = CLAY_RENDER_COMMAND_TYPE_TEXT
|
||||
});
|
||||
} else {
|
||||
Clay__CalculateFinalLayout(deltaTime, true, true);
|
||||
Clay__CloneElementsWithExitTransition();
|
||||
}
|
||||
} else {
|
||||
if (context->debugModeEnabled) {
|
||||
context->warningsEnabled = false;
|
||||
|
|
@ -4636,7 +4646,17 @@ Clay_RenderCommandArray Clay_EndLayout(float deltaTime) {
|
|||
context->warningsEnabled = true;
|
||||
}
|
||||
|
||||
Clay__CalculateFinalLayout(deltaTime, false, true);
|
||||
if (context->booleanWarnings.maxElementsExceeded) {
|
||||
Clay_String message;
|
||||
message = CLAY_STRING("Clay Error: Debug view caused layout element count to exceed Clay__maxElementCount");
|
||||
Clay__AddRenderCommand(CLAY__INIT(Clay_RenderCommand ) {
|
||||
.boundingBox = { context->layoutDimensions.width / 2 - 59 * 4, context->layoutDimensions.height / 2, 0, 0 },
|
||||
.renderData = { .text = { .stringContents = CLAY__INIT(Clay_StringSlice) { .length = message.length, .chars = message.chars, .baseChars = message.chars }, .textColor = {255, 0, 0, 255}, .fontSize = 16 } },
|
||||
.commandType = CLAY_RENDER_COMMAND_TYPE_TEXT
|
||||
});
|
||||
} else {
|
||||
Clay__CalculateFinalLayout(deltaTime, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (context->openLayoutElementStack.length > 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue