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

commite4b9e98d4a7306cc85b8700bd434e13e18234c34
parent18b392fca1
authorLucas Galante <[email protected]>
date2026-07-01 17:16
Fix graph node text label disappearance when partially cut off on the left

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

diff --git a/src/widget/display/graph.rs b/src/widget/display/graph.rs
index d1479b3..5a32da1 100644
--- a/src/widget/display/graph.rs
+++ b/src/widget/display/graph.rs
@@ -292,7 +292,8 @@ impl Element for Graph {
                 let font_size = (14.0 * scale_f).clamp(6.0, 48.0);
                 let lx = nx + nw + 8.0 * scale_f;
                 let ly = crate::layout::align_text_y(ny, nh, font_size, 0.0);
-                if lx >= self.x && lx < self.x + self.w && ly >= self.y && ly < self.y + self.h {
+                let text_w = TextLabel::estimate_width(&node.name, font_size);
+                if lx + text_w >= self.x && lx < self.x + self.w && ly + font_size >= self.y && ly < self.y + self.h {
                     labels.push(TextLabel {
                         text: node.name.clone(),
                         x: lx,