Change submodules icon to folder, expand row highlight left bound, scale ref badge text size down
This commit is contained in:
@@ -1661,7 +1661,7 @@ void draw_sidebar(float width) {
|
||||
section_heights[2],
|
||||
next_open_indices[2] < section_open.size() ? section_heights[next_open_indices[2]] / g_ui_scale : 0.0f,
|
||||
minimum_height, next_open_indices[2], next_open_indices[2] != last_open, section_open[2] && last_open != 2);
|
||||
section(ICON_TB_FOLDER_TREE " SUBMODULES", repo().submodules, ICON_TB_FOLDER_TREE,
|
||||
section(ICON_TB_FOLDER_TREE " SUBMODULES", repo().submodules, ICON_TB_FOLDER,
|
||||
"Add submodule", "Add submodule", SidebarItemKind::submodule, 3,
|
||||
section_heights[3], 0.0f, minimum_height, section_open.size(), false, false);
|
||||
ImGui::PopStyleVar();
|
||||
@@ -1687,7 +1687,8 @@ float outline_icon_width(const char* icon) {
|
||||
|
||||
float ref_badge_width(const RefBadge& badge) {
|
||||
const std::string display_name = ref_display_name(badge);
|
||||
float width = ImGui::CalcTextSize(display_name.c_str()).x + ui(12.0f);
|
||||
const float text_scale = 0.82f;
|
||||
float width = ImGui::CalcTextSize(display_name.c_str()).x * text_scale + ui(12.0f);
|
||||
if (badge.kind == RefKind::local) {
|
||||
width += outline_icon_width(ICON_TB_DEVICE_LAPTOP) + ui(6.0f);
|
||||
if (badge.current) width += outline_icon_width(ICON_TB_CHECK) + ui(5.0f);
|
||||
@@ -1771,8 +1772,10 @@ void draw_ref_badge(const RefBadge& badge, int widget_index, int commit_index, i
|
||||
const float rounding = ui(3.0f);
|
||||
draw->AddRectFilled(minimum, maximum, background, rounding, corners);
|
||||
|
||||
const float text_scale = 0.82f;
|
||||
const float label_width = ImGui::CalcTextSize(display_name.c_str()).x * text_scale;
|
||||
float x = minimum.x + ui(5.0f);
|
||||
const float text_y = minimum.y + (chip_size.y - ImGui::GetFontSize()) * 0.5f;
|
||||
const float text_y = minimum.y + (chip_size.y - ImGui::GetFontSize() * text_scale) * 0.5f;
|
||||
const float icon_y = minimum.y + (chip_size.y - g_outline_icon_size) * 0.5f;
|
||||
const ImU32 color = badge.current ? IM_COL32(248, 250, 252, 255) : IM_COL32(197, 203, 212, 255);
|
||||
const auto draw_icon = [&](const char* icon) {
|
||||
@@ -1781,8 +1784,13 @@ void draw_ref_badge(const RefBadge& badge, int widget_index, int commit_index, i
|
||||
x += outline_icon_width(icon) + ui(5.0f);
|
||||
};
|
||||
if (badge.current) draw_icon(ICON_TB_CHECK);
|
||||
draw->AddText({x, text_y}, color, display_name.c_str());
|
||||
x += ImGui::CalcTextSize(display_name.c_str()).x + ui(5.0f);
|
||||
|
||||
// Draw text with smaller font scale
|
||||
ImGui::PushFont(nullptr, ImGui::GetStyle().FontSizeBase * text_scale);
|
||||
draw->AddText(ImGui::GetFont(), ImGui::GetFontSize(), {x, text_y}, color, display_name.c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
x += label_width + ui(5.0f);
|
||||
if (badge.kind == RefKind::local) draw_icon(ICON_TB_DEVICE_LAPTOP);
|
||||
if (show_cloud) draw_icon(ICON_TB_CLOUD);
|
||||
if (show_tag) draw_icon(ICON_TB_TAG);
|
||||
@@ -2046,9 +2054,9 @@ void draw_commit_table() {
|
||||
mouse.y >= row_top && mouse.y < row_top + row_height;
|
||||
if (selected || hovered) {
|
||||
ImDrawList* draw = ImGui::GetWindowDrawList();
|
||||
draw->PushClipRect({message_left, table_body_clip_top},
|
||||
draw->PushClipRect({row_left, table_body_clip_top},
|
||||
{row_right, table_body_clip_bottom}, false);
|
||||
draw->AddRectFilled({message_left, row_top}, {row_right, row_top + row_height},
|
||||
draw->AddRectFilled({row_left, row_top}, {row_right, row_top + row_height},
|
||||
selected ? IM_COL32(45, 58, 84, 155) : IM_COL32(70, 77, 90, 55));
|
||||
draw->PopClipRect();
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ float GraphRenderer::requiredWidth(const std::vector<CommitInfo>& commits, float
|
||||
int maximum_lane = 0;
|
||||
for (const auto& commit : commits) maximum_lane = std::max(maximum_lane, commit.lane);
|
||||
// Keep one spare lane available for edges that must route around occupied commit lanes.
|
||||
return std::max((68.0f + maximum_lane * 22.0f) * scale, 82.0f * scale);
|
||||
return std::max((68.0f + maximum_lane * 28.0f) * scale, 82.0f * scale);
|
||||
}
|
||||
|
||||
void GraphRenderer::drawRow(int row, const CommitInfo& commit,
|
||||
@@ -135,7 +135,7 @@ void GraphRenderer::drawRow(int row, const CommitInfo& commit,
|
||||
const ImVec2 origin = ImGui::GetCursorScreenPos();
|
||||
const float row_height = row_heights[static_cast<size_t>(row)];
|
||||
const float content_height = std::max(px(1.0f), row_height - ImGui::GetStyle().CellPadding.y * 2.0f);
|
||||
const float lane_spacing = px(22.0f);
|
||||
const float lane_spacing = px(28.0f);
|
||||
const float x = origin.x + px(17.0f) + lane_spacing * commit.lane;
|
||||
const float y = origin.y + content_height * 0.5f;
|
||||
const float cell_right = origin.x + ImGui::GetContentRegionAvail().x;
|
||||
|
||||
Reference in New Issue
Block a user