git.lucas.co / cce-color-editor
color picker and palette editor
git clone https://git.lucas.co/cce-color-editor.git

commit45a49cc40542a5a90b22c4472a89bca323dc6efc
parenta8227e721c
authorLucas Galante <[email protected]>
date2026-06-26 17:30
Loosen hover check in ColorSlider mouse_wheel to use the full widget bounds

 src/main.rs | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 8322378..2805b37 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -305,12 +305,8 @@ impl Element for ColorSlider {
 
     fn mouse_wheel(&mut self, delta: &MouseScrollDelta, px: f32, py: f32, _ctx: &mut UiContext) -> bool {
         let (x, y, w, h) = self.rect();
-        let track_x = x + SLIDER_TRACK_X;
-        let track_w = w - SLIDER_TRACK_X - 68.0;
-        let track_h = SLIDER_TRACK_H;
-        let track_y = y + (h - track_h) / 2.0;
 
-        if px >= track_x && px <= track_x + track_w && py >= track_y && py <= track_y + track_h {
+        if px >= x && px <= x + w && py >= y && py <= y + h {
             let scroll_amount = match delta {
                 MouseScrollDelta::LineDelta(_x, y) => *y,
                 MouseScrollDelta::PixelDelta(pos) => pos.y as f32 / 120.0,