Refactor XCUI editor module layout
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <XCEditor/Core/UIEditorTabStripInteraction.h>
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Widgets/UIEditorTabStrip.h>
|
||||
#include <XCEditor/Collections/UIEditorTabStripInteraction.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Collections/UIEditorTabStrip.h>
|
||||
#include "Host/AutoScreenshot.h"
|
||||
#include "Host/NativeRenderer.h"
|
||||
|
||||
@@ -79,7 +79,6 @@ constexpr UIColor kTextPrimary(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
constexpr UIColor kTextMuted(0.73f, 0.73f, 0.73f, 1.0f);
|
||||
constexpr UIColor kTextWeak(0.58f, 0.58f, 0.58f, 1.0f);
|
||||
constexpr UIColor kSuccess(0.62f, 0.74f, 0.62f, 1.0f);
|
||||
constexpr UIColor kWarning(0.78f, 0.70f, 0.46f, 1.0f);
|
||||
constexpr UIColor kDanger(0.82f, 0.48f, 0.48f, 1.0f);
|
||||
constexpr UIColor kButtonBg(0.25f, 0.25f, 0.25f, 1.0f);
|
||||
constexpr UIColor kButtonHoveredBg(0.31f, 0.31f, 0.31f, 1.0f);
|
||||
@@ -402,7 +401,7 @@ private:
|
||||
m_tabStripFrame = {};
|
||||
m_tabItems.clear();
|
||||
m_mousePosition = UIPoint(-1000.0f, -1000.0f);
|
||||
m_lastResult = "等待操作";
|
||||
m_lastResult = "已重置到默认标签状态";
|
||||
}
|
||||
|
||||
UIRect GetTabStripRect() const {
|
||||
@@ -524,7 +523,7 @@ private:
|
||||
|
||||
if (result.hitTarget.kind == UIEditorTabStripHitTargetKind::HeaderBackground ||
|
||||
result.hitTarget.kind == UIEditorTabStripHitTargetKind::Content) {
|
||||
m_lastResult = "TabStrip 获得 focus";
|
||||
m_lastResult = "命中 TabStrip 背景,保留 focus";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -577,7 +576,6 @@ private:
|
||||
m_tabItems.push_back(std::move(item));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RenderFrame() {
|
||||
@@ -610,30 +608,30 @@ private:
|
||||
DrawCard(
|
||||
drawList,
|
||||
introRect,
|
||||
"测试功能:Editor TabStrip 基础层",
|
||||
"只验证 TabStrip header / hit-test / selection / close / keyboard,不包含任何业务面板。");
|
||||
"这个测试验证什么功能?",
|
||||
"验证 TabStrip 的 header 命中、选中切换、关闭请求和键盘导航,不接业务面板。");
|
||||
drawList.AddText(
|
||||
UIPoint(introRect.x + 16.0f, introRect.y + 68.0f),
|
||||
"重点检查:tab 布局是否整齐;selected / hover / focus 是否正确;Close 后 active panel 是否回退正确。",
|
||||
"1. 点击 tab,检查 selected / active panel 是否同步。",
|
||||
kTextPrimary,
|
||||
12.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(introRect.x + 16.0f, introRect.y + 92.0f),
|
||||
"操作:点击 tab 切换;点击 X 关闭;Document C 没有 X;点击内容区后按 Left / Right / Home / End;Reset 恢复;F12 截图。",
|
||||
"2. 点击 X,只验证关闭请求;Document C 没有关闭按钮。",
|
||||
kTextMuted,
|
||||
12.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(introRect.x + 16.0f, introRect.y + 116.0f),
|
||||
"预期:Close 命中优先于 tab;键盘导航只在 focused 时生效;Document C 始终保留。",
|
||||
"3. Left / Right / Home / End 验证键盘导航;按重置恢复初始状态。",
|
||||
kTextWeak,
|
||||
12.0f);
|
||||
|
||||
DrawCard(
|
||||
drawList,
|
||||
stateRect,
|
||||
"状态回显",
|
||||
"这里直接回显 hover / focus / active panel / result,方便人工检查。");
|
||||
DrawButton(drawList, m_resetButtonRect, "Reset", m_resetButtonHovered);
|
||||
"状态摘要",
|
||||
"持续显示 hover、focus、active panel、tabs、result 和校验结果。");
|
||||
DrawButton(drawList, m_resetButtonRect, "重置", m_resetButtonHovered);
|
||||
|
||||
const std::size_t selectedIndex =
|
||||
ResolveUIEditorTabStripSelectedIndex(m_tabItems, m_controller.GetWorkspace().activePanelId);
|
||||
@@ -676,7 +674,7 @@ private:
|
||||
12.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(stateRect.x + 16.0f, stateRect.y + 276.0f),
|
||||
validation.IsValid() ? "Validation: OK" : "Validation: " + validation.message,
|
||||
validation.IsValid() ? "校验: OK" : "校验: " + validation.message,
|
||||
validation.IsValid() ? kSuccess : kDanger,
|
||||
12.0f);
|
||||
|
||||
@@ -696,7 +694,7 @@ private:
|
||||
drawList,
|
||||
previewCardRect,
|
||||
"预览区",
|
||||
"这里只放一个 TabStrip 和一个 content placeholder,避免试验面板过杂。");
|
||||
"这里只放一个 TabStrip 和一个 content placeholder,用来观察 header 与 content frame。");
|
||||
|
||||
AppendUIEditorTabStripBackground(drawList, m_layout, m_tabStripState);
|
||||
AppendUIEditorTabStripForeground(drawList, m_layout, m_tabItems, m_tabStripState);
|
||||
@@ -716,12 +714,12 @@ private:
|
||||
13.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(m_layout.contentRect.x + 20.0f, m_layout.contentRect.y + 76.0f),
|
||||
"这个区域只用于验证 TabStrip content frame 与 focus,不承载业务内容。",
|
||||
"这里只验证 TabStrip 的 content frame 与 focus 同步,不接业务内容。",
|
||||
kTextWeak,
|
||||
12.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(m_layout.contentRect.x + 20.0f, m_layout.contentRect.y + 100.0f),
|
||||
"检查点:关闭 Document B 后,应自动回退到相邻 tab;Document C 无法关闭。",
|
||||
"可点击 Document B 切换,或点击 Document C 验证不可关闭 tab。",
|
||||
kTextWeak,
|
||||
12.0f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user