From 4daef561c8d148f1a2237c43a9ea85c00741ec47 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 20 Nov 2026 05:30:30 -0800 Subject: [PATCH] Live Corners: a live rectangle or polygon selected whole shows the Corners link With Direct Selection, one live rectangle or live polygon selected whole now shows the Corners link in the Properties panel beside its own rows. Before, the panel showed the link only while an anchor of the shape was selected. The pop-up sets every corner of the shape. A path with Live Corners selected whole still shows no corner rows. --- crates/ui-egui/src/panels/properties.rs | 4 +-- crates/ui-egui/src/panels/properties/tests.rs | 32 +++++++++++++++++++ docs/mcp.md | 2 +- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 0c2313c8f0..26b4729f8f 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -211,7 +211,7 @@ fn can_merge_live_paint(app: &VectorcraftApp) -> bool { /// and the Corners link opens the corner settings /// (). One live /// rectangle or live polygon selected alone has its own kind and radius rows, which already set -/// the selected corners: it shows the Corners link alone. +/// the selected corners: it shows the Corners link alone, also while it is selected whole. fn corner_rows(app: &mut VectorcraftApp, ui: &mut Ui) { if app.session.tool_id() != "directSelection" { return; @@ -223,7 +223,7 @@ fn corner_rows(app: &mut VectorcraftApp, ui: &mut Ui) { let corner_selected = st.selection.objects.iter().any(|id| { st.doc.node(*id).and_then(LiveCorners::of).is_some_and(|lc| st.selection.partial(*id).is_some_and(|a| !lc.corners_of(a).is_empty())) }); - if !corner_selected { + if !own_rows && !corner_selected { return; } let Some(picked) = super::picked_corners(app) else { return }; diff --git a/crates/ui-egui/src/panels/properties/tests.rs b/crates/ui-egui/src/panels/properties/tests.rs index 668bb97d2a..8d2ef2973e 100644 --- a/crates/ui-egui/src/panels/properties/tests.rs +++ b/crates/ui-egui/src/panels/properties/tests.rs @@ -1588,6 +1588,38 @@ fn direct_selected_corners_show_their_kind_and_radius() { assert!(LiveCorners::of(&n).unwrap().radii_relative()); } +/// With Direct Selection, a live rectangle or live polygon selected whole keeps its own rows and +/// shows the Corners link, whose pop-up sets every corner of the shape. A path with Live Corners +/// selected whole shows no corner rows. +#[test] +fn a_whole_live_shape_with_direct_selection_shows_the_corners_link() { + let mut app = new_app(); + let ctx = egui::Context::default(); + app.select_tool("directSelection"); + let r = rect(&mut app, 20.0, 20.0, 60.0, 40.0).as_u64().unwrap(); + let polygon = app.run("shape.polygon", json!({"cx": 200, "cy": 150, "radius": 50, "sides": 5})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [polygon]})).unwrap(); + let texts = tall(&mut app, &ctx, vec![]); + assert_eq!(texts.iter().filter(|(t, _)| t == "Corners").count(), 1, "polygon: {texts:?}"); + app.run("select.set", json!({"ids": [r]})).unwrap(); + let texts = tall(&mut app, &ctx, vec![]); + assert_eq!(texts.iter().filter(|(t, _)| t == "Corners").count(), 1, "rectangle: {texts:?}"); + assert_eq!(texts.iter().filter(|(t, _)| t == "Corner Radius:").count(), 1, "{texts:?}"); + // The pop-up's rounding: Relative on the rectangle. + let texts = press(&mut app, &ctx, text_at(&texts, "Corners").center()); + let depth = undo_depth(&app); + press(&mut app, &ctx, text_at(&texts, "Relative").center()); + assert_eq!(undo_depth(&app), depth + 1, "one undo step"); + let n = app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(r)).unwrap().clone(); + assert!(LiveCorners::of(&n).unwrap().radii_relative()); + // A plain path selected whole: no corner selected. + let path = square_path(&mut app, 200.0); + app.select_tool("directSelection"); + app.run("select.set", json!({"ids": [path]})).unwrap(); + let texts = tall(&mut app, &ctx, vec![]); + assert!(!shows(&texts, "Corner:") && !shows(&texts, "Corners"), "{texts:?}"); +} + /// A square path, not a live shape, its top-left corner at (`x`, 50) → its id. fn square_path(app: &mut VectorcraftApp, x: f64) -> u64 { let id = rect(app, x, 50.0, 100.0, 100.0); diff --git a/docs/mcp.md b/docs/mcp.md index a4b4a75882..e3f051ddc4 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -7703,7 +7703,7 @@ on them. `on`, when given and not `null`, must be `true` or `false` and sets the command toggles. The reply is the new state (`true` when shown, the default). The bounding box, the center point and Direct Selection's corner widgets, which follow `view.cornerWidget` alone, stay as they are, and no undo step is added. In the desktop app, the Corners link in the Control bar (beside the anchor controls) and in the Properties panel (with -Direct Selection, while a corner is selected) opens the Corners pop-up for the picked corners of every selected path: +Direct Selection, while a corner is selected or one live rectangle or polygon is selected) opens the Corners pop-up for the picked corners of every selected path: the corners holding a Direct-Selected anchor, or every corner of a path selected whole; a path whose selected anchors hold no corner is left out. The pop-up has the corner kind, the radius (blank while the picked corners differ) and the rounding, Relative or Absolute (`relativeRadii`, which applies to each path as a whole; neither is chosen while the