File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ pub struct Slider<'a> {
99 id : Id ,
1010 label : & ' a str ,
1111 range : Range < f32 > ,
12+ label_width : Option < f32 > ,
1213}
1314
1415impl < ' a > Slider < ' a > {
@@ -17,14 +18,21 @@ impl<'a> Slider<'a> {
1718 id,
1819 range,
1920 label : "" ,
21+ label_width : None ,
2022 }
2123 }
2224
2325 pub const fn label < ' b > ( self , label : & ' b str ) -> Slider < ' b > {
2426 Slider {
25- id : self . id ,
26- range : self . range ,
2727 label,
28+ ..self
29+ }
30+ }
31+
32+ pub const fn label_width ( self , width : f32 ) -> Self {
33+ Slider {
34+ label_width : Some ( width) ,
35+ ..self
2836 }
2937 }
3038
@@ -38,7 +46,8 @@ impl<'a> Slider<'a> {
3846 let pos = context. window . cursor . fit ( size, Layout :: Vertical ) ;
3947
4048 let editbox_width = 50. ;
41- let label_width = 100. ;
49+
50+ let label_width = self . label_width . unwrap_or ( 100. ) ;
4251 let slider_width = size. x - editbox_width - label_width;
4352 let margin = 5. ;
4453
You can’t perform that action at this time.
0 commit comments