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

commited40b88120a10c9bbbc31e568045d6e260679a9b
parent405284b6be
authorLucas Galante <[email protected]>
date2026-08-24 14:35
graph: the geometry toggle is a single-color circle

The two-tone square (state square inside a hover-tinted well) becomes one
circle in TOGGLE_ON, drawn through the circles channel next to the port
dots: full alpha when the node's geometry is visible, the same color at a
quarter alpha when hidden, and hover grows the radius the way port dots do
instead of adding a second tint. Both render views inherit it (the flat
tagged-quads path lost the toggle quads; rounded_geometry derives from it).
Hit-testing keeps toggle_rect's square, circle inscribed.

Pixel-verified: visible toggle (104,218,166), hidden (72,125,104) — same
hue, alpha apart — and the toggled node's geometry left the viewport.

 src/widget/display/graph.rs | 44 ++++++++++++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/src/widget/display/graph.rs b/src/widget/display/graph.rs
index 90e8386..42ab0f1 100644
--- a/src/widget/display/graph.rs
+++ b/src/widget/display/graph.rs
@@ -509,22 +509,12 @@ impl Graph {
                     quads.push((nx, ny, nw, nh, bg_color, None));
                 }
 
-                if let Some((tx, ty, tw, th)) = self.toggle_rect(i) {
-                    let mut btn_color = if self.toggle_hovered_idx == Some(i) {
-                        colors::TOGGLE_HOVER
-                    } else {
-                        colors::TOGGLE_OFF
-                    };
-                    btn_color[3] *= self.node_opacity;
-                    push_clipped(tx, ty, tw, th, btn_color, &mut quads);
-
-                    if self.nodes[i].geom_visible {
-                        let inset = 3.0 * scale_f;
-                        let mut toggle_on_color = colors::TOGGLE_ON;
-                        toggle_on_color[3] *= self.node_opacity;
-                        push_clipped(tx + inset, ty + inset, tw - inset * 2.0, th - inset * 2.0, toggle_on_color, &mut quads);
-                    }
-                }
+                // The geometry toggle is a single-color circle now — it draws
+                // through the circles channel (see port_circles), not as
+                // quads: a filled dot when the geometry is visible, the same
+                // color faded when hidden. The old look was a two-tone square
+                // (state square inside a hover-tinted well).
+                let _ = scale_f;
             }
         }
 
@@ -592,6 +582,28 @@ impl Graph {
             }
         };
 
+        // Geometry toggles: one circle per toggleable node, a SINGLE color —
+        // TOGGLE_ON at full alpha when visible, the same color faded when
+        // hidden; hover grows the radius the way port dots do, so no second
+        // hover tint is needed. Hit-testing stays toggle_rect's square (the
+        // circle is inscribed in it).
+        for i in 0..self.nodes.len() {
+            if let Some((tx, ty, tw, th)) = self.toggle_rect(i) {
+                let cx = tx + tw / 2.0;
+                let cy = ty + th / 2.0;
+                let mut r = tw.min(th) / 2.0;
+                if self.toggle_hovered_idx == Some(i) {
+                    r *= 1.15;
+                }
+                let mut c = colors::TOGGLE_ON;
+                if !self.nodes[i].geom_visible {
+                    c[3] *= 0.25;
+                }
+                c[3] *= self.node_opacity;
+                push_circle_clipped(cx, cy, r, c);
+            }
+        }
+
         let conn_size = crate::layout::graph_connector_size();
         let mut conn_color = colors::graph_connector_color();
         let mut conn_hl_color = colors::graph_connector_highlight_color();