diff --git a/src/ui/gitree_ui.cpp b/src/ui/gitree_ui.cpp index ff4a545..085f878 100644 --- a/src/ui/gitree_ui.cpp +++ b/src/ui/gitree_ui.cpp @@ -123,6 +123,11 @@ constexpr float sidebar_child_indent = 24.0f; constexpr float sidebar_nested_indent = 18.0f; ImVec4 change_color(FileChangeKind kind); +float combined_ui_scale(float dpi_scale, int zoom_percent) { + const float zoom_scale = static_cast(zoom_percent) / 100.0f; + return std::clamp(dpi_scale + zoom_scale - 1.0f, 0.80f, 4.0f); +} + bool text_height_checkbox(const char* label, bool* value) { const ImVec2 padding = ImGui::GetStyle().FramePadding; ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {padding.x, 0.0f}); @@ -1141,7 +1146,7 @@ void draw_ref_badge(const RefBadge& badge, int widget_index, int commit_index, i } void draw_commit_table() { - const ScopedUiScale table_scale(1.10f); + const ScopedUiScale table_scale(1.0f); const bool find_shortcut = ImGui::GetIO().KeyCtrl && ImGui::IsKeyPressed(ImGuiKey_F, false); if (find_shortcut) { if (g_commit_search_repository != &repo()) { @@ -3285,7 +3290,7 @@ int runGitree(int argc, char** argv) { ImGui::CreateContext(); ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; ImGui::GetIO().IniFilename = user_data.imguiIniPath().c_str(); - load_fonts(window_manager.dpiScale() * static_cast(g_zoom_percent) / 100.0f); + load_fonts(combined_ui_scale(window_manager.dpiScale(), g_zoom_percent)); ImGui_ImplGlfw_InitForOpenGL(window_manager.nativeWindow(), true); ImGui_ImplOpenGL3_Init("#version 330"); @@ -3293,7 +3298,7 @@ int runGitree(int argc, char** argv) { window_manager.pollEvents(); const bool dpi_changed = window_manager.consumeDpiChange(); if (dpi_changed || g_zoom_reload_requested) { - load_fonts(window_manager.dpiScale() * static_cast(g_zoom_percent) / 100.0f); + load_fonts(combined_ui_scale(window_manager.dpiScale(), g_zoom_percent)); g_zoom_reload_requested = false; } ImGui_ImplOpenGL3_NewFrame();