From 0881222fdebff36748f87d6a69ece22c7342e8a1 Mon Sep 17 00:00:00 2001 From: Bu5hm4nn Date: Fri, 10 May 2024 17:12:53 -0600 Subject: [PATCH] Settings UI: Allow custom values for DPI override and FPS --- gossip-bin/src/ui/settings/ui.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gossip-bin/src/ui/settings/ui.rs b/gossip-bin/src/ui/settings/ui.rs index 866bffc7..cddcd887 100644 --- a/gossip-bin/src/ui/settings/ui.rs +++ b/gossip-bin/src/ui/settings/ui.rs @@ -47,9 +47,10 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra ui.add_space(20.0); ui.horizontal_wrapped(|ui| { + let dpi = app.override_dpi_value; ui.label("Override DPI: ").on_hover_text("On some systems, DPI is not reported properly. In other cases, people like to zoom in or out. This lets you."); ui.checkbox(&mut app.override_dpi, "Override to "); - ui.add(Slider::new(&mut app.override_dpi_value, 72..=400).text("DPI")); + ui.add(Slider::new(&mut app.override_dpi_value, dpi.min(72)..=dpi.max(400)).clamp_to_range(false).text("DPI")); ui.add_space(10.0); // indent @@ -81,8 +82,9 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra ui.add_space(20.0); ui.horizontal(|ui| { + let fps = app.unsaved_settings.max_fps; ui.label("Maximum FPS: ").on_hover_text("The UI redraws every frame. By limiting the maximum FPS you can reduce load on your CPU. Takes effect immediately. I recommend 10, maybe even less."); - ui.add(Slider::new(&mut app.unsaved_settings.max_fps, 2..=60).text("Frames per second")); + ui.add(Slider::new(&mut app.unsaved_settings.max_fps, fps.min(2)..=fps.max(60)).clamp_to_range(false).text("Frames per second")); }); ui.add_space(20.0);