From 24851bdc396259c88ec7da46587e41b4582c0304 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 16 Mar 2022 01:19:09 +0100 Subject: [PATCH] Fix iced ParamSlider for true by default booleans This looked very confusing otherwise. --- nih_plug_iced/src/widgets/param_slider.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nih_plug_iced/src/widgets/param_slider.rs b/nih_plug_iced/src/widgets/param_slider.rs index bcbe3078..a5dd76c9 100644 --- a/nih_plug_iced/src/widgets/param_slider.rs +++ b/nih_plug_iced/src/widgets/param_slider.rs @@ -474,9 +474,15 @@ impl<'a, P: Param> Widget for ParamSlider<'a, P> { } else { // We'll visualize the difference between the current value and the default value let current_value = self.param.normalized_value(); + // For boolean values alawys have filled be true and not filled be false, otherwise it + // looks super confusing let fill_start_x = util::remap_rect_x_t( &bounds, - self.setter.default_normalized_param_value(self.param), + if self.param.step_count() == Some(1) { + 0.0 + } else { + self.setter.default_normalized_param_value(self.param) + }, ); let fill_end_x = util::remap_rect_x_t(&bounds, current_value);