refactor(new_editor): snapshot hosted editor restructuring

This commit is contained in:
2026-04-21 00:57:14 +08:00
parent e123e584c8
commit 9b7b369007
248 changed files with 21152 additions and 14397 deletions

View File

@@ -19,6 +19,19 @@ bool ContainsPoint(const ::XCEngine::UI::UIRect& rect, const ::XCEngine::UI::UIP
point.y <= rect.y + rect.height;
}
void AppendCheckMark(
::XCEngine::UI::UIDrawList& drawList,
const ::XCEngine::UI::UIRect& rect,
const ::XCEngine::UI::UIColor& color) {
const float size = (std::min)(rect.width, rect.height);
const float pad = (std::max)(size * 0.22f, 2.0f);
const ::XCEngine::UI::UIPoint a(rect.x + pad, rect.y + size * 0.56f);
const ::XCEngine::UI::UIPoint b(rect.x + size * 0.44f, rect.y + size - pad);
const ::XCEngine::UI::UIPoint c(rect.x + size - pad, rect.y + pad);
drawList.AddLine(a, b, color, 2.0f);
drawList.AddLine(b, c, color, 2.0f);
}
} // namespace
UIEditorBoolFieldLayout BuildUIEditorBoolFieldLayout(
@@ -101,16 +114,7 @@ void AppendUIEditorBoolFieldForeground(
drawList.PopClipRect();
if (spec.value) {
drawList.AddText(
::XCEngine::UI::UIPoint(
layout.checkmarkRect.x + metrics.checkboxGlyphInsetX,
ResolveUIEditorTextTop(
layout.checkmarkRect,
metrics.checkboxGlyphFontSize,
metrics.checkboxGlyphInsetY)),
"V",
palette.checkboxMarkColor,
metrics.checkboxGlyphFontSize);
AppendCheckMark(drawList, layout.checkmarkRect, palette.checkboxMarkColor);
}
}