Refine XCEditor docking and DPI rendering

This commit is contained in:
2026-04-11 17:07:37 +08:00
parent 35d3d6328b
commit 2958dcc491
46 changed files with 4839 additions and 471 deletions

View File

@@ -22,11 +22,21 @@ struct UIEditorTabStripItem {
float desiredHeaderLabelWidth = 0.0f;
};
struct UIEditorTabStripReorderState {
::XCEngine::UI::UIPoint pressPosition = {};
std::size_t pressedIndex = UIEditorTabStripInvalidIndex;
std::size_t sourceIndex = UIEditorTabStripInvalidIndex;
std::size_t previewInsertionIndex = UIEditorTabStripInvalidIndex;
bool armed = false;
bool dragging = false;
};
struct UIEditorTabStripState {
std::size_t selectedIndex = UIEditorTabStripInvalidIndex;
std::size_t hoveredIndex = UIEditorTabStripInvalidIndex;
std::size_t closeHoveredIndex = UIEditorTabStripInvalidIndex;
bool focused = false;
UIEditorTabStripReorderState reorder = {};
};
struct UIEditorTabStripMetrics {
@@ -38,21 +48,26 @@ struct UIEditorTabStripMetrics {
float closeInsetRight = 6.0f;
float closeInsetY = 0.0f;
float labelInsetX = 8.0f;
float labelInsetY = -2.5f;
float labelInsetY = -0.5f;
float baseBorderThickness = 1.0f;
float selectedBorderThickness = 1.0f;
float focusedBorderThickness = 1.0f;
float reorderDragThreshold = 6.0f;
float reorderPreviewThickness = 2.0f;
float reorderPreviewInsetY = 3.0f;
};
struct UIEditorTabStripPalette {
::XCEngine::UI::UIColor stripBackgroundColor =
::XCEngine::UI::UIColor(0.16f, 0.16f, 0.16f, 1.0f);
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
::XCEngine::UI::UIColor headerBackgroundColor =
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
::XCEngine::UI::UIColor contentBackgroundColor =
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.17f, 1.0f);
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
::XCEngine::UI::UIColor stripBorderColor =
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
::XCEngine::UI::UIColor headerContentSeparatorColor =
::XCEngine::UI::UIColor(0.27f, 0.27f, 0.27f, 1.0f);
::XCEngine::UI::UIColor focusedBorderColor =
::XCEngine::UI::UIColor(0.36f, 0.36f, 0.36f, 1.0f);
::XCEngine::UI::UIColor tabColor =
@@ -60,7 +75,7 @@ struct UIEditorTabStripPalette {
::XCEngine::UI::UIColor tabHoveredColor =
::XCEngine::UI::UIColor(0.23f, 0.23f, 0.23f, 1.0f);
::XCEngine::UI::UIColor tabSelectedColor =
::XCEngine::UI::UIColor(0.22f, 0.22f, 0.22f, 1.0f);
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
::XCEngine::UI::UIColor tabBorderColor =
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
::XCEngine::UI::UIColor tabHoveredBorderColor =
@@ -81,6 +96,14 @@ struct UIEditorTabStripPalette {
::XCEngine::UI::UIColor(0.30f, 0.30f, 0.30f, 1.0f);
::XCEngine::UI::UIColor closeGlyphColor =
::XCEngine::UI::UIColor(0.83f, 0.83f, 0.83f, 1.0f);
::XCEngine::UI::UIColor reorderPreviewColor =
::XCEngine::UI::UIColor(0.82f, 0.82f, 0.82f, 1.0f);
};
struct UIEditorTabStripInsertionPreview {
bool visible = false;
std::size_t insertionIndex = UIEditorTabStripInvalidIndex;
::XCEngine::UI::UIRect indicatorRect = {};
};
struct UIEditorTabStripLayout {
@@ -91,6 +114,7 @@ struct UIEditorTabStripLayout {
std::vector<::XCEngine::UI::UIRect> closeButtonRects = {};
std::vector<bool> showCloseButtons = {};
std::size_t selectedIndex = UIEditorTabStripInvalidIndex;
UIEditorTabStripInsertionPreview insertionPreview = {};
};
enum class UIEditorTabStripHitTargetKind : std::uint8_t {