UX improvements

This commit is contained in:
2026-02-28 00:57:11 -06:00
parent 6607bae2b5
commit f5378a55ed
6 changed files with 132 additions and 97 deletions

View File

@@ -888,7 +888,7 @@ void RenderSettingsPage(App* app) {
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Card and sidebar opacity (100%% = fully opaque, lower = more see-through)");
// Window Opacity slider (label above)
ImGui::TextUnformatted("Window");
ImGui::TextUnformatted("Window Opacity");
ImGui::SetNextItemWidth(ctrlW);
{
char winop_fmt[16];
@@ -912,20 +912,26 @@ void RenderSettingsPage(App* app) {
ImGui::PushFont(body2);
ImGui::Spacing();
ImGui::TextUnformatted("Font Scale");
float fontSliderW = std::min(availWidth - pad * 2, 260.0f * dp);
float fontSliderW = std::max(S.drawElement("components.settings-page", "effects-input-min-width").size,
availWidth - pad * 2);
ImGui::SetNextItemWidth(fontSliderW);
float prev_font_scale = sp_font_scale;
{
char fs_fmt[16];
snprintf(fs_fmt, sizeof(fs_fmt), "%.1fx", sp_font_scale);
snprintf(fs_fmt, sizeof(fs_fmt), "%.2fx", sp_font_scale);
ImGui::SliderFloat("##FontScale", &sp_font_scale, 1.0f, 1.5f, fs_fmt,
ImGuiSliderFlags_AlwaysClamp);
}
// Snap to nearest 0.1 and apply live as the user drags.
// Font atlas rebuild is deferred to preFrame() (before NewFrame),
// so updating every tick is safe — no dangling font pointers.
sp_font_scale = std::round(sp_font_scale * 10.0f) / 10.0f;
// Smooth continuous scaling while dragging.
// Visual scaling uses FontScaleMain (no atlas rebuild),
// atlas rebuild is deferred to slider release for crisp text.
sp_font_scale = std::max(1.0f, std::min(1.5f, sp_font_scale));
if (sp_font_scale != prev_font_scale) {
// While dragging: update layout scale without atlas rebuild
Layout::setUserFontScaleVisual(sp_font_scale);
}
if (ImGui::IsItemDeactivatedAfterEdit()) {
// On release: rebuild font atlas at final size
Layout::setUserFontScale(sp_font_scale);
saveSettingsPageState(app->settings());
}