MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / Clay__RenderDebugLayoutElementsList

Function Clay__RenderDebugLayoutElementsList

include/clay.h:3261–3443  ·  view source on GitHub ↗

Returns row count

Source from the content-addressed store, hash-verified

3259
3260// Returns row count
3261Clay__RenderDebugLayoutData Clay__RenderDebugLayoutElementsList(int32_t initialRootsLength, int32_t highlightedRowIndex) {
3262 Clay_Context* context = Clay_GetCurrentContext();
3263 Clay__int32_tArray dfsBuffer = context->reusableElementIndexBuffer;
3264 Clay__DebugView_ScrollViewItemLayoutConfig = CLAY__INIT(Clay_LayoutConfig) { .sizing = { .height = CLAY_SIZING_FIXED(CLAY__DEBUGVIEW_ROW_HEIGHT) }, .childGap = 6, .childAlignment = { .y = CLAY_ALIGN_Y_CENTER }};
3265 Clay__RenderDebugLayoutData layoutData = CLAY__DEFAULT_STRUCT;
3266
3267 uint32_t highlightedElementId = 0;
3268
3269 for (int32_t rootIndex = 0; rootIndex < initialRootsLength; ++rootIndex) {
3270 dfsBuffer.length = 0;
3271 Clay__LayoutElementTreeRoot *root = Clay__LayoutElementTreeRootArray_Get(&context->layoutElementTreeRoots, rootIndex);
3272 Clay__int32_tArray_Add(&dfsBuffer, (int32_t)root->layoutElementIndex);
3273 context->treeNodeVisited.internalArray[0] = false;
3274 if (rootIndex > 0) {
3275 CLAY(CLAY_IDI("Clay__DebugView_EmptyRowOuter", rootIndex), { .layout = { .sizing = {.width = CLAY_SIZING_GROW(0)}, .padding = {CLAY__DEBUGVIEW_INDENT_WIDTH / 2, 0, 0, 0} } }) {
3276 CLAY(CLAY_IDI("Clay__DebugView_EmptyRow", rootIndex), { .layout = { .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED((float)CLAY__DEBUGVIEW_ROW_HEIGHT) }}, .border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = { .top = 1 } } }) {}
3277 }
3278 layoutData.rowCount++;
3279 }
3280 while (dfsBuffer.length > 0) {
3281 int32_t currentElementIndex = Clay__int32_tArray_GetValue(&dfsBuffer, (int)dfsBuffer.length - 1);
3282 Clay_LayoutElement *currentElement = Clay_LayoutElementArray_Get(&context->layoutElements, (int)currentElementIndex);
3283 if (context->treeNodeVisited.internalArray[dfsBuffer.length - 1]) {
3284 if (!currentElement->isTextElement && currentElement->children.length > 0) {
3285 Clay__CloseElement();
3286 Clay__CloseElement();
3287 Clay__CloseElement();
3288 }
3289 dfsBuffer.length--;
3290 continue;
3291 }
3292
3293 if (currentElement->exiting) { // TODO there is a duplicate ID problem with exiting elements
3294 dfsBuffer.length--;
3295 continue;
3296 }
3297
3298 if (highlightedRowIndex == layoutData.rowCount) {
3299 if (context->pointerInfo.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) {
3300 context->debugSelectedElementId = currentElement->id;
3301 }
3302 highlightedElementId = currentElement->id;
3303 }
3304
3305 context->treeNodeVisited.internalArray[dfsBuffer.length - 1] = true;
3306 Clay_LayoutElementHashMapItem *currentElementData = Clay__GetHashMapItem(currentElement->id);
3307 bool offscreen = Clay__ElementIsOffscreen(&currentElementData->boundingBox);
3308 if (context->debugSelectedElementId == currentElement->id) {
3309 layoutData.selectedElementRowIndex = layoutData.rowCount;
3310 }
3311 CLAY(CLAY_IDI("Clay__DebugView_ElementOuter", currentElement->id), { .layout = Clay__DebugView_ScrollViewItemLayoutConfig }) {
3312 // Collapse icon / button
3313 if (!(currentElement->isTextElement || currentElement->children.length == 0)) {
3314 CLAY(CLAY_IDI("Clay__DebugView_CollapseElement", currentElement->id), {
3315 .layout = { .sizing = {CLAY_SIZING_FIXED(16), CLAY_SIZING_FIXED(16)}, .childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER} },
3316 .cornerRadius = CLAY_CORNER_RADIUS(4),
3317 .border = { .color = CLAY__DEBUGVIEW_COLOR_3, .width = {1, 1, 1, 1, 0} },
3318 }) {

Callers 1

Clay__RenderDebugViewFunction · 0.85

Calls 11

Clay_GetCurrentContextFunction · 0.85
Clay__CloseElementFunction · 0.85
Clay__GetHashMapItemFunction · 0.85
Clay__ElementIsOffscreenFunction · 0.85
CLAY_AUTO_IDFunction · 0.85
Clay__MemCmpFunction · 0.85
Clay__BorderHasAnyWidthFunction · 0.85
Clay__OpenElementFunction · 0.85
Clay__HashStringFunction · 0.85

Tested by

no test coverage detected