overlay: add vertical row padding (#757)

Slightly decrease information density by adding a couple pixels of
vertical padding to each table row in the configurator.
This commit is contained in:
bicarus
2026-06-14 12:29:32 -07:00
committed by GitHub
parent 4879a35eb8
commit 698f2ffc2c
3 changed files with 25 additions and 0 deletions
@@ -396,6 +396,11 @@ namespace overlay::windows {
"cards", "cards",
ImVec2(0, ImGui::GetContentRegionAvail().y - footer_height))) { ImVec2(0, ImGui::GetContentRegionAvail().y - footer_height))) {
// extra vertical padding between card rows
const ImVec2 item_spacing = ImGui::GetStyle().ItemSpacing;
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,
ImVec2(item_spacing.x, item_spacing.y + overlay::apply_scaling(2)));
// -card0 / -card1 override // -card0 / -card1 override
for (size_t i = 0; i < 2; i++) { for (size_t i = 0; i < 2; i++) {
if (card_cmd_overrides[i].has_value()) { if (card_cmd_overrides[i].has_value()) {
@@ -417,6 +422,8 @@ namespace overlay::windows {
build_card_selectable(card); build_card_selectable(card);
} }
ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing
} }
ImGui::EndChild(); ImGui::EndChild();
} }
+15
View File
@@ -59,6 +59,7 @@ namespace overlay::windows {
// same width as dummy marker // same width as dummy marker
const float INDENT = 22.f; const float INDENT = 22.f;
const float ROW_INDENT = overlay::apply_scaling(8); const float ROW_INDENT = overlay::apply_scaling(8);
const float ROW_CELL_PADDING_EXTRA = overlay::apply_scaling(2);
const auto PROJECT_URL = "https://spice2x.github.io"; const auto PROJECT_URL = "https://spice2x.github.io";
constexpr ImVec4 TEXT_COLOR_GREEN(0.f, 1.f, 0.f, 1.f); constexpr ImVec4 TEXT_COLOR_GREEN(0.f, 1.f, 0.f, 1.f);
@@ -888,6 +889,8 @@ namespace overlay::windows {
ImGui::Separator(); ImGui::Separator();
ImGui::PushStyleVarY(ImGuiStyleVar_CellPadding,
ImGui::GetStyle().CellPadding.y + ROW_CELL_PADDING_EXTRA);
if (ImGui::BeginTable("ButtonsTable", 3, ImGuiTableFlags_Resizable)) { if (ImGui::BeginTable("ButtonsTable", 3, ImGuiTableFlags_Resizable)) {
// longest column is probably "Toggle Virtual Keypad P1" in the Overlay page // longest column is probably "Toggle Virtual Keypad P1" in the Overlay page
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, overlay::apply_scaling(200)); ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, overlay::apply_scaling(200));
@@ -936,6 +939,7 @@ namespace overlay::windows {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PopStyleVar(); // ImGuiStyleVar_CellPadding
} }
void Config::build_button( void Config::build_button(
@@ -2407,6 +2411,8 @@ namespace overlay::windows {
} }
ImGui::Separator(); ImGui::Separator();
ImGui::PushStyleVarY(ImGuiStyleVar_CellPadding,
ImGui::GetStyle().CellPadding.y + ROW_CELL_PADDING_EXTRA);
if (ImGui::BeginTable("AnalogsTable", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg)) { if (ImGui::BeginTable("AnalogsTable", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg)) {
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, overlay::apply_scaling(240)); ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, overlay::apply_scaling(240));
@@ -2514,6 +2520,7 @@ namespace overlay::windows {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PopStyleVar(); // ImGuiStyleVar_CellPadding
} }
void Config::edit_analog_popup(Analog &analog, std::string title) { void Config::edit_analog_popup(Analog &analog, std::string title) {
@@ -3097,6 +3104,9 @@ namespace overlay::windows {
} }
ImGui::Spacing(); ImGui::Spacing();
ImGui::PushStyleVarY(ImGuiStyleVar_CellPadding,
ImGui::GetStyle().CellPadding.y + ROW_CELL_PADDING_EXTRA);
auto begin_lights_table = [&]() -> bool { auto begin_lights_table = [&]() -> bool {
if (ImGui::BeginTable("LightsTable", 3, ImGuiTableFlags_Resizable)) { if (ImGui::BeginTable("LightsTable", 3, ImGuiTableFlags_Resizable)) {
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch);
@@ -3122,6 +3132,7 @@ namespace overlay::windows {
ImGui::TextDisabled("-"); ImGui::TextDisabled("-");
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PopStyleVar(); // ImGuiStyleVar_CellPadding
return; return;
} }
@@ -3173,6 +3184,7 @@ namespace overlay::windows {
if (table_begin) { if (table_begin) {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PopStyleVar(); // ImGuiStyleVar_CellPadding
} }
void Config::build_light( void Config::build_light(
@@ -5746,6 +5758,8 @@ namespace overlay::windows {
// preset list table // preset list table
if (!templates_cache.empty()) { if (!templates_cache.empty()) {
ImGui::PushStyleVarY(ImGuiStyleVar_CellPadding,
ImGui::GetStyle().CellPadding.y + ROW_CELL_PADDING_EXTRA);
if (ImGui::BeginTable("TemplateList", 6, if (ImGui::BeginTable("TemplateList", 6,
ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp)) { ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp)) {
@@ -5814,6 +5828,7 @@ namespace overlay::windows {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PopStyleVar(); // ImGuiStyleVar_CellPadding
ImGui::Spacing(); ImGui::Spacing();
} else { } else {
ImGui::TextDisabled("No presets available for this game."); ImGui::TextDisabled("No presets available for this game.");
@@ -647,6 +647,8 @@ namespace overlay::windows {
} }
} else { } else {
// draw patches // draw patches
ImGui::PushStyleVarY(ImGuiStyleVar_CellPadding,
ImGui::GetStyle().CellPadding.y + overlay::apply_scaling(2));
if (ImGui::BeginTable("PatchesTable", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg)) { if (ImGui::BeginTable("PatchesTable", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg)) {
ImGui::TableSetupColumn("##NameColumn", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##NameColumn", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("##OptionsColumn", ImGuiTableColumnFlags_WidthFixed, 240); ImGui::TableSetupColumn("##OptionsColumn", ImGuiTableColumnFlags_WidthFixed, 240);
@@ -875,6 +877,7 @@ namespace overlay::windows {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PopStyleVar(); // ImGuiStyleVar_CellPadding
} }
} }