gardesk/gartop / 9077950

Browse files

Fix header descender cutoff and tab text positioning

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
9077950efe968396f39f21ab5c2596e368e71fb9
Parents
22de913
Tree
dbb71a0

2 changed files

StatusFile+-
M gartop/src/gui/header.rs 2 2
M gartop/src/gui/tabs.rs 2 2
gartop/src/gui/header.rsmodified
@@ -43,7 +43,7 @@ impl HeaderBar {
43
             ..Default::default()
43
             ..Default::default()
44
         };
44
         };
45
         // Position text in upper portion of header (leave room below for visual separation)
45
         // Position text in upper portion of header (leave room below for visual separation)
46
-        let text_y = self.bounds.y as f64 + (self.bounds.height as f64 * 0.5) + 4.0;
46
+        let text_y = self.bounds.y as f64 + (self.bounds.height as f64 * 0.4) + 6.0;
47
         renderer.text("gartop", 16.0, text_y, &title_style)?;
47
         renderer.text("gartop", 16.0, text_y, &title_style)?;
48
 
48
 
49
         // Stats summary on right side
49
         // Stats summary on right side
@@ -74,7 +74,7 @@ impl HeaderBar {
74
         // Position from right side
74
         // Position from right side
75
         let right_margin = 16.0;
75
         let right_margin = 16.0;
76
         let spacing = 20.0;
76
         let spacing = 20.0;
77
-        let y = self.bounds.y as f64 + (self.bounds.height as f64 * 0.5) + 4.0;
77
+        let y = self.bounds.y as f64 + (self.bounds.height as f64 * 0.4) + 6.0;
78
 
78
 
79
         let uptime_width = renderer.measure_text(&uptime_text, &stats_style)?.width as f64;
79
         let uptime_width = renderer.measure_text(&uptime_text, &stats_style)?.width as f64;
80
         let mem_width = renderer.measure_text(&mem_text, &mem_style)?.width as f64;
80
         let mem_width = renderer.measure_text(&mem_text, &mem_style)?.width as f64;
gartop/src/gui/tabs.rsmodified
@@ -154,11 +154,11 @@ impl TabBar {
154
                 ..Default::default()
154
                 ..Default::default()
155
             };
155
             };
156
 
156
 
157
-            // Center text in tab
157
+            // Center text in tab (baseline positioned, so add ~1/3 font height to center)
158
             let text = tab.label();
158
             let text = tab.label();
159
             let text_size = renderer.measure_text(text, &style)?;
159
             let text_size = renderer.measure_text(text, &style)?;
160
             let text_x = tab_rect.x as f64 + (tab_rect.width as f64 - text_size.width as f64) / 2.0;
160
             let text_x = tab_rect.x as f64 + (tab_rect.width as f64 - text_size.width as f64) / 2.0;
161
-            let text_y = tab_rect.y as f64 + (tab_rect.height as f64 + style.font_size) / 2.0;
161
+            let text_y = tab_rect.y as f64 + (tab_rect.height as f64 / 2.0) + (style.font_size / 3.0);
162
             renderer.text(text, text_x, text_y, &style)?;
162
             renderer.text(text, text_x, text_y, &style)?;
163
 
163
 
164
             // Active indicator line
164
             // Active indicator line