improved font scaling text and window adjustment, added ctrl + scroll hotkey for font scaling

This commit is contained in:
2026-03-05 01:22:20 -06:00
parent 7d48936f30
commit eda19ef6d5
4 changed files with 183 additions and 101 deletions

View File

@@ -916,6 +916,8 @@ void RenderSettingsPage(App* app) {
float fontSliderW = std::max(S.drawElement("components.settings-page", "effects-input-min-width").size,
availWidth - pad * 2);
ImGui::SetNextItemWidth(fontSliderW);
// Sync from Layout so Alt+scroll hotkey changes are reflected
sp_font_scale = Layout::userFontScale();
float prev_font_scale = sp_font_scale;
{
char fs_fmt[16];
@@ -923,10 +925,11 @@ void RenderSettingsPage(App* app) {
ImGui::SliderFloat("##FontScale", &sp_font_scale, 1.0f, 1.5f, fs_fmt,
ImGuiSliderFlags_AlwaysClamp);
}
// Smooth continuous scaling while dragging.
// Snap to 0.05 increments for consistent stepping.
// 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));
sp_font_scale = std::max(1.0f, std::min(1.5f,
std::round(sp_font_scale * 20.0f) / 20.0f));
if (sp_font_scale != prev_font_scale) {
// While dragging: update layout scale without atlas rebuild
Layout::setUserFontScaleVisual(sp_font_scale);