Skip to content

Commit de6cd6e

Browse files
committed
fix(layout): emit Custom command before children, not after
Custom render commands were appended after the children loop (alongside Border), so an element with a CUSTOM background config painted over its own children — opaque custom-fill parents (e.g. UO gump-sprite windows) hid every nested label/text. Move the Custom command up to sit with Rectangle/Image (backgrounds drawn behind children). Border stays after children so it still frames them on top. Leaf custom elements are unaffected (no children).
1 parent 4664b52 commit de6cd6e

1 file changed

Lines changed: 25 additions & 21 deletions

File tree

src/Clay/Core/ClayContext.cs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,30 @@ private void GenerateRenderCommandsRecursive(int elementIndex, short zIndex, Bou
13001300
});
13011301
}
13021302

1303+
// Custom (a background fill, e.g. a UO gump sprite) — emitted with the
1304+
// other backgrounds BEFORE children so the element's own fill paints
1305+
// behind its children/text. (Border stays after children below, so it
1306+
// frames them on top.) Previously custom was emitted at the end, which
1307+
// painted an opaque gump bg over its own labels — blank rows.
1308+
int customIndex = FindConfigIndex(ref element, ElementConfigType.Custom);
1309+
if (customIndex >= 0)
1310+
{
1311+
ref var customConfig = ref CustomElementConfigs[customIndex];
1312+
RenderCommands.Add(new RenderCommand
1313+
{
1314+
BoundingBox = boundingBox,
1315+
CommandType = RenderCommandType.Custom,
1316+
Id = element.Id,
1317+
ZIndex = zIndex,
1318+
Custom = new CustomRenderData
1319+
{
1320+
CustomData = customConfig.CustomData,
1321+
BackgroundColor = sharedConfig.BackgroundColor,
1322+
CornerRadius = sharedConfig.CornerRadius
1323+
}
1324+
});
1325+
}
1326+
13031327
// Scissor start (for scroll containers or ClipContent elements)
13041328
bool needsScissor = scrollIndex >= 0 ||
13051329
LayoutConfigs[element.LayoutConfigIndex].ClipContent;
@@ -1402,7 +1426,7 @@ private void GenerateRenderCommandsRecursive(int elementIndex, short zIndex, Bou
14021426
});
14031427
}
14041428

1405-
// Border
1429+
// Border — emitted after children so it frames them on top.
14061430
int borderIndex = FindConfigIndex(ref element, ElementConfigType.Border);
14071431
if (borderIndex >= 0)
14081432
{
@@ -1424,26 +1448,6 @@ private void GenerateRenderCommandsRecursive(int elementIndex, short zIndex, Bou
14241448
});
14251449
}
14261450
}
1427-
1428-
// Custom
1429-
int customIndex = FindConfigIndex(ref element, ElementConfigType.Custom);
1430-
if (customIndex >= 0)
1431-
{
1432-
ref var customConfig = ref CustomElementConfigs[customIndex];
1433-
RenderCommands.Add(new RenderCommand
1434-
{
1435-
BoundingBox = boundingBox,
1436-
CommandType = RenderCommandType.Custom,
1437-
Id = element.Id,
1438-
ZIndex = zIndex,
1439-
Custom = new CustomRenderData
1440-
{
1441-
CustomData = customConfig.CustomData,
1442-
BackgroundColor = sharedConfig.BackgroundColor,
1443-
CornerRadius = sharedConfig.CornerRadius
1444-
}
1445-
});
1446-
}
14471451
}
14481452

14491453
public void SetPointerState(Vector2 position, bool pressed)

0 commit comments

Comments
 (0)