graphic design tool
git clone https://git.lucas.co/cce-designer.git
feat: node-domain opacity (style.surface.graph.node.opacity)
The graph's node domain — bodies, wires, connectors, toggles, and node
text — fades via the new cce-ui node opacity key, polled from config
alongside the pane opacity and fed to the Graph widget; node text alpha
in the frame text pass follows it instead of the pane's
network_opacity.
Co-Authored-By: Claude Fable 5 <[email protected]>
src/app.rs | 10 ++++++++++
src/render.rs | 10 +++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/app.rs b/src/app.rs
index 76b8b75..7530e73 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1005,6 +1005,9 @@ pub struct State {
pub active_menu_cloud_idx: Option<(usize, usize)>,
pub uniform_background: bool,
pub network_opacity: f32,
+ /// Node-domain opacity (style.surface.graph.node.opacity) — independent of
+ /// the pane's network_opacity; fades node bodies/wires/ports and node text.
+ pub node_opacity: f32,
pub last_design_mod_time: Option<std::time::SystemTime>,
pub last_config_mod_time: Option<std::time::SystemTime>,
pub floating_network_layout: (f32, f32, f32, f32),
@@ -2703,6 +2706,7 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
active_menu_cloud_idx: None,
uniform_background: false,
network_opacity: 0.95,
+ node_opacity: 1.0,
last_design_mod_time: {
let design_path = DesignSettings::file_path();
std::fs::metadata(&design_path).and_then(|m| m.modified()).ok()
@@ -2829,6 +2833,7 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
if let Some(graph) = self.slots.content.as_any_mut().downcast_mut::<cce_ui::widget::Graph>() {
graph.set_uniform_background(self.uniform_background);
graph.set_network_opacity(self.network_opacity);
+ graph.set_node_opacity(self.node_opacity);
graph.set_cell_color(self.cell_color);
graph.set_gap_color(self.gap_color);
}
@@ -2882,6 +2887,7 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
cce_ui::layout::reload_config();
let opacity = cce_ui::color::graph_opacity();
+ let node_opacity = cce_ui::color::graph_node_opacity();
let cell_color = cce_ui::color::graph_cell_color();
let gap_color = cce_ui::color::graph_gap_color();
let snap_enabled = cce_ui::layout::graph_grid_snap();
@@ -2894,6 +2900,10 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
self.network_opacity = opacity;
changed = true;
}
+ if (self.node_opacity - node_opacity).abs() > 0.001 {
+ self.node_opacity = node_opacity;
+ changed = true;
+ }
if self.cell_color != cell_color {
self.cell_color = cell_color;
changed = true;
diff --git a/src/render.rs b/src/render.rs
index 1b72b2c..2291771 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -472,7 +472,15 @@ impl State {
continue;
}
}
- let alpha = if is_network_part { self.network_opacity.clamp(0.0, 1.0) } else { 1.0 };
+ // Node text belongs to the node domain: it fades with
+ // node_opacity, not the pane's network_opacity.
+ let alpha = if is_node {
+ self.node_opacity.clamp(0.0, 1.0)
+ } else if is_network_part {
+ self.network_opacity.clamp(0.0, 1.0)
+ } else {
+ 1.0
+ };
pc.text_faded(text, x, y, font_size, color, alpha, font, merge_bounds(widget_bounds, label_bounds));
}
}