From f86a360f394ff7cd634f995632bea2e23112129d Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Mon, 2 Dec 2024 18:48:30 +0100 Subject: [PATCH] correct slider handle placement --- src/ugui_slider.c3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ugui_slider.c3 b/src/ugui_slider.c3 index 6eae35b..0184553 100644 --- a/src/ugui_slider.c3 +++ b/src/ugui_slider.c3 @@ -24,7 +24,7 @@ fn ElemEvents! Ctx.slider_hor(&ctx, String label, Rect size) // 2. Layout c_elem.bounds = ctx.position_element(parent, size, true); c_elem.slider.handle = Rect{ - .x = (short)(c_elem.bounds.x + (int)(c_elem.bounds.w * c_elem.slider.value)), + .x = (short)(c_elem.bounds.x + (int)(c_elem.bounds.w*(1.0-0.25) * c_elem.slider.value)), .y = c_elem.bounds.y, .w = (short)(c_elem.bounds.w * 0.25), .h = c_elem.bounds.h, @@ -97,7 +97,7 @@ fn ElemEvents! Ctx.slider_ver(&ctx, String label, Rect size) c_elem.bounds = ctx.position_element(parent, size, true); c_elem.slider.handle = Rect{ .x = c_elem.bounds.x, - .y = (short)(c_elem.bounds.y + (int)(c_elem.bounds.h * c_elem.slider.value)), + .y = (short)(c_elem.bounds.y + (int)(c_elem.bounds.h*(1.0-0.25) * c_elem.slider.value)), .w = c_elem.bounds.w, .h = (short)(c_elem.bounds.h * 0.25), };