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

commit277319ca70aabeb577a0439b3a99fd7ab863c03b
parentab1de60f4d
authorLucas Galante <[email protected]>
date2026-07-05 12:03
feat: render Ramp container background/border as rounded quads to prevent clipping children

 src/widget/input/ramp.rs | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/widget/input/ramp.rs b/src/widget/input/ramp.rs
index e306f7f..8d74a87 100644
--- a/src/widget/input/ramp.rs
+++ b/src/widget/input/ramp.rs
@@ -765,14 +765,6 @@ impl Element for Ramp {
         let track_x = self.base.x + 10.0;
         let track_w = self.base.w - 20.0;
         
-        let border_color = colors::ramp_border_color();
-        
-        // Draw container background (enclosing graph and dropdowns)
-        let ch = self.base.h - 20.0;
-        quads.push((track_x, self.base.y + 10.0, track_w, ch, [0.15, 0.15, 0.18, 1.0]));
-        // Draw container border
-        quads.push((track_x - 1.0, self.base.y + 10.0 - 1.0, track_w + 2.0, ch + 2.0, border_color));
-        
         // Draw grid lines
         for ratio in [0.25, 0.5, 0.75] {
             let gy = self.base.y + 10.0 + gh * (1.0 - ratio);
@@ -811,6 +803,34 @@ impl Element for Ramp {
         
         quads
     }
+
+    fn all_rounded_quads(&self, ctx: &UiContext) -> Vec<(f32, f32, f32, f32, f32, [f32; 4], (bool, bool, bool, bool))> {
+        if !self.visible() {
+            return Vec::new();
+        }
+        let mut quads = Vec::new();
+        
+        let track_x = self.base.x + 10.0;
+        let track_w = self.base.w - 20.0;
+        let ch = self.base.h - 20.0;
+        
+        let border_color = colors::ramp_border_color();
+        let bg_color = [0.15, 0.15, 0.18, 1.0];
+        let radius = 6.0f32;
+        
+        // Draw container border (rounded quad)
+        quads.push((track_x - 1.0, self.base.y + 10.0 - 1.0, track_w + 2.0, ch + 2.0, radius, border_color, (true, true, true, true)));
+        // Draw container background (rounded quad)
+        quads.push((track_x, self.base.y + 10.0, track_w, ch, (radius - 1.0).max(0.0), bg_color, (true, true, true, true)));
+        
+        // Extend children's rounded quads
+        for &child_ptr in &self.children(ctx) {
+            let widget = unsafe { &*child_ptr };
+            quads.extend(widget.all_rounded_quads(ctx));
+        }
+        
+        quads
+    }
     
     fn extra_circles(&self) -> Vec<(f32, f32, f32, [f32; 4])> {
         let mut circles = Vec::new();