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

commit3dee72ea190d58db8ebccaafc9dfa5bce8a42acf
parent4d7ad2d908
authorLucas Galante <[email protected]>
date2026-07-05 15:14
fix: implement set_rect override for RangeSlider to fix negative height offset bug

 src/layout.rs              | 9 +++++++++
 src/widget/input/slider.rs | 7 +++++++
 2 files changed, 16 insertions(+)

diff --git a/src/layout.rs b/src/layout.rs
index 733724f..baa2600 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -840,6 +840,15 @@ pub fn reload_config() {
                     }
                 }
             }
+            if let Some(rest) = trimmed.strip_prefix("rangeslider_height") {
+                let rest = rest.trim_start_matches(|c: char| c == ' ' || c == '=' || c == '"');
+                let val_str = rest.trim_end_matches('"').trim();
+                if let Ok(val) = val_str.parse::<f32>() {
+                    if let Ok(mut lock) = RANGESLIDER_HEIGHT.write() {
+                        *lock = val;
+                    }
+                }
+            }
             if let Some(rest) = trimmed.strip_prefix("button_corner_radius") {
                 let rest = rest.trim_start_matches(|c: char| c == ' ' || c == '=' || c == '"');
                 let val_str = rest.trim_end_matches('"').trim();
diff --git a/src/widget/input/slider.rs b/src/widget/input/slider.rs
index a6650bf..626a54c 100644
--- a/src/widget/input/slider.rs
+++ b/src/widget/input/slider.rs
@@ -583,6 +583,13 @@ impl RangeSlider {
 impl Element for RangeSlider {
     crate::impl_widget_base!(RangeSlider);
 
+    fn set_rect(&mut self, x: f32, y: f32, w: f32, h: f32) {
+        self.base.x = x;
+        self.base.y = y;
+        self.base.w = w;
+        self.base.h = h + self.base.label_offset();
+    }
+
     fn color(&self) -> [f32; 4] { [0.0, 0.0, 0.0, 0.0] }
 
     fn preferred_height(&self) -> Option<f32> {