Fix drawing empty Quad on empty ProgressBar

This commit is contained in:
Héctor Ramón Jiménez 2020-01-08 03:32:38 +01:00
parent cae4463e83
commit 89b1ac6eac

View file

@ -29,20 +29,24 @@ impl progress_bar::Renderer for Renderer {
}],
};
let bar = Primitive::Quad {
bounds: Rectangle {
width: active_progress_width,
..bounds
},
background: style.bar,
border_radius: style.border_radius,
border_width: 0,
border_color: Color::TRANSPARENT,
};
(
Primitive::Group {
primitives: vec![background, bar],
if active_progress_width > 0.0 {
let bar = Primitive::Quad {
bounds: Rectangle {
width: active_progress_width,
..bounds
},
background: style.bar,
border_radius: style.border_radius,
border_width: 0,
border_color: Color::TRANSPARENT,
};
Primitive::Group {
primitives: vec![background, bar],
}
} else {
background
},
MouseCursor::OutOfBounds,
)