git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit759cc63fa13857f49666d010d365ff34c1bdae83
parent9d6caae129
authorLucas Galante <[email protected]>
date2026-06-21 20:48
Decouple measurement SVG canvas height from button size with safety buffer to prevent clipping

 src/widget/input/button_strip.rs | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/widget/input/button_strip.rs b/src/widget/input/button_strip.rs
index 3e5dd3b..e4ee090 100644
--- a/src/widget/input/button_strip.rs
+++ b/src/widget/input/button_strip.rs
@@ -117,8 +117,9 @@ impl ButtonStrip {
             let y_offset = if has_icon { padding_y + 12.0 } else { 0.0 };
             let usable_h = (r.3 - y_offset).max(1.0);
 
+            let vertical_buffer = 30.0;
             let w_px = (r.2 * scale) as u32;
-            let h_px = (usable_h * scale) as u32;
+            let h_px = ((usable_h + vertical_buffer) * scale) as u32;
 
             if w_px == 0 || h_px == 0 {
                 self.tab_text_quads.push(Vec::new());
@@ -136,12 +137,12 @@ impl ButtonStrip {
   <text x="{}" y="{}" font-family="{}" font-size="{}" fill="{}" text-anchor="middle" dominant-baseline="middle" transform="rotate(-90 {} {})">{}</text>
 </svg>"##,
                 w_px, h_px,
-                r.2, usable_h,
-                r.2 / 2.0, usable_h / 2.0,
+                r.2, usable_h + vertical_buffer,
+                r.2 / 2.0, usable_h / 2.0 + vertical_buffer / 2.0,
                 font_fam,
                 font_size,
                 hex_color,
-                r.2 / 2.0, usable_h / 2.0,
+                r.2 / 2.0, usable_h / 2.0 + vertical_buffer / 2.0,
                 label_text
             );
 
@@ -377,7 +378,7 @@ impl Element for ButtonStrip {
 
                     for &(qx, qy, qw, qh, qc) in &self.tab_text_quads[i] {
                         let absolute_x = r.0 + qx;
-                        let absolute_y = r.1 + y_offset + qy;
+                        let absolute_y = r.1 + y_offset + qy - 15.0;
                         
                         let ry1 = absolute_y.max(min_y);
                         let ry2 = (absolute_y + qh).min(max_y);