cranpose_ui/modifier/
weight.rs1use cranpose_foundation::plain_element;
2
3use super::{Modifier, inspector_metadata};
4use crate::modifier_nodes::WeightElement;
5
6impl Modifier {
7 pub fn weight(self, weight: f32) -> Self {
11 self.weight_with_fill(weight, true)
12 }
13
14 pub fn weight_with_fill(self, weight: f32, fill: bool) -> Self {
16 let modifier = Self::from_dyn_element(plain_element(WeightElement::new(weight, fill)))
17 .with_inspector_metadata(inspector_metadata("weight", move |info| {
18 info.add_property("weight", weight.to_string());
19 info.add_property("fill", fill.to_string());
20 }));
21 self.then(modifier)
22 }
23
24 #[expect(non_snake_case, reason = "names follow Compose's casing")]
26 pub fn columnWeight(self, weight: f32, fill: bool) -> Self {
27 self.weight_with_fill(weight, fill)
28 }
29
30 #[expect(non_snake_case, reason = "names follow Compose's casing")]
32 pub fn rowWeight(self, weight: f32, fill: bool) -> Self {
33 self.weight_with_fill(weight, fill)
34 }
35}