fix(graph): enlarge avatars and mask lane edges

This commit is contained in:
2026-06-18 19:43:39 -05:00
parent 27ecf6c351
commit 41b0850386

View File

@@ -38,6 +38,7 @@ void GraphRenderer::drawRow(int row, const CommitInfo& commit,
const float lane_spacing = px(18.0f);
const float x = origin.x + px(15.0f) + lane_spacing * commit.lane;
const float y = origin.y + content_height * 0.5f;
const float row_clip_padding = ImGui::GetStyle().CellPadding.y + px(1.0f);
std::vector<float> row_offsets(row_heights.size() + 1, 0.0f);
for (size_t index = 0; index < row_heights.size(); ++index)
@@ -50,6 +51,9 @@ void GraphRenderer::drawRow(int row, const CommitInfo& commit,
// Every row redraws edges crossing its clip rectangle. This keeps long paths continuous
// without allowing table row clipping to cut out intermediate segments.
draw->PushClipRect(
{origin.x, origin.y - row_clip_padding},
{origin.x + ImGui::GetContentRegionAvail().x, origin.y + content_height + row_clip_padding}, true);
for (int child_row = 0; child_row < static_cast<int>(commits.size()); ++child_row) {
if (row_heights[static_cast<size_t>(child_row)] <= 0.0f) continue;
const CommitInfo& child = commits[static_cast<size_t>(child_row)];
@@ -85,6 +89,7 @@ void GraphRenderer::drawRow(int row, const CommitInfo& commit,
draw->AddLine({parent_x, curve_end_y}, {parent_x, parent_y}, color, px(1.8f));
}
}
draw->PopClipRect();
const ImU32 lane_color = laneColor(commit.lane);
if (commit.parents > 1) {
@@ -94,8 +99,9 @@ void GraphRenderer::drawRow(int row, const CommitInfo& commit,
return;
}
const float radius = px(6.4f);
draw->AddCircleFilled({x, y}, radius + px(2.0f), IM_COL32(19, 24, 31, 255));
const float radius = px(8.4f);
// The opaque backing masks every lane segment before the avatar is painted.
draw->AddCircleFilled({x, y}, radius + px(2.2f), IM_COL32(19, 24, 31, 255));
draw->AddCircle({x, y}, radius + px(1.0f), lane_color, 0, px(2.0f));
draw->AddCircleFilled({x, y}, radius - px(1.0f), IM_COL32(232, 238, 242, 255));