Draw proper checkmark for Checkbox in iced_wgpu

This commit is contained in:
Héctor Ramón Jiménez 2019-11-14 03:34:41 +01:00
parent 66bb2f7cbf
commit 2c8ba652a7
4 changed files with 20 additions and 12 deletions

View file

@ -74,14 +74,15 @@ impl checkbox::Renderer for Renderer {
(
Primitive::Group {
primitives: if checkbox.is_checked {
// TODO: Draw an actual icon
let (check, _) = text::Renderer::draw(
self,
&Text::new("X")
.horizontal_alignment(HorizontalAlignment::Center)
.vertical_alignment(VerticalAlignment::Center),
checkbox_layout,
);
let check = Primitive::Text {
content: crate::text::CHECKMARK_ICON.to_string(),
font: crate::text::BUILTIN_ICONS,
size: checkbox_bounds.height * 0.7,
bounds: checkbox_bounds,
color: [0.3, 0.3, 0.3].into(),
horizontal_alignment: HorizontalAlignment::Center,
vertical_alignment: VerticalAlignment::Center,
};
vec![checkbox_border, checkbox_box, check, label]
} else {