Tighten TreeView leading padding and guide offset
This commit is contained in:
1 parent
e1469a357b
commit
ea71bad9f9
2 files changed
+8
-3
No files matched your search
@@ -79,6 +79,7 @@
|
||||
- 修复了 `ComboBox` 在弹出列表中更改选择后未及时同步内部选中态的问题,避免重新展开时出现旧选项和新选项同时高亮
|
||||
- 调整了 `TreeView` 各层级节点背景框的左侧起点:子节点的圆角矩形现在会随缩进一起右移,更贴合本层内容的实际包裹范围
|
||||
- 为 `TreeView` 补充了竖向层级引导线:祖先层级列和展开节点的子树主干线现在都会显示,层级结构更直观
|
||||
- 微调了 `TreeView` 每个节点左侧的内部留白和引导线位置,让竖向层级线与下一层级节点边框之间留出更自然的间距
|
||||
|
||||
## 构建
|
||||
|
||||
|
||||
+7
-3
@@ -36,6 +36,10 @@ constexpr float kSliderTrackHeight = 6.0f;
|
||||
constexpr float kSliderThumbRadius = 9.0f;
|
||||
constexpr float kListItemCornerRadius = 14.0f;
|
||||
constexpr float kTreeIndent = 22.0f;
|
||||
constexpr float kTreeRowLeadingPadding = 8.0f;
|
||||
constexpr float kTreeGuideLineOffset = 15.0f;
|
||||
constexpr float kTreeExpanderSize = 14.0f;
|
||||
constexpr float kTreeTextGapAfterExpander = 10.0f;
|
||||
constexpr float kTabCornerRadius = 12.0f;
|
||||
constexpr float kAccordionCornerRadius = 14.0f;
|
||||
constexpr float kAccordionHeaderHorizontalPadding = 20.0f;
|
||||
@@ -1937,7 +1941,7 @@ void TreeView::Arrange(const RectF &finalRect)
|
||||
const float rowX = finalRect.x + rowInset;
|
||||
const float rowWidth = std::max(finalRect.width - rowInset, 0.0f);
|
||||
entry.rowRect = {rowX, rowY, rowWidth, itemHeight_ - 6.0f};
|
||||
entry.expanderRect = {rowX + 12.0f, rowY + 20.0f, 14.0f, 14.0f};
|
||||
entry.expanderRect = {rowX + kTreeRowLeadingPadding, rowY + 20.0f, kTreeExpanderSize, kTreeExpanderSize};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1969,7 +1973,7 @@ void TreeView::Render(DeviceResources &deviceResources)
|
||||
const float rowBottom = entry.rowRect.y + entry.rowRect.height + 3.0f;
|
||||
for (size_t ancestorDepth = 0; ancestorDepth < entry.depth; ++ancestorDepth)
|
||||
{
|
||||
const float guideX = bounds_.x + 19.0f + static_cast<float>(ancestorDepth) * kTreeIndent;
|
||||
const float guideX = bounds_.x + kTreeGuideLineOffset + static_cast<float>(ancestorDepth) * kTreeIndent;
|
||||
target->DrawLine(D2D1::Point2F(guideX, rowTop), D2D1::Point2F(guideX, rowBottom), lineBrush, 1.2f);
|
||||
}
|
||||
|
||||
@@ -1995,7 +1999,7 @@ void TreeView::Render(DeviceResources &deviceResources)
|
||||
}
|
||||
}
|
||||
|
||||
const float contentX = entry.rowRect.x + 36.0f;
|
||||
const float contentX = entry.rowRect.x + kTreeRowLeadingPadding + kTreeExpanderSize + kTreeTextGapAfterExpander;
|
||||
if (!entry.node->children.empty())
|
||||
{
|
||||
const float centerX = entry.expanderRect.x + entry.expanderRect.width * 0.5f;
|
||||
|
||||
Reference in new issue
Block a user