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

commit8cd9328345c856c4e1ca8c9c820ab4a64c8c7f1d
parent42b9ca1ad4
authorLucas Galante <[email protected]>
date2026-07-06 14:38
Fix dropdown text fade-out logic so it only fades when text overflows

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

diff --git a/src/widget/input/dropdown.rs b/src/widget/input/dropdown.rs
index 2599d41..7ee8716 100644
--- a/src/widget/input/dropdown.rs
+++ b/src/widget/input/dropdown.rs
@@ -714,7 +714,8 @@ impl Element for Dropdown {
 
             let char_mid_x = cur_x + c_w / 2.0;
             let mut skip_char = false;
-            let color = if char_mid_x > fade_start_x {
+            let text_end_x = start_x + total_advance;
+            let color = if text_end_x > right_limit && char_mid_x > fade_start_x {
                 let factor = ((char_mid_x - fade_start_x) / (right_limit - fade_start_x)).clamp(0.0, 1.0);
                 if factor >= 0.9 {
                     skip_char = true;