Update new_editor inspector layout and host rendering

This commit is contained in:
2026-04-21 13:24:03 +08:00
parent d388c3994b
commit 5d81a64ef3
62 changed files with 4417 additions and 151 deletions

View File

@@ -31,8 +31,6 @@ const UIEditorInspectorFieldStyleTokens& GetUIEditorInspectorFieldStyleTokens()
tokens.controlReadOnlyColor = ::XCEngine::UI::UIColor(0.10f, 0.10f, 0.10f, 1.0f);
tokens.controlBorderColor = ::XCEngine::UI::UIColor(0.15f, 0.15f, 0.15f, 1.0f);
tokens.controlFocusedBorderColor = ::XCEngine::UI::UIColor(0.19f, 0.19f, 0.19f, 1.0f);
tokens.prefixColor = ::XCEngine::UI::UIColor(0.13f, 0.13f, 0.13f, 1.0f);
tokens.prefixBorderColor = ::XCEngine::UI::UIColor(0.15f, 0.15f, 0.15f, 1.0f);
tokens.popupColor = ::XCEngine::UI::UIColor(0.10f, 0.10f, 0.10f, 1.0f);
tokens.popupBorderColor = ::XCEngine::UI::UIColor(0.15f, 0.15f, 0.15f, 1.0f);
tokens.popupHeaderColor = ::XCEngine::UI::UIColor(0.11f, 0.11f, 0.11f, 1.0f);
@@ -74,26 +72,37 @@ UIEditorFieldRowLayout BuildUIEditorFieldRowLayout(
const float rowHeight = bounds.height > 0.0f ? bounds.height : metrics.rowHeight;
const ::XCEngine::UI::UIRect rowBounds(bounds.x, bounds.y, bounds.width, rowHeight);
const float resolvedMinimumControlWidth =
ClampNonNegative((std::min)(minimumControlWidth, rowBounds.width));
const float preferredControlX = rowBounds.x + metrics.controlColumnStart;
const float maximumControlX =
rowBounds.x + rowBounds.width - metrics.controlTrailingInset - resolvedMinimumControlWidth;
const float horizontalPadding = ClampNonNegative(metrics.horizontalPadding);
const float trailingInset = ClampNonNegative(metrics.controlTrailingInset);
const float defaultGap = ClampNonNegative(metrics.labelControlGap);
const float contentLeft = rowBounds.x + horizontalPadding;
const float contentRight =
rowBounds.x + ClampNonNegative(rowBounds.width) - trailingInset;
const float contentWidth = ClampNonNegative(contentRight - contentLeft);
const float requestedReservedControlWidth = ClampNonNegative(
metrics.sharedControlColumnMinWidth > 0.0f
? metrics.sharedControlColumnMinWidth
: minimumControlWidth);
const float reservedControlWidth =
ClampNonNegative((std::min)(requestedReservedControlWidth, contentWidth));
const float effectiveGap =
(std::min)(defaultGap, ClampNonNegative(contentWidth - reservedControlWidth));
const float preferredControlX =
(std::clamp)(rowBounds.x + metrics.controlColumnStart, contentLeft, contentRight);
const float maximumControlX = contentRight - reservedControlWidth;
const float controlX =
(std::clamp)(
(std::min)(preferredControlX, maximumControlX),
rowBounds.x,
rowBounds.x + rowBounds.width - metrics.controlTrailingInset);
(std::clamp)((std::min)(preferredControlX, maximumControlX), contentLeft, contentRight);
const float controlInsetY = (std::min)(metrics.controlInsetY, rowBounds.height * 0.25f);
const float controlWidth =
ClampNonNegative(rowBounds.x + rowBounds.width - metrics.controlTrailingInset - controlX);
ClampNonNegative(contentRight - controlX);
UIEditorFieldRowLayout layout = {};
layout.bounds = rowBounds;
layout.labelRect = ::XCEngine::UI::UIRect(
rowBounds.x + metrics.horizontalPadding,
contentLeft,
rowBounds.y,
ClampNonNegative(controlX - metrics.labelControlGap - rowBounds.x - metrics.horizontalPadding),
ClampNonNegative(controlX - effectiveGap - contentLeft),
rowBounds.height);
layout.controlRect = ::XCEngine::UI::UIRect(
controlX,