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

commit1cc360c982c3ce12b2450237c625cd623817395f
parentce4e203d83
authorLucas Galante <[email protected]>
date2026-07-05 19:59
Use center_text_y layout helper for dropdown text and arrow alignment

 src/widget/input/dropdown.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/widget/input/dropdown.rs b/src/widget/input/dropdown.rs
index 26387a6..9d5c053 100644
--- a/src/widget/input/dropdown.rs
+++ b/src/widget/input/dropdown.rs
@@ -541,7 +541,7 @@ impl Element for Dropdown {
         let start_x = x + 8.0;
         let right_limit = x + w - 28.0; // 10px margin before the arrow
         let fade_start_x = (right_limit - 24.0).max(start_x); // Fade out over the last 24px
-        let text_y = self.base.y + top + (self.base.h - top - 12.0) / 2.0 - 1.0;
+        let text_y = crate::layout::center_text_y(self.base.y + top, self.base.h - top, 12.0);
         let tc = colors::dropdown_text_color();
         let default_color = [
             (colors::linear_to_srgb(tc[0]) * 255.0).round() as u8,
@@ -669,7 +669,7 @@ impl Element for Dropdown {
         labels.push(TextLabel {
             text: "▼".to_string(),
             x: x + w - 18.0,
-            y: self.base.y + top + (self.base.h - top - 10.0) / 2.0 - 1.0,
+            y: crate::layout::center_text_y(self.base.y + top, self.base.h - top, 10.0),
             font_size: 10.0,
             color: [0x83, 0x83, 0x8a],
         });