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

commite1eaec28fa30552d5571475f8e4306ce35bdefc8
parent091d9196cb
authorLucas Galante <[email protected]>
date2026-07-01 13:16
Fix separator, item background, and cursor visibility in rounded tree/spinbox elements

 src/widget/input/spinbox.rs | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/widget/input/spinbox.rs b/src/widget/input/spinbox.rs
index 523af68..99c4958 100644
--- a/src/widget/input/spinbox.rs
+++ b/src/widget/input/spinbox.rs
@@ -337,23 +337,14 @@ impl Element for Spinbox {
         let mut quads = Vec::new();
         let (r1, r2, r3, r4) = self.rounded_corners();
         let has_rounded = r1 || r2 || r3 || r4;
+        if has_rounded {
+            return quads;
+        }
 
         let top = self.base.label_offset();
         let visual_h = self.base.h - top;
         let display_w = self.base.w * 0.55;
 
-        if has_rounded {
-            if self.editing {
-                let char_width = 8.4;
-                let cursor_x = self.base.x + 4.0 + (self.cursor_idx as f32 * char_width);
-                let max_cursor_x = self.base.x + display_w - 4.0;
-                let final_cursor_x = cursor_x.min(max_cursor_x);
-                let cursor_y = self.base.y + top + (visual_h - 14.0) / 2.0;
-                quads.push((final_cursor_x, cursor_y, 1.5, 14.0, [0.80, 0.80, 0.85, 1.0]));
-            }
-            return quads;
-        }
-
         let p = crate::layout::spinbox_button_padding();
         let split_dec = self.base.x + display_w;
         let inc_col = if self.hover_inc { colors::SPINBOX_BUTTON_HOVER } else { colors::SPINBOX_BUTTON };
@@ -443,6 +434,16 @@ impl Element for Spinbox {
             quads.push((split_dec + p + btn_w_padded, btn_y, btn_w_padded, btn_h, radius, inc_col, (false, r2, r3, false)));
         }
 
+        // Draw cursor if editing and rounded
+        if self.editing {
+            let char_width = 8.4;
+            let cursor_x = self.base.x + 4.0 + (self.cursor_idx as f32 * char_width);
+            let max_cursor_x = self.base.x + display_w - 4.0;
+            let final_cursor_x = cursor_x.min(max_cursor_x);
+            let cursor_y = self.base.y + top + (visual_h - 14.0) / 2.0;
+            quads.push((final_cursor_x, cursor_y, 1.5, 14.0, 0.0, [0.80, 0.80, 0.85, 1.0], (false, false, false, false)));
+        }
+
         quads
     }