graphic design tool
git clone https://git.lucas.co/cce-designer.git
feat: a Show Points switch at the head of the viewport menu's points group
The existing toggle_render_points command as a marked row above the three
size sliders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md | 3 ++-
src/app.rs | 4 +++-
src/main.rs | 25 ++++++++++++++++++++++++-
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index 2ed2cc4..d068df3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1378,7 +1378,8 @@ multi-selection, so taking `Shift+L` now would have to be given back later.
The viewport's right-click menu carries the DISPLAY MODE under Frame All
and View 1:1, in three groups a separator apart — wireframe (switch,
-thickness), points (the three size sliders), surface (shading, opacity,
+thickness), points (Show Points and the three size sliders), surface
+(shading, opacity,
Show Occluded); `the_viewport_menu_groups_its_display_rows` holds the
order. The rows: the Show Wireframe switch (its registry command), **Flat
Shading / Smooth Shading** as a radio pair over `toggle_smooth_shading`,
diff --git a/src/app.rs b/src/app.rs
index 858c23f..2b23afb 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -4463,7 +4463,8 @@ impl State {
/// The viewport menu's rows and what each does, in groups a separator
/// apart: framing; the WIREFRAME (its switch and thickness); the POINTS
- /// (point size, point marker size, group marker scale); the SURFACE
+ /// (the Show Points switch, point size, point marker size, group marker
+ /// scale); the SURFACE
/// (flat or smooth shading as a radio pair, the polygon opacity, Show
/// Occluded — the three that decide how the fill itself reads); then
/// the editor pin. Split from the open so a test can read it. Marks are
@@ -4486,6 +4487,7 @@ impl State {
// Points.
row(&mut options, &mut actions, "-".into(), sep);
+ row(&mut options, &mut actions, format!("{} {}", mark(self.render_points), label("toggle_render_points", "Show Points")), ViewportMenuAction::Command("toggle_render_points"));
row(&mut options, &mut actions, "Point Size".into(), ViewportMenuAction::PointSizeSlider);
row(&mut options, &mut actions, "Point Marker Size".into(), ViewportMenuAction::PointMarkerSizeSlider);
row(&mut options, &mut actions, "Group Marker Scale".into(), ViewportMenuAction::GroupMarkerScaleSlider);
diff --git a/src/main.rs b/src/main.rs
index 9095932..c2a7813 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1658,7 +1658,10 @@ mod tests {
.collect();
assert_eq!(groups[0], vec![A::FrameAll, A::OneToOne]);
assert_eq!(groups[1], vec![A::Command("toggle_wireframe"), A::WireThicknessSlider]);
- assert_eq!(groups[2], vec![A::PointSizeSlider, A::PointMarkerSizeSlider, A::GroupMarkerScaleSlider]);
+ assert_eq!(
+ groups[2],
+ vec![A::Command("toggle_render_points"), A::PointSizeSlider, A::PointMarkerSizeSlider, A::GroupMarkerScaleSlider]
+ );
assert_eq!(
groups[3],
vec![A::Shading(false), A::Shading(true), A::OpacitySlider, A::Command("toggle_show_occluded")]
@@ -1667,6 +1670,26 @@ mod tests {
assert!(options.iter().zip(&actions).all(|(o, a)| (o == "-") == (*a == A::Separator)), "separator rows line up");
}
+ /// Show Points heads the Points group as a switch over the Render
+ /// points, marked from the live flag, and the row runs its command.
+ #[test]
+ fn the_viewport_menu_toggles_show_points() {
+ use crate::app::ViewportMenuAction as A;
+ let mut state = State::new(false);
+ state.render_points = false;
+ let row = |state: &State| {
+ let (options, actions) = state.viewport_menu_rows();
+ let i = actions.iter().position(|a| *a == A::Command("toggle_render_points")).expect("a Show Points row");
+ options[i].clone()
+ };
+ assert_eq!(row(&state), "○ Show Points");
+ state.run_viewport_menu_action(A::Command("toggle_render_points"));
+ assert!(state.render_points);
+ assert_eq!(row(&state), "● Show Points");
+ let kdl = fs::read_to_string(crate::app::DesignSettings::file_path()).expect("saved");
+ assert!(crate::app::DesignSettings::from_kdl_str(&kdl).render.render_points, "persisted");
+ }
+
/// Wire Thickness is a slider row right under Show Wireframe, over the
/// palette row's 1–8 px: the wheel steps half a pixel and saves, a press
/// on the band jumps, and the value is the live `wire_width` the wire