node-based graph editor
git clone https://git.lucas.co/cce-graph.git
fix: the View menu says its state in words, not with a check character
The View menu is a Dropdown, whose list draws rows as plain text with no
mark glyphs, so its "✓" (and the two-space pad for an unchecked row) was
a symbol drawn as a character in a fallback face. A switch row now names
what it will do (Show Grid / Hide Grid, Show / Hide Control Panel) and the
opacity in use reads "(current)". Rows are still dispatched by index.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/main.rs | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 60dc634..9a1fb94 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -344,13 +344,25 @@ fn save_project_to_kdl_path(path: &std::path::Path, state: &GraphProjectState) -
Ok(())
}
+/// The View menu's rows, dispatched by INDEX (`drain_view_menu`). It is a
+/// `Dropdown`, whose list draws its rows as plain text — no mark glyphs, as
+/// the shared context menu has — so a row says its state in words rather
+/// than wearing a check mark drawn as a character: a switch names what it will do,
+/// and the opacity in use reads "(current)".
fn get_view_options(show_grid: bool, opacity: f32, show_panel: bool) -> Vec<String> {
+ let opacity_row = |pct: u32, value: f32| {
+ if (opacity - value).abs() < 0.05 {
+ format!("Opacity: {pct}% (current)")
+ } else {
+ format!("Opacity: {pct}%")
+ }
+ };
vec![
- format!("{} Show Grid", if show_grid { "✓" } else { " " }),
- format!("{} Opacity: 95%", if (opacity - 0.95).abs() < 0.05 { "✓" } else { " " }),
- format!("{} Opacity: 75%", if (opacity - 0.75).abs() < 0.05 { "✓" } else { " " }),
- format!("{} Opacity: 50%", if (opacity - 0.50).abs() < 0.05 { "✓" } else { " " }),
- format!("{} Control Panel", if show_panel { "✓" } else { " " }),
+ if show_grid { "Hide Grid" } else { "Show Grid" }.to_string(),
+ opacity_row(95, 0.95),
+ opacity_row(75, 0.75),
+ opacity_row(50, 0.50),
+ if show_panel { "Hide Control Panel" } else { "Show Control Panel" }.to_string(),
]
}