chore: checkpoint current workspace changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <XCEditor/Collections/UIEditorTabStrip.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -77,15 +78,8 @@ float ResolveTabTextLeft(
|
||||
const UIRect& rect,
|
||||
const UIEditorTabStripItem& item,
|
||||
const UIEditorTabStripMetrics& metrics) {
|
||||
const float padding =
|
||||
(std::max)(
|
||||
ClampNonNegative(metrics.layoutMetrics.tabHorizontalPadding),
|
||||
ClampNonNegative(metrics.labelInsetX));
|
||||
const float availableLeft = rect.x + padding;
|
||||
const float availableRight = rect.x + rect.width - padding;
|
||||
const float availableWidth = (std::max)(availableRight - availableLeft, 0.0f);
|
||||
const float labelWidth = ResolveEstimatedLabelWidth(item, metrics);
|
||||
return availableLeft + (std::max)(0.0f, (availableWidth - labelWidth) * 0.5f);
|
||||
return rect.x + std::floor((std::max)(0.0f, rect.width - labelWidth) * 0.5f);
|
||||
}
|
||||
|
||||
UIColor ResolveTabFillColor(
|
||||
|
||||
@@ -37,12 +37,12 @@ void AppendDisclosureArrow(
|
||||
const ::XCEngine::UI::UIRect& rect,
|
||||
bool expanded,
|
||||
const ::XCEngine::UI::UIColor& color) {
|
||||
constexpr float kOpticalCenterYOffset = -0.5f;
|
||||
constexpr float kOpticalCenterYOffset = -1.0f;
|
||||
const float centerX = std::floor(rect.x + rect.width * 0.5f) + 0.5f;
|
||||
const float centerY =
|
||||
std::floor(rect.y + rect.height * 0.5f + kOpticalCenterYOffset) + 0.5f;
|
||||
const float halfExtent = (std::max)(2.5f, std::floor((std::min)(rect.width, rect.height) * 0.24f));
|
||||
const float triangleHeight = halfExtent * 1.55f;
|
||||
const float halfExtent = (std::max)(3.0f, std::floor((std::min)(rect.width, rect.height) * 0.24f));
|
||||
const float triangleHeight = halfExtent * 1.45f;
|
||||
|
||||
::XCEngine::UI::UIPoint points[3] = {};
|
||||
if (expanded) {
|
||||
@@ -185,6 +185,7 @@ UIEditorTreeViewLayout BuildUIEditorTreeViewLayout(
|
||||
layout.visibleItemIndices = CollectUIEditorTreeViewVisibleItemIndices(items, expansionModel);
|
||||
layout.rowRects.reserve(layout.visibleItemIndices.size());
|
||||
layout.disclosureRects.reserve(layout.visibleItemIndices.size());
|
||||
layout.iconRects.reserve(layout.visibleItemIndices.size());
|
||||
layout.labelRects.reserve(layout.visibleItemIndices.size());
|
||||
layout.itemHasChildren.reserve(layout.visibleItemIndices.size());
|
||||
layout.itemExpanded.reserve(layout.visibleItemIndices.size());
|
||||
@@ -211,16 +212,29 @@ UIEditorTreeViewLayout BuildUIEditorTreeViewLayout(
|
||||
rowRect.y + (rowRect.height - metrics.disclosureExtent) * 0.5f,
|
||||
metrics.disclosureExtent,
|
||||
metrics.disclosureExtent);
|
||||
const bool hasLeadingIcon = item.leadingIcon.IsValid();
|
||||
const float iconExtent = ClampNonNegative(metrics.iconExtent);
|
||||
const float contentStartX = disclosureRect.x + metrics.disclosureExtent + metrics.disclosureLabelGap;
|
||||
const ::XCEngine::UI::UIRect iconRect(
|
||||
hasLeadingIcon ? contentStartX : 0.0f,
|
||||
rowRect.y + (rowRect.height - iconExtent) * 0.5f,
|
||||
hasLeadingIcon ? iconExtent : 0.0f,
|
||||
hasLeadingIcon ? iconExtent : 0.0f);
|
||||
const float labelStartX =
|
||||
hasLeadingIcon
|
||||
? iconRect.x + iconRect.width + metrics.iconLabelGap
|
||||
: contentStartX;
|
||||
const ::XCEngine::UI::UIRect labelRect(
|
||||
disclosureRect.x + metrics.disclosureExtent + metrics.disclosureLabelGap,
|
||||
labelStartX,
|
||||
rowRect.y,
|
||||
(rowRect.x + rowRect.width) -
|
||||
(disclosureRect.x + metrics.disclosureExtent + metrics.disclosureLabelGap) -
|
||||
labelStartX -
|
||||
metrics.horizontalPadding,
|
||||
rowRect.height);
|
||||
|
||||
layout.rowRects.push_back(rowRect);
|
||||
layout.disclosureRects.push_back(disclosureRect);
|
||||
layout.iconRects.push_back(iconRect);
|
||||
layout.labelRects.push_back(labelRect);
|
||||
layout.itemHasChildren.push_back(hasChildren);
|
||||
layout.itemExpanded.push_back(expanded);
|
||||
@@ -300,6 +314,9 @@ void AppendUIEditorTreeViewForeground(
|
||||
layout.itemExpanded[visibleOffset],
|
||||
palette.disclosureColor);
|
||||
}
|
||||
if (item.leadingIcon.IsValid()) {
|
||||
drawList.AddImage(layout.iconRects[visibleOffset], item.leadingIcon);
|
||||
}
|
||||
|
||||
drawList.PushClipRect(layout.labelRects[visibleOffset]);
|
||||
drawList.AddText(
|
||||
|
||||
@@ -265,9 +265,13 @@ void AppendUIEditorMenuPopupForeground(
|
||||
}
|
||||
|
||||
if (item.hasSubmenu) {
|
||||
const float submenuLeft =
|
||||
rect.x + rect.width -
|
||||
ClampNonNegative(metrics.shortcutInsetRight) -
|
||||
ClampNonNegative(metrics.submenuIndicatorWidth);
|
||||
drawList.AddText(
|
||||
UIPoint(
|
||||
rect.x + rect.width - ClampNonNegative(metrics.shortcutInsetRight),
|
||||
submenuLeft,
|
||||
ResolveGlyphTop(rect, metrics)),
|
||||
">",
|
||||
palette.glyphColor,
|
||||
|
||||
Reference in New Issue
Block a user