tessera_ui_basic_components/pipelines/checkmark/
command.rs1use tessera_ui::{Color, DrawCommand};
2
3#[derive(Debug, Clone)]
5pub struct CheckmarkCommand {
6 pub color: Color,
8 pub stroke_width: f32,
10 pub progress: f32,
12 pub padding: [f32; 2], }
15
16impl CheckmarkCommand {
17 pub fn new() -> Self {
19 Self {
20 color: Color::new(0.0, 0.6, 0.0, 1.0), stroke_width: 5.0,
22 progress: 1.0, padding: [2.0, 2.0],
24 }
25 }
26
27 pub fn with_color(mut self, color: Color) -> Self {
29 self.color = color;
30 self
31 }
32
33 pub fn with_stroke_width(mut self, width: f32) -> Self {
35 self.stroke_width = width;
36 self
37 }
38
39 pub fn with_progress(mut self, progress: f32) -> Self {
41 self.progress = progress.clamp(0.0, 1.0);
42 self
43 }
44
45 pub fn with_padding(mut self, horizontal: f32, vertical: f32) -> Self {
47 self.padding = [horizontal, vertical];
48 self
49 }
50}
51
52impl Default for CheckmarkCommand {
53 fn default() -> Self {
54 Self::new()
55 }
56}
57
58impl DrawCommand for CheckmarkCommand {
59 fn barrier(&self) -> Option<tessera_ui::BarrierRequirement> {
60 None
62 }
63}