Don't fill the slider if it's empty
This commit is contained in:
parent
e2524a2d81
commit
dbc6bf993b
1 changed files with 11 additions and 9 deletions
|
@ -91,15 +91,17 @@ 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();
|
||||||
let mut filled_rect = response.rect;
|
if filled_proportion > 0.0 {
|
||||||
filled_rect.set_width(response.rect.width() * filled_proportion);
|
let mut filled_rect = response.rect;
|
||||||
let filled_bg = if response.dragged() {
|
filled_rect.set_width(response.rect.width() * filled_proportion);
|
||||||
// TODO: Use something that works with a light theme
|
let filled_bg = if response.dragged() {
|
||||||
Color32::DARK_GRAY
|
// TODO: Use something that works with a light theme
|
||||||
} else {
|
Color32::DARK_GRAY
|
||||||
ui.visuals().selection.bg_fill
|
} else {
|
||||||
};
|
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,
|
||||||
|
|
Loading…
Add table
Reference in a new issue