1
0
Fork 0

Don't fill the slider if it's empty

This commit is contained in:
Robbert van der Helm 2022-02-09 11:19:49 +01:00
parent e2524a2d81
commit dbc6bf993b

View file

@ -91,6 +91,7 @@ impl<P: Param> Widget for ParamSlider<'_, P> {
.rect_filled(response.rect, 0.0, ui.visuals().widgets.inactive.bg_fill); .rect_filled(response.rect, 0.0, ui.visuals().widgets.inactive.bg_fill);
let filled_proportion = self.normalized_value(); let filled_proportion = self.normalized_value();
if filled_proportion > 0.0 {
let mut filled_rect = response.rect; let mut filled_rect = response.rect;
filled_rect.set_width(response.rect.width() * filled_proportion); filled_rect.set_width(response.rect.width() * filled_proportion);
let filled_bg = if response.dragged() { let filled_bg = if response.dragged() {
@ -100,6 +101,7 @@ impl<P: Param> Widget for ParamSlider<'_, P> {
ui.visuals().selection.bg_fill ui.visuals().selection.bg_fill
}; };
ui.painter().rect_filled(filled_rect, 0.0, filled_bg); ui.painter().rect_filled(filled_rect, 0.0, filled_bg);
}
ui.painter().rect_stroke( ui.painter().rect_stroke(
response.rect, response.rect,