@@ -58,14 +58,13 @@ impl TaskView {
58
58
// We'll draw the border ourselves, so the inner View shouldn't
59
59
view. set_border_enabled ( false ) ;
60
60
61
- // TODO(PT): Sizer for labels?
61
+ // TODO(PT): Sizer
62
62
let title_label = Rc :: new ( Label :: new (
63
- Rect :: from_parts (
64
- Point :: new ( insets. left + 4 , insets. top + 4 ) ,
65
- Size :: new ( 300 , 30 ) ,
66
- ) ,
67
63
& title,
68
64
Color :: new ( 30 , 30 , 30 ) ,
65
+ move |label, superview_size| {
66
+ Rect :: from_parts ( Point :: new ( insets. left + 4 , insets. top ) , Size :: new ( 300 , 30 ) )
67
+ } ,
69
68
) ) ;
70
69
let title_label_clone = Rc :: clone ( & title_label) ;
71
70
// TODO(PT): Set font size as attribute?
@@ -82,12 +81,13 @@ impl TaskView {
82
81
}
83
82
84
83
fn text_width ( self : & Rc < Self > ) -> usize {
85
- 8 * self . title . borrow ( ) . len ( )
84
+ 20 * self . title . borrow ( ) . len ( )
86
85
}
87
86
88
87
fn resize_title_label ( self : & Rc < Self > , superview_size : Size ) {
89
88
// TODO(PT): This is a hack until labels have sizers
90
89
// TODO(PT): Expose font size of labels
90
+ //let font_size = Size::new(20, 20);
91
91
let font_size = Size :: new ( 8 , 10 ) ;
92
92
let insets = Self :: border_insets ( ) ;
93
93
let usable_frame = Rect :: from_parts ( Point :: zero ( ) , superview_size) . inset_by_insets ( insets) ;
@@ -97,6 +97,7 @@ impl TaskView {
97
97
Point :: new (
98
98
usable_frame. mid_x ( ) - ( text_width / 2 ) ,
99
99
usable_frame. mid_y ( ) - ( font_size. height / 2 ) ,
100
+ //usable_frame.min_y(),
100
101
) ,
101
102
Size :: new ( text_width, font_size. height ) ,
102
103
) ;
0 commit comments