Skip to main content

cranpose_ui/modifier/
weight.rs

1use super::{inspector_metadata, Modifier};
2use crate::modifier_nodes::WeightElement;
3
4impl Modifier {
5    pub fn weight(self, weight: f32) -> Self {
6        self.weight_with_fill(weight, true)
7    }
8
9    pub fn weight_with_fill(self, weight: f32, fill: bool) -> Self {
10        let modifier = Self::with_element(WeightElement::new(weight, fill))
11            .with_inspector_metadata(inspector_metadata("weight", move |info| {
12                info.add_property("weight", weight.to_string());
13                info.add_property("fill", fill.to_string());
14            }));
15        self.then(modifier)
16    }
17
18    pub fn columnWeight(self, weight: f32, fill: bool) -> Self {
19        self.weight_with_fill(weight, fill)
20    }
21
22    pub fn rowWeight(self, weight: f32, fill: bool) -> Self {
23        self.weight_with_fill(weight, fill)
24    }
25}