1
0
Fork 0

Fix iced ParamSlider for true by default booleans

This looked very confusing otherwise.
This commit is contained in:
Robbert van der Helm 2022-03-16 01:19:09 +01:00
parent 3b08da0f09
commit 24851bdc39

View file

@ -474,9 +474,15 @@ impl<'a, P: Param> Widget<ParamMessage, Renderer> for ParamSlider<'a, P> {
} else { } else {
// We'll visualize the difference between the current value and the default value // We'll visualize the difference between the current value and the default value
let current_value = self.param.normalized_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( let fill_start_x = util::remap_rect_x_t(
&bounds, &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); let fill_end_x = util::remap_rect_x_t(&bounds, current_value);