From 5dcc0008ee4e4f9471d6fa937a19899f5fece882 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 19:27:20 -0800 Subject: [PATCH 1/5] Transform: Rectangle Properties has a Corner menu for the corner type A live rectangle's Rectangle Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) now have a Corner menu with Round, Inverted Round and Chamfer. - With Corner Radius linked, one menu sets the kind of every corner of each selected live rectangle, corners with no radius included, and leaves the radii as they are. It is blank when the shown rectangle's corners have different kinds. - With Corner Radius unlinked, each corner's row has its own menu beside its radius field, or under it when the panel is too narrow for both. - The menus and the unlinked radius fields change only the selected live rectangles; other selected paths and polygons are left as they are. Before, a radius typed into an unlinked corner field also rounded that anchor index on every other selected path. - A pick is one undo step, and picking the kind the corners already have adds none. --- crates/engine/src/tests/livecorners.rs | 22 +++ crates/ui-egui/src/panels.rs | 84 +++++++++-- crates/ui-egui/src/panels/transform/tests.rs | 31 +++++ crates/ui-egui/src/tests/taskbar.rs | 138 +++++++++++++++++++ docs/target-app-parity.md | 1 + 5 files changed, 268 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/tests/livecorners.rs b/crates/engine/src/tests/livecorners.rs index b9e3793913..9881f30e88 100644 --- a/crates/engine/src/tests/livecorners.rs +++ b/crates/engine/src/tests/livecorners.rs @@ -59,6 +59,28 @@ fn a_whole_rectangle_rounds_all_corners_and_given_corners_alone() { assert_eq!(corners(&s, id).1[3], CornerKind::Chamfer); } +/// The Corner menus of Rectangle Properties: a kind for all four corners or one, set on corners +/// with no radius too and leaving the radii as they are, in one undo step; the kind the corners +/// already have adds no step. +#[test] +fn rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo() { + let (mut s, id) = session(); + run(&mut s, json!({"corners": [1], "radius": 12})); + let steps = |s: &Session| s.doc().unwrap().history.undo.len(); + let undo = steps(&s); + run(&mut s, json!({"corners": [0, 1, 2, 3], "kind": "invertedRound"})); + assert_eq!(corners(&s, id).0, [0.0, 12.0, 0.0, 0.0]); + assert_eq!(corners(&s, id).1, [CornerKind::InvertedRound; 4]); + assert_eq!(steps(&s), undo + 1); + run(&mut s, json!({"corners": [0, 1, 2, 3], "kind": "invertedRound"})); + run(&mut s, json!({"corners": [2], "kind": "invertedRound"})); + assert_eq!(steps(&s), undo + 1, "no step when nothing changes"); + run(&mut s, json!({"corners": [2], "kind": "chamfer"})); + assert_eq!(corners(&s, id).1, [CornerKind::InvertedRound, CornerKind::InvertedRound, CornerKind::Chamfer, CornerKind::InvertedRound]); + assert_eq!(corners(&s, id).0, [0.0, 12.0, 0.0, 0.0]); + assert_eq!(steps(&s), undo + 2); +} + /// #938: `items` rounds several objects in one step, each its own corners (or all of them). #[test] fn items_round_several_objects_each_its_own_corners() { diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index aa07b13a90..50db13e13b 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -54,7 +54,7 @@ pub mod variables; use egui::{Rect, Sense, Ui, vec2}; use serde_json::{Value, json}; use vectorcraft_color::{BlendMode, Color, Paint}; -use vectorcraft_doc::{LiveCorners, Node, NodeId, NodeKind, StrokeLayer}; +use vectorcraft_doc::{LiveCorners, LiveShape, Node, NodeId, NodeKind, StrokeLayer}; use vectorcraft_engine::inspect::StrokeMixed; use vectorcraft_geom::shapes::CornerKind; @@ -89,8 +89,9 @@ pub(crate) fn field_width(ui: &Ui) -> f32 { } /// The Corner Radius field of a live rectangle's properties: [`corner_radius`], which a new value -/// sets on those corners. The link behind it is the `singleCornerRadius` preference: off, a field -/// for each of the four corners follows, each setting its own corner. +/// sets on those corners. The link behind it is the `singleCornerRadius` preference: on, a Corner +/// menu follows that sets the kind of all four corners; off, a row for each of the four corners +/// follows, each with a radius field and a Corner menu that set its own corner. pub(crate) fn corner_radius_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, id: &str) { let fw = field_width(ui); let single = app.session.prefs.single_corner_radius; @@ -104,27 +105,94 @@ pub(crate) fn corner_radius_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, transform::set_pref(app, "singleCornerRadius", !single); } }); - if !single { + if single { + corner_kind_row(app, ui, n, id, fw); + } else { corner_fields(app, ui, n, id, fw); } } +/// The Corner menu of a live rectangle whose corners share one radius field: the kind of all four +/// corners, also while some of them are Direct-Selected, blank when they differ. A pick sets it on +/// every corner of each selected live rectangle ([`set_rectangle_kinds`]). +fn corner_kind_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, id: &str, width: f32) { + let Some(lc) = LiveCorners::of(n) else { return }; + let current = lc.style(&lc.all()).1; + ui.horizontal(|ui| { + dim_label(ui, tl!("Corner:")); + if let Some(kind) = corner_kind_menu(ui, (id, "kind"), tl!("Corner:"), current, width) { + set_rectangle_kinds(app, kind, None); + } + }); +} + +/// Set `kind` on corner `corner` (every corner for None) of each selected live rectangle +/// ([`set_rectangle_corners`]). +fn set_rectangle_kinds(app: &mut VectorcraftApp, kind: CornerKind, corner: Option) { + set_rectangle_corners(app, json!({"kind": kind}), corner); +} + +/// Run `object.setLiveShape` with `p` (a `kind` or `radius`) on corner `corner` (every corner for +/// None) of each selected live rectangle, leaving other selected objects as they are: one undo +/// step, or none when nothing changes. +fn set_rectangle_corners(app: &mut VectorcraftApp, mut p: Value, corner: Option) { + let corners = corner.map_or(json!([0, 1, 2, 3]), |k| json!([k])); + match app.session.active() { + // The command refuses the selection, with its message, while part of a symbol's art is + // selected. + Some(st) if st.selection.symbol_part.is_some() => p["corners"] = corners, + Some(st) => { + let is_rectangle = |n: &Node| matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Rectangle { .. })); + let rectangle = |id: &&NodeId| st.doc.node(**id).is_some_and(is_rectangle); + let items: Vec = st.selection.objects.iter().filter(rectangle).map(|id| json!({"id": id.0, "corners": corners})).collect(); + p["items"] = json!(items); + } + None => return, + } + if let Err(e) = app.run("object.setLiveShape", p) { + app.status(e); + } +} + +/// A menu of the corner kinds, `width` wide, showing `current` (blank for None) and named `name` +/// for screen readers. Returns the kind picked. +fn corner_kind_menu(ui: &mut Ui, id: impl std::hash::Hash, name: &str, current: Option, width: f32) -> Option { + let names: Vec<&str> = CornerKind::ALL.iter().map(|k| crate::dialogs::corners::kind_label(*k)).collect(); + let shown = current.map_or("", crate::dialogs::corners::kind_label); + crate::widgets::dropdown_names_named(ui, id, Some(name), shown, &names, width).and_then(|i| CornerKind::ALL.get(i).copied()) +} + /// The corners of a live rectangle in the order their fields show, with their labels. fn rectangle_corners() -> [(usize, &'static str); 4] { [(0, tl!("Top Left:")), (1, tl!("Top Right:")), (2, tl!("Bottom Right:")), (3, tl!("Bottom Left:"))] } -/// One Corner Radius field per corner of a live rectangle, each on its own row with its label, -/// the fields in line. +/// One Corner Radius field and one Corner menu per corner of a live rectangle, each pair on its own +/// row with the corner's label, the fields and menus in line; in a panel too narrow for that, each +/// menu goes on the row under its field. A value typed or a kind picked is set on that corner +/// alone, of each selected live rectangle ([`set_rectangle_corners`]). fn corner_fields(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, id: &str, width: f32) { let Some(lc) = LiveCorners::of(n) else { return }; let unit = app.session.general_unit(); - egui::Grid::new((id, "corners")).num_columns(2).spacing(vec2(6.0, 4.0)).show(ui, |ui| { + let widest = |names: &mut dyn Iterator| names.map(|t| crate::widgets::dim_label_width(ui, t)).fold(0.0, f32::max); + let labels = widest(&mut rectangle_corners().into_iter().map(|(_, label)| label)); + // The longest kind name, with the room the menu's button gives around it and its arrow. + let menu_width = width.max(widest(&mut CornerKind::ALL.into_iter().map(crate::dialogs::corners::kind_label)) + 26.0); + // The two gaps between the grid's three columns are 6 points each. + let in_line = labels + width + menu_width + 12.0 <= ui.available_width(); + egui::Grid::new((id, "corners")).num_columns(if in_line { 3 } else { 2 }).spacing(vec2(6.0, 4.0)).show(ui, |ui| { for (k, label) in rectangle_corners() { dim_label(ui, label); if let Some(v) = crate::widgets::num_field_named(ui, (id, "corner", k), Some(label), Some(lc.radius(k)), unit, width) { // A negative radius typed in rounds nothing: the command takes 0 or more. - app.run("object.setLiveShape", json!({"radius": v.max(0.0), "corners": [k]})).ok(); + set_rectangle_corners(app, json!({"radius": v.max(0.0)}), Some(k)); + } + if !in_line { + ui.end_row(); + ui.label(""); + } + if let Some(kind) = corner_kind_menu(ui, (id, "kind", k), label, Some(lc.kind(k)), menu_width) { + set_rectangle_kinds(app, kind, Some(k)); } ui.end_row(); } diff --git a/crates/ui-egui/src/panels/transform/tests.rs b/crates/ui-egui/src/panels/transform/tests.rs index 3dff8e6a4b..a25a2db37d 100644 --- a/crates/ui-egui/src/panels/transform/tests.rs +++ b/crates/ui-egui/src/panels/transform/tests.rs @@ -107,6 +107,37 @@ fn a_polygon_shows_its_polygon_properties() { assert!(live(&app).polygon_sides_equal()); } +/// A live rectangle's Rectangle Properties show one Corner menu for all four corners while Corner +/// Radius is linked, blank when the corners' kinds differ, and one per corner when it is unlinked, +/// in the Transform panel and the Properties panel's Transform section. +#[test] +fn a_rectangle_shows_linked_and_unlinked_corner_types() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + app.run("shape.rectangle", json!({"x": 50, "y": 50, "width": 120, "height": 80, "radius": 10})).unwrap(); + let count = |shown: &[String], t: &str| shown.iter().filter(|s| *s == t).count(); + let draws = [show as fn(&mut VectorcraftApp, &mut Ui), crate::panels::properties::transform_section]; + set_pref(&mut app, "singleCornerRadius", true); + for draw in draws { + let shown = texts(&mut app, draw); + assert_eq!((count(&shown, "Corner:"), count(&shown, "Round")), (1, 1), "{shown:?}"); + } + // Kinds that differ leave the linked menu blank. + app.run("object.setLiveShape", json!({"kind": "chamfer", "corners": [2]})).unwrap(); + for draw in draws { + let shown = texts(&mut app, draw); + assert_eq!((count(&shown, "Corner:"), count(&shown, "Round"), count(&shown, "Chamfer")), (1, 0, 0), "{shown:?}"); + } + set_pref(&mut app, "singleCornerRadius", false); + for draw in draws { + let shown = texts(&mut app, draw); + for t in ["Top Left:", "Top Right:", "Bottom Right:", "Bottom Left:"] { + assert_eq!(count(&shown, t), 1, "{t} in {shown:?}"); + } + assert_eq!((count(&shown, "Round"), count(&shown, "Chamfer")), (3, 1), "{shown:?}"); + } +} + /// #3451: a live ellipse shows pie start/end angles and Invert Pie in the Transform panel and /// the Properties panel's Transform section; typed angles update the shape. #[test] diff --git a/crates/ui-egui/src/tests/taskbar.rs b/crates/ui-egui/src/tests/taskbar.rs index 8230969c97..25999c1148 100644 --- a/crates/ui-egui/src/tests/taskbar.rs +++ b/crates/ui-egui/src/tests/taskbar.rs @@ -565,6 +565,144 @@ fn the_shape_properties_popup_keeps_its_corner_dropdown() { assert!(!kinds.is_empty() && kinds.iter().all(|k| *k == vectorcraft_geom::shapes::CornerKind::Chamfer), "{kinds:?}"); } +/// A rectangle's Corner menu in the popup sets the kind of all four corners in one undo step while +/// Corner Radius is linked; picking the kind they already have adds no step. Unlinked, each +/// corner's menu sets that corner alone. +#[test] +fn the_shape_properties_popup_changes_a_rectangle_corner_type() { + use vectorcraft_geom::shapes::CornerKind::{Chamfer, Round}; + let mut app = app(); + app.run("tool.select", json!({"tool": "selection"})).unwrap(); + app.run("prefs.set", json!({"key": "singleCornerRadius", "value": true})).unwrap(); + let rect = id(app.run("shape.rectangle", json!({"x": 40, "y": 40, "width": 80, "height": 60, "radius": 10})).unwrap()); + select(&mut app, &[rect]); + let kinds = |app: &VectorcraftApp| match live(app, rect) { + vectorcraft_doc::LiveShape::Rectangle { kinds, radii, .. } => (kinds, radii), + l => panic!("{l:?}"), + }; + let steps = |app: &VectorcraftApp| app.session.active().unwrap().history.undo.len(); + let (ctx, texts) = click_lock_slot(&mut app); + let click = |app: &mut VectorcraftApp, p: Pos2| { + let press = |pressed| Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(app, &ctx, vec![Event::PointerMoved(p), press(true), press(false)]); + frame(app, &ctx, vec![]) + }; + // The open list's entry for `name`, drawn after the closed menu that may show the same name. + let entry = |texts: &[(String, Rect)], name: &str| texts.iter().rev().find(|(t, _)| t == name).map(|(_, r)| r.center()).unwrap(); + let before = steps(&app); + let texts = click(&mut app, at(&texts, "Round")); + let texts = click(&mut app, entry(&texts, "Chamfer")); + assert_eq!(kinds(&app), ([Chamfer; 4], [10.0; 4]), "all four corners, radii kept"); + assert_eq!(steps(&app), before + 1, "one undo step"); + let texts = click(&mut app, at(&texts, "Chamfer")); + click(&mut app, entry(&texts, "Chamfer")); + assert_eq!(steps(&app), before + 1, "the same kind adds no undo step"); + + app.run("prefs.set", json!({"key": "singleCornerRadius", "value": false})).unwrap(); + let texts = frame(&mut app, &ctx, vec![]); + assert_eq!(texts.iter().filter(|(t, _)| t == "Chamfer").count(), 4, "{texts:?}"); + // The first menu is the top left corner's. + let texts = click(&mut app, at(&texts, "Chamfer")); + click(&mut app, entry(&texts, "Round")); + assert_eq!(kinds(&app), ([Round, Chamfer, Chamfer, Chamfer], [10.0; 4])); + assert_eq!(steps(&app), before + 2); + app.run("edit.undo", json!({})).unwrap(); + assert_eq!(kinds(&app).0, [Chamfer; 4]); +} + +/// One Transform panel frame `width` points wide: the texts drawn, with their rectangles. +fn panel_frame(app: &mut VectorcraftApp, ctx: &egui::Context, width: f32, events: Vec) -> Vec<(String, Rect)> { + let screen = Rect::from_min_size(Pos2::ZERO, vec2(width, 700.0)); + let input = egui::RawInput { screen_rect: Some(screen), events, ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| crate::panels::transform::show(app, ui)); + out.textures_delta.clear(); + shapes_text(&out.shapes.iter().map(|c| c.shape.clone()).collect::>()) +} + +/// With several rectangles selected, the linked Corner menu sets the kind on every corner of each +/// of them, also when the rectangle the panel shows already has it, and leaves a selected polygon +/// as it is. +#[test] +fn the_linked_corner_menu_sets_every_selected_rectangle() { + use vectorcraft_geom::shapes::CornerKind::{Chamfer, Round}; + let mut app = app(); + app.run("prefs.set", json!({"key": "singleCornerRadius", "value": true})).unwrap(); + let a = id(app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 80, "height": 60, "radius": 8})).unwrap()); + let b = id(app.run("shape.rectangle", json!({"x": 200, "y": 20, "width": 80, "height": 60, "radius": 8})).unwrap()); + let polygon = id(app.run("shape.polygon", json!({"cx": 200, "cy": 200, "radius": 40, "sides": 6})).unwrap()); + app.run("object.setLiveShape", json!({"ids": [a], "kind": "chamfer"})).unwrap(); + select(&mut app, &[a, b, polygon]); + let kinds = |app: &VectorcraftApp, id: u64| match live(app, id) { + vectorcraft_doc::LiveShape::Rectangle { kinds, .. } => kinds, + l => panic!("{l:?}"), + }; + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let click = |app: &mut VectorcraftApp, p: Pos2| { + let press = |pressed| Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Default::default() }; + panel_frame(app, &ctx, 300.0, vec![Event::PointerMoved(p), press(true), press(false)]); + panel_frame(app, &ctx, 300.0, vec![]) + }; + panel_frame(&mut app, &ctx, 300.0, vec![]); + let texts = panel_frame(&mut app, &ctx, 300.0, vec![]); + let steps = app.session.active().unwrap().history.undo.len(); + let texts = click(&mut app, at(&texts, "Chamfer")); + let entry = texts.iter().rev().find(|(t, _)| t == "Chamfer").map(|(_, r)| r.center()).unwrap(); + click(&mut app, entry); + assert_eq!((kinds(&app, a), kinds(&app, b)), ([Chamfer; 4], [Chamfer; 4])); + let vectorcraft_doc::LiveShape::Polygon { kinds: sides, .. } = live(&app, polygon) else { panic!("not a polygon") }; + assert!(sides.iter().all(|k| *k == Round), "the polygon keeps its corners: {sides:?}"); + assert_eq!(app.session.active().unwrap().history.undo.len(), steps + 1, "one undo step"); + app.run("edit.undo", json!({})).unwrap(); + assert_eq!(kinds(&app, b), [Round; 4]); +} + +/// Unlinked, a corner's radius field rounds that corner of each selected rectangle and leaves a +/// selected polygon as it is. +#[test] +fn an_unlinked_corner_radius_leaves_other_selected_shapes() { + let mut app = app(); + app.run("prefs.set", json!({"key": "singleCornerRadius", "value": false})).unwrap(); + let rect = id(app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 80, "height": 60, "radius": 7})).unwrap()); + let polygon = id(app.run("shape.polygon", json!({"cx": 200, "cy": 200, "radius": 40, "sides": 6})).unwrap()); + select(&mut app, &[rect, polygon]); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + panel_frame(&mut app, &ctx, 300.0, vec![]); + let texts = panel_frame(&mut app, &ctx, 300.0, vec![]); + // The top left corner's field is the first that shows the radius. + let p = at(&texts, "7 pt"); + let press = |pressed| Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Default::default() }; + panel_frame(&mut app, &ctx, 300.0, vec![Event::PointerMoved(p), press(true), press(false)]); + panel_frame(&mut app, &ctx, 300.0, vec![]); + panel_frame(&mut app, &ctx, 300.0, vec![Event::Text("15".into())]); + let enter = Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }; + panel_frame(&mut app, &ctx, 300.0, vec![enter]); + panel_frame(&mut app, &ctx, 300.0, vec![]); + let vectorcraft_doc::LiveShape::Rectangle { radii, .. } = live(&app, rect) else { panic!("not a rectangle") }; + assert_eq!(radii, [15.0, 7.0, 7.0, 7.0]); + let vectorcraft_doc::LiveShape::Polygon { radii, .. } = live(&app, polygon) else { panic!("not a polygon") }; + assert!(radii.iter().all(|r| *r == 0.0), "the polygon keeps its corners: {radii:?}"); +} + +/// Unlinked, the four corner rows keep their Corner menus inside a panel at its narrowest. +#[test] +fn the_unlinked_corner_menus_fit_a_narrow_panel() { + let mut app = app(); + app.run("prefs.set", json!({"key": "singleCornerRadius", "value": false})).unwrap(); + let rect = id(app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 80, "height": 60, "radius": 8})).unwrap()); + app.run("object.setLiveShape", json!({"ids": [rect], "kind": "invertedRound"})).unwrap(); + select(&mut app, &[rect]); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let width = 220.0; + panel_frame(&mut app, &ctx, width, vec![]); + let texts = panel_frame(&mut app, &ctx, width, vec![]); + let menus: Vec<_> = texts.iter().filter(|(t, _)| t.starts_with("Inverted")).collect(); + assert_eq!(menus.len(), 4, "{texts:?}"); + assert!(menus.iter().all(|(_, r)| r.right() <= width), "{menus:?}"); +} + /// Every other selection keeps Lock: a plain closed path, a star (a plain path), a path with live /// corners, a group and several objects. The Direct Selection tool keeps it for a basic shape. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ef83de54ad..d2a5785c39 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1301,6 +1301,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur With Direct Selection, Shift pressed during the drag of a curved segment keeps both of its handles at right angles to the line between its anchors, on the same side and at the same length (`path.reshapeSegment {perpendicular}`). Shift held while any segment is dragged with the Anchor Point tool or the Pen with Alt does the same. With the Anchor Point tool, Shift held at the press on an anchor (or a selected blend's spine point) moves it, handles and all, instead of pulling out handles; Shift kept down keeps the move at 45° steps, and a Shift-click that doesn't move leaves the anchor as it was (`path.moveAnchor`). A selected blend spine's segment dragged with the Anchor Point tool, or a curved one dragged with Direct Selection, bends the same way (`object.blend.spine.reshapeSegment`). - **Live Corners:** drag a live rectangle's corner widgets (Selection or Direct Selection) to round all corners, with a radius readout; with Direct Selection, select corner anchors to show and round just those corners (#381). Each corner keeps its own radius and kind (Round, Inverted Round, Chamfer): Alt-click a widget to cycle the kind, double-click it for the Corners dialog, and the Properties and Transform radius fields set the selected corners (`object.setLiveShape {corners, radius, kind}`). A link toggle behind Corner Radius (the `singleCornerRadius` preference) switches the panels to a field for each corner of a live rectangle: Top Left, Top Right, Bottom Right and Bottom Left. Corners stay circular when the rectangle is scaled unevenly or along its own sides when rotated (the radius keeps its size, or scales by the mean scale with Scale Corners on); only a shear distorts them. On a rectangle that isn't square every corner is the same circle: a radius past half the shorter side stops there for all of them, the widgets sit on the corners as drawn and turn the edited corners red at that limit, CSS export writes the drawn radii, and rectangles saved stretched by older versions get circular corners when their corners are next set (#442). Live Corners work on any path's corners too, as on a rectangle's (#511): a star's, a live polygon's (which also shows them to the Selection tool, has a Corner Radius field in the Properties and Transform panels and keeps its radius as its sides change) and a pen path's, wherever two sides meet at an angle at an anchor that isn't smooth: curved sides too, trimmed to what the cut leaves of them (#1144). Direct Selection shows the widgets of every corner, or of the corners holding selected anchors; each corner is a circle tangent to both sides, drawn no larger than takes its cut halfway along its shorter side; a path keeps its uncut outline so its corners stay editable, and the same command, dialog, angle preference and View › Hide Corner Widget apply. With Direct Selection a click on a widget (no drag) selects its corner, as a click on the corner's anchor does, so the next drag on it rounds that corner alone; Shift-click toggles it (#1239). While a corner widget is dragged with the Selection tool the bounding box hides, so the rounding shows against the path alone (#1229). A round corner next to a curved side curves smoothly instead of sticking out of the shape (#1547, fixes #1512). View › Hide Edges hides the Live Corners widgets, the bounding box and the type widget, and the selection tools then do not answer a press on them or change the cursor over them. + - **Rectangle Properties corner type:** a live rectangle's Rectangle Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) have a Corner menu with Round, Inverted Round and Chamfer. With Corner Radius linked, one menu sets the kind of every corner of each selected rectangle, also corners with no radius, and shows blank when the shown rectangle's kinds differ; unlinked, each corner's row has its own menu beside its radius field, or under it in a panel too narrow for both; the unlinked radius fields and menus leave other selected paths and polygons as they are. A pick is one undo step, and picking the kind the corners already have adds none (`object.setLiveShape {kind, items}`). The help page says a rectangle's corner type can be set for each corner or for all of them at once ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html)); tying the number of menus to the Corner Radius link, the blank value and the undo steps are VectorCraft's own rules (`a_rectangle_shows_linked_and_unlinked_corner_types`, `the_shape_properties_popup_changes_a_rectangle_corner_type`, `the_linked_corner_menu_sets_every_selected_rectangle`, `the_unlinked_corner_menus_fit_a_narrow_panel`, `an_unlinked_corner_radius_leaves_other_selected_shapes`, `rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo`). - **Blend spine Anchor Point tool (#2544):** on a selected blend, dragging a spine corner makes symmetric Smooth handles; the tool displays and picks existing spine handles when switched to, drags one independently or retracts it on click, and clicking a point with handles retracts both. The spine is edited live without moving its key objects. Windows native canvas checks and screenshots reviewed: symmetric and independent handles, corner/retraction, Shift constraints and perpendicular reshaping, tool switching, key preservation, Undo/Redo, save/reopen, hidden handles and overlapping Path/Blend priority (PR #2643). Behaviour reference: [public path-editing documentation](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html). - **Blend spine points by marquee:** with Direct Selection, a marquee picks the spine points inside it on a selected blend, the topmost one when several are selected, and the picked points drag together as Shift-clicked ones do; Shift-marquee adds points or takes picked ones away, a plain marquee around none of them drops the picks, and Escape during the marquee keeps them. Unselected, locked and hidden blends are skipped. The spine's points are anchor points edited with Direct Selection ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/modify-spine-of-blended-objects.html)), and a boundary drag with the tool selects anchor points ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/select-anchor-points-in-paths.html)); the rules for selected, topmost and Shift are VectorCraft's own (`crates/tools/src/direct/tests.rs`, `marquee_picks_selected_blend_spine_points_which_drag_together`, `shift_marquee_toggles_selected_blend_spine_points`, `marquee_skips_unselected_locked_and_hidden_blend_spines`, `escape_cancels_a_marquee_and_keeps_the_picked_spine_points`). - **Blend steps of brushed strokes:** the steps interpolate the pen pressure, tilt, bearing and rotation recorded with the Paintbrush, so a Calligraphic, Scatter or Art brush that varies with the pen changes gradually from one key to the next. A key without a recording counts as half pressure, half tilt and 0°, as brushes read it, and angles turn the shorter way round. When the blend starts a key's path at another anchor (an open path run from its end, a closed one turned to another start), the key's recordings, width profile, arrowheads, dashes and a gradient along or across the stroke turn with the path. Different brushes still switch halfway (VectorCraft's own rule; strokes blend their options, as [Blended objects overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blended-objects-overview.html) describes; `crates/doc/src/blend.rs`, `pen_pressure_tilt_and_angles_interpolate_for_brushes`, `stroke_profiles_turn_with_a_key_path_started_elsewhere`, `stroke_gradients_and_dashes_turn_with_a_key_path_started_elsewhere`). From db6e491c56b9ea0d4a6e5afbfd8a88ecaf10368e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 20:23:57 -0800 Subject: [PATCH 2/5] Transform: Rectangle Properties corner edits send the rectangles as one ids list The Corner menus and the unlinked Corner Radius fields sent one object.setLiveShape item per selected live rectangle, each with the same corners, and the command looks each id up in that list, so an edit took time quadratic in the number of selected rectangles. They now send the rectangles as ids with one shared corners list. With no live rectangle selected the edit leaves the document and its undo history as they are. The Properties panel test for a Direct-Selected rectangle corner now expects the Rectangle Properties Corner menu once. --- crates/ui-egui/src/panels.rs | 9 +++++---- crates/ui-egui/src/panels/properties/tests.rs | 4 ++-- crates/ui-egui/src/panels/transform/tests.rs | 17 +++++++++++++++++ docs/target-app-parity.md | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index e96c374021..635e87a094 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -140,16 +140,17 @@ fn set_rectangle_kinds(app: &mut VectorcraftApp, kind: CornerKind, corner: Optio /// None) of each selected live rectangle, leaving other selected objects as they are: one undo /// step, or none when nothing changes. fn set_rectangle_corners(app: &mut VectorcraftApp, mut p: Value, corner: Option) { - let corners = corner.map_or(json!([0, 1, 2, 3]), |k| json!([k])); + p["corners"] = corner.map_or(json!([0, 1, 2, 3]), |k| json!([k])); match app.session.active() { // The command refuses the selection, with its message, while part of a symbol's art is // selected. - Some(st) if st.selection.symbol_part.is_some() => p["corners"] = corners, + Some(st) if st.selection.symbol_part.is_some() => {} + // The selected live rectangles as `ids`, all sharing `corners`. Some(st) => { let is_rectangle = |n: &Node| matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Rectangle { .. })); let rectangle = |id: &&NodeId| st.doc.node(**id).is_some_and(is_rectangle); - let items: Vec = st.selection.objects.iter().filter(rectangle).map(|id| json!({"id": id.0, "corners": corners})).collect(); - p["items"] = json!(items); + let ids: Vec = st.selection.objects.iter().filter(rectangle).map(|id| id.0).collect(); + p["ids"] = json!(ids); } None => return, } diff --git a/crates/ui-egui/src/panels/properties/tests.rs b/crates/ui-egui/src/panels/properties/tests.rs index c91d01a2bf..f1fc6eb540 100644 --- a/crates/ui-egui/src/panels/properties/tests.rs +++ b/crates/ui-egui/src/panels/properties/tests.rs @@ -1555,11 +1555,11 @@ fn direct_selected_corners_show_their_kind_and_radius() { // The whole path selected. app.run("select.set", json!({"ids": [star]})).unwrap(); assert!(!shows(&tall(&mut app, &ctx, vec![]), "Corner:"), "no corner selected"); - // A live rectangle's corner: its own Corner Radius row, once. + // A live rectangle's corner: its own Corner Radius row and Corner menu, once each. let r = rect(&mut app, 20.0, 20.0, 60.0, 40.0).as_u64().unwrap(); app.run("select.anchors", json!({"id": r, "anchors": [[0, 1]], "mode": "set"})).unwrap(); let texts = tall(&mut app, &ctx, vec![]); - assert!(!shows(&texts, "Corner:"), "{texts:?}"); + assert_eq!(texts.iter().filter(|(t, _)| t == "Corner:").count(), 1, "{texts:?}"); assert_eq!(texts.iter().filter(|(t, _)| t == "Corner Radius:").count(), 1, "{texts:?}"); } diff --git a/crates/ui-egui/src/panels/transform/tests.rs b/crates/ui-egui/src/panels/transform/tests.rs index 7260c7d3fa..7bfe802561 100644 --- a/crates/ui-egui/src/panels/transform/tests.rs +++ b/crates/ui-egui/src/panels/transform/tests.rs @@ -167,6 +167,23 @@ fn a_rectangle_shows_linked_and_unlinked_corner_types() { } } +/// A corner kind set with no live rectangle selected leaves the selected polygon, the document and +/// its undo history as they are. +#[test] +fn a_rectangle_corner_kind_without_a_selected_rectangle_changes_nothing() { + use vectorcraft_geom::shapes::CornerKind::Chamfer; + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + app.run("shape.polygon", json!({"cx": 150, "cy": 150, "radius": 40, "sides": 6})).unwrap(); + let st = app.session.active().unwrap(); + let (before, steps) = (st.doc.clone(), st.history.undo.len()); + crate::panels::set_rectangle_kinds(&mut app, Chamfer, None); + crate::panels::set_rectangle_kinds(&mut app, Chamfer, Some(2)); + let st = app.session.active().unwrap(); + assert!(st.doc == before, "the document changed"); + assert_eq!(st.history.undo.len(), steps); +} + /// #3451: a live ellipse shows pie start/end angles and Invert Pie in the Transform panel and /// the Properties panel's Transform section; typed angles update the shape. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 88d2d57f3e..06faf2ee49 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1322,7 +1322,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur With Direct Selection, Shift pressed during the drag of a curved segment keeps both of its handles at right angles to the line between its anchors, on the same side and at the same length (`path.reshapeSegment {perpendicular}`). Shift held while any segment is dragged with the Anchor Point tool or the Pen with Alt does the same. With the Anchor Point tool, Shift held at the press on an anchor (or a selected blend's spine point) moves it, handles and all, instead of pulling out handles; Shift kept down keeps the move at 45° steps, and a Shift-click that doesn't move leaves the anchor as it was (`path.moveAnchor`). A selected blend spine's segment dragged with the Anchor Point tool, or a curved one dragged with Direct Selection, bends the same way (`object.blend.spine.reshapeSegment`). - **Live Corners:** drag a live rectangle's corner widgets (Selection or Direct Selection) to round all corners, with a radius readout; with Direct Selection, select corner anchors to show and round just those corners (#381). Each corner keeps its own radius and kind (Round, Inverted Round, Chamfer): Alt-click a widget to cycle the kind, double-click it for the Corners dialog, and the Properties and Transform radius fields set the selected corners (`object.setLiveShape {corners, radius, kind}`). A link toggle behind Corner Radius (the `singleCornerRadius` preference) switches the panels to a field for each corner of a live rectangle: Top Left, Top Right, Bottom Right and Bottom Left. Corners stay circular when the rectangle is scaled unevenly or along its own sides when rotated (the radius keeps its size, or scales by the mean scale with Scale Corners on); only a shear distorts them. On a rectangle that isn't square every corner is the same circle: a radius past half the shorter side stops there for all of them, the widgets sit on the corners as drawn and turn the edited corners red at that limit, CSS export writes the drawn radii, and rectangles saved stretched by older versions get circular corners when their corners are next set (#442). Live Corners work on any path's corners too, as on a rectangle's (#511): a star's, a live polygon's (which also shows them to the Selection tool, has a Corner Radius field in the Properties and Transform panels and keeps its radius as its sides change) and a pen path's, wherever two sides meet at an angle at an anchor that isn't smooth: curved sides too, trimmed to what the cut leaves of them (#1144). Direct Selection shows the widgets of every corner, or of the corners holding selected anchors; each corner is a circle tangent to both sides, drawn no larger than takes its cut halfway along its shorter side; a path keeps its uncut outline so its corners stay editable, and the same command, dialog, angle preference and View › Hide Corner Widget apply. With Direct Selection a click on a widget (no drag) selects its corner, as a click on the corner's anchor does, so the next drag on it rounds that corner alone; Shift-click toggles it (#1239). While a corner widget is dragged with the Selection tool the bounding box hides, so the rounding shows against the path alone (#1229). A round corner next to a curved side curves smoothly instead of sticking out of the shape (#1547, fixes #1512). View › Hide Edges hides the Live Corners widgets, the bounding box and the type widget, and the selection tools then do not answer a press on them or change the cursor over them. - - **Rectangle Properties corner type:** a live rectangle's Rectangle Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) have a Corner menu with Round, Inverted Round and Chamfer. With Corner Radius linked, one menu sets the kind of every corner of each selected rectangle, also corners with no radius, and shows blank when the shown rectangle's kinds differ; unlinked, each corner's row has its own menu beside its radius field, or under it in a panel too narrow for both; the unlinked radius fields and menus leave other selected paths and polygons as they are. A pick is one undo step, and picking the kind the corners already have adds none (`object.setLiveShape {kind, items}`). The help page says a rectangle's corner type can be set for each corner or for all of them at once ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html)); tying the number of menus to the Corner Radius link, the blank value and the undo steps are VectorCraft's own rules (`a_rectangle_shows_linked_and_unlinked_corner_types`, `the_shape_properties_popup_changes_a_rectangle_corner_type`, `the_linked_corner_menu_sets_every_selected_rectangle`, `the_unlinked_corner_menus_fit_a_narrow_panel`, `an_unlinked_corner_radius_leaves_other_selected_shapes`, `rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo`). + - **Rectangle Properties corner type:** a live rectangle's Rectangle Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) have a Corner menu with Round, Inverted Round and Chamfer. With Corner Radius linked, one menu sets the kind of every corner of each selected rectangle, also corners with no radius, and shows blank when the shown rectangle's kinds differ; unlinked, each corner's row has its own menu beside its radius field, or under it in a panel too narrow for both; the unlinked radius fields and menus leave other selected paths and polygons as they are. A pick is one undo step, and picking the kind the corners already have adds none (`object.setLiveShape {kind, ids, corners}`). The help page says a rectangle's corner type can be set for each corner or for all of them at once ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html)); tying the number of menus to the Corner Radius link, the blank value and the undo steps are VectorCraft's own rules (`a_rectangle_shows_linked_and_unlinked_corner_types`, `the_shape_properties_popup_changes_a_rectangle_corner_type`, `the_linked_corner_menu_sets_every_selected_rectangle`, `the_unlinked_corner_menus_fit_a_narrow_panel`, `an_unlinked_corner_radius_leaves_other_selected_shapes`, `a_rectangle_corner_kind_without_a_selected_rectangle_changes_nothing`, `rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo`). - **Blend spine Anchor Point tool (#2544):** on a selected blend, dragging a spine corner makes symmetric Smooth handles; the tool displays and picks existing spine handles when switched to, drags one independently or retracts it on click, and clicking a point with handles retracts both. The spine is edited live without moving its key objects. Windows native canvas checks and screenshots reviewed: symmetric and independent handles, corner/retraction, Shift constraints and perpendicular reshaping, tool switching, key preservation, Undo/Redo, save/reopen, hidden handles and overlapping Path/Blend priority (PR #2643). Behaviour reference: [public path-editing documentation](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html). - **Blend spine points by marquee:** with Direct Selection, a marquee picks the spine points inside it on a selected blend, the topmost one when several are selected, and the picked points drag together as Shift-clicked ones do; Shift-marquee adds points or takes picked ones away, a plain marquee around none of them drops the picks, and Escape during the marquee keeps them. Unselected, locked and hidden blends are skipped. The spine's points are anchor points edited with Direct Selection ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/modify-spine-of-blended-objects.html)), and a boundary drag with the tool selects anchor points ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/select-anchor-points-in-paths.html)); the rules for selected, topmost and Shift are VectorCraft's own (`crates/tools/src/direct/tests.rs`, `marquee_picks_selected_blend_spine_points_which_drag_together`, `shift_marquee_toggles_selected_blend_spine_points`, `marquee_skips_unselected_locked_and_hidden_blend_spines`, `escape_cancels_a_marquee_and_keeps_the_picked_spine_points`). - **Blend steps of brushed strokes:** the steps interpolate the pen pressure, tilt, bearing and rotation recorded with the Paintbrush, so a Calligraphic, Scatter or Art brush that varies with the pen changes gradually from one key to the next. A key without a recording counts as half pressure, half tilt and 0°, as brushes read it, and angles turn the shorter way round. When the blend starts a key's path at another anchor (an open path run from its end, a closed one turned to another start), the key's recordings, width profile, arrowheads, dashes and a gradient along or across the stroke turn with the path. Different brushes still switch halfway (VectorCraft's own rule; strokes blend their options, as [Blended objects overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blended-objects-overview.html) describes; `crates/doc/src/blend.rs`, `pen_pressure_tilt_and_angles_interpolate_for_brushes`, `stroke_profiles_turn_with_a_key_path_started_elsewhere`, `stroke_gradients_and_dashes_turn_with_a_key_path_started_elsewhere`). From e4776713d709d518a31533d0c1d56e0cd777013a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 06:27:06 -0800 Subject: [PATCH 3/5] Transform: a corner kind the rectangle already has leaves it unchanged A kind-only object.setLiveShape call now leaves each rectangle whose corners already have the kind as it is, even when its transform keeps a scale, and changes only the other targets. The Corner menu applies a pending tool edit before it reads the selected rectangles. The popup test checks that the list opened before it picks the Chamfer row. --- crates/engine/src/cmd/object/shape.rs | 11 +++-- crates/engine/src/tests/livecorners.rs | 32 +++++++++++++ crates/ui-egui/src/panels.rs | 4 ++ crates/ui-egui/src/panels/transform/tests.rs | 47 ++++++++++++++++++++ crates/ui-egui/src/tests/taskbar.rs | 6 ++- 5 files changed, 95 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/object/shape.rs b/crates/engine/src/cmd/object/shape.rs index 02edf6193b..661a9331ef 100644 --- a/crates/engine/src/cmd/object/shape.rs +++ b/crates/engine/src/cmd/object/shape.rs @@ -265,18 +265,21 @@ pub(super) fn set_live_shape(s: &mut Session, p: &Value) -> Result { } let Some(c) = LiveCorners::new(path, live.as_deref()) else { return true }; let picked = corners_of(*id).unwrap_or_else(|| c.picked(st.selection.anchors.get(id))); - // Setting corners folds a scale left in a rectangle's transform into its size, which - // changes it. - live.as_deref().is_none_or(|l| l.folded() == *l) + // Setting a radius folds a scale left in a rectangle's transform into its size, which + // changes it. A kind the corners already have leaves the rectangle as it is. + (radius.is_none() || live.as_deref().is_none_or(|l| l.folded() == *l)) && picked.iter().all(|k| { *k < c.base.anchor_count() && radius.is_none_or(|r| (c.drawn_radius(*k) - r.max(0.0)).abs() < 1e-9) && kind.is_none_or(|kd| c.kind(*k) == kd) }) }; - if ids.iter().all(has_values) { + // The objects every value given already matches stay as they are, beside others that change. + let unchanged: BTreeSet = ids.iter().copied().filter(has_values).collect(); + if ids.iter().all(|id| unchanged.contains(id)) { return ok(); } + let ids: Vec = ids.into_iter().filter(|id| !unchanged.contains(id)).collect(); s.edit("Live Shape", |d, sel| { for id in &ids { let Some(NodeKind::Path { path, live, .. }) = d.node_mut(*id).map(|n| &mut n.kind) else { continue }; diff --git a/crates/engine/src/tests/livecorners.rs b/crates/engine/src/tests/livecorners.rs index d91f120831..6d9d806c3e 100644 --- a/crates/engine/src/tests/livecorners.rs +++ b/crates/engine/src/tests/livecorners.rs @@ -81,6 +81,38 @@ fn rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo() { assert_eq!(steps(&s), undo + 2); } +/// A kind the corners already have leaves a rectangle saved stretched by an older version as it +/// is, alone or beside a rectangle the kind changes: its scale stays in its transform. +#[test] +fn a_kind_the_corners_have_leaves_a_stretched_rectangle() { + let (mut s, id) = session(); + let other = NodeId(s.execute("shape.rectangle", &json!({"x": 200, "y": 10, "width": 40, "height": 40})).unwrap()["id"].as_u64().unwrap()); + let stretched = LiveShape::Rectangle { + w: 50.0, + h: 60.0, + radii: [10.0; 4], + kinds: [CornerKind::Chamfer; 4], + radii_relative: false, + xf: Affine::translate((10.0, 10.0)) * Affine::scale_non_uniform(2.0, 1.0), + }; + { + let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); + let NodeKind::Path { path, live: Some(live), .. } = &mut d.node_mut(id).unwrap().kind else { panic!("not live") }; + **live = stretched.clone(); + *path = live.to_path(); + } + let live = |s: &Session| node_path(s, id).1; + let steps = |s: &Session| s.doc().unwrap().history.undo.len(); + let undo = steps(&s); + run(&mut s, json!({"ids": [id.0], "kind": "chamfer"})); + assert_eq!(live(&s), Some(stretched.clone())); + assert_eq!(steps(&s), undo, "no step when nothing changes"); + run(&mut s, json!({"ids": [id.0, other.0], "kind": "chamfer"})); + assert_eq!(live(&s), Some(stretched)); + assert_eq!(corners(&s, other).1, [CornerKind::Chamfer; 4]); + assert_eq!(steps(&s), undo + 1); +} + /// #938: `items` rounds several objects in one step, each its own corners (or all of them). #[test] fn items_round_several_objects_each_its_own_corners() { diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 49f99de7f7..9e30fd609d 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -142,6 +142,10 @@ fn set_rectangle_kinds(app: &mut VectorcraftApp, kind: CornerKind, corner: Optio /// step, or none when nothing changes. fn set_rectangle_corners(app: &mut VectorcraftApp, mut p: Value, corner: Option) { p["corners"] = corner.map_or(json!([0, 1, 2, 3]), |k| json!([k])); + // The edit the tool computes on another thread comes first: the rectangles are the ones + // selected after it. + let r = app.session.finish_tool_edit(); + crate::canvas::apply_requests(app, r); match app.session.active() { // The command refuses the selection, with its message, while part of a symbol's art is // selected. diff --git a/crates/ui-egui/src/panels/transform/tests.rs b/crates/ui-egui/src/panels/transform/tests.rs index 2a57359a22..564693132c 100644 --- a/crates/ui-egui/src/panels/transform/tests.rs +++ b/crates/ui-egui/src/panels/transform/tests.rs @@ -184,6 +184,53 @@ fn a_rectangle_corner_kind_without_a_selected_rectangle_changes_nothing() { assert_eq!(st.history.undo.len(), steps); } +/// A corner kind picked while a Shape Builder merge is computed on another thread applies the +/// merge first, and sets the kind on the live rectangles selected after it. +#[test] +fn a_rectangle_corner_kind_applies_a_merge_on_another_thread_first() { + use vectorcraft_geom::shapes::CornerKind::Chamfer; + use vectorcraft_tools::{Mods, PointerEvent, PointerKind}; + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 800, "height": 200})).unwrap(); + for k in 0..40 { + app.run("shape.rectangle", json!({"x": k * 10, "y": 0, "width": 20, "height": 20})).unwrap(); + } + app.run("select.all", json!({})).unwrap(); + app.run("tool.select", json!({"tool": "shapeBuilder"})).unwrap(); + let view = app.view_info(); + let at = |kind| PointerEvent { + kind, + pos: vectorcraft_geom::Point::new(15.0, 10.0), + mods: Mods::default(), + pressure: 1.0, + backquote: false, + pen: None, + }; + crate::canvas::dispatch(&mut app, &at(PointerKind::Move), view); + app.session.tool_poll(view, true).unwrap(); + crate::canvas::dispatch(&mut app, &at(PointerKind::Down), view); + crate::canvas::dispatch(&mut app, &at(PointerKind::Up), view); + assert!(app.session.tool_editing()); + crate::panels::set_rectangle_kinds(&mut app, Chamfer, None); + assert!(!app.session.tool_editing()); + let st = app.session.active().unwrap(); + let labels: Vec<_> = st.history.undo.iter().rev().take(2).map(|e| e.label.as_str()).collect(); + assert_eq!(labels, ["Live Shape", "Shape Builder"]); + let kinds: Vec<_> = st + .selection + .objects + .iter() + .filter_map(|id| match &st.doc.node(*id)?.kind { + NodeKind::Path { live: Some(l), .. } => match &**l { + LiveShape::Rectangle { kinds, .. } => Some(*kinds), + _ => None, + }, + _ => None, + }) + .collect(); + assert!(!kinds.is_empty() && kinds.iter().all(|k| *k == [Chamfer; 4]), "{kinds:?}"); +} + /// #3451: a live ellipse shows pie start/end angles and Invert Pie in the Transform panel and /// the Properties panel's Transform section; typed angles update the shape. #[test] diff --git a/crates/ui-egui/src/tests/taskbar.rs b/crates/ui-egui/src/tests/taskbar.rs index ff9f58f05c..ca0f4874e6 100644 --- a/crates/ui-egui/src/tests/taskbar.rs +++ b/crates/ui-egui/src/tests/taskbar.rs @@ -774,7 +774,11 @@ fn the_shape_properties_popup_changes_a_rectangle_corner_type() { assert_eq!(kinds(&app), ([Chamfer; 4], [10.0; 4]), "all four corners, radii kept"); assert_eq!(steps(&app), before + 1, "one undo step"); let texts = click(&mut app, at(&texts, "Chamfer")); - click(&mut app, entry(&texts, "Chamfer")); + // The list is open: its Chamfer row shows as well as the closed menu's, and the pick closes it. + assert_eq!(texts.iter().filter(|(t, _)| t == "Chamfer").count(), 2, "{texts:?}"); + assert!(texts.iter().any(|(t, _)| t == "Inverted Round"), "{texts:?}"); + let texts = click(&mut app, entry(&texts, "Chamfer")); + assert!(!texts.iter().any(|(t, _)| t == "Inverted Round"), "the pick closes the list: {texts:?}"); assert_eq!(steps(&app), before + 1, "the same kind adds no undo step"); app.run("prefs.set", json!({"key": "singleCornerRadius", "value": false})).unwrap(); From 27646e8164d0ce8b9fe962b7f2208380980be77f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 17:23:11 -0800 Subject: [PATCH 4/5] Transform: corner fields and menus play back on the selected rectangles The Rectangle Properties corner fields and menus now send `rectanglesOnly` with the selection instead of the selected rectangles' ids. An action that records them then sets the rectangles selected when it plays. `object.setLiveShape {rectanglesOnly}` sets the live rectangles among its targets and leaves the other objects as they are. A radius is compared with the radius a corner stores, so a corner that stores a larger radius than it draws takes the new one, alone or beside other targets. Radii stored as fractions are still compared as drawn. --- crates/engine/src/cmd/object/commands.rs | 2 +- crates/engine/src/cmd/object/shape.rs | 21 ++++++++--- crates/engine/src/tests/livecorners.rs | 47 ++++++++++++++++++++++++ crates/ui-egui/src/panels.rs | 19 +++------- docs/mcp.md | 6 ++- docs/target-app-parity.md | 2 +- 6 files changed, 75 insertions(+), 22 deletions(-) diff --git a/crates/engine/src/cmd/object/commands.rs b/crates/engine/src/cmd/object/commands.rs index 4be83d7da6..753f5f9f6f 100644 --- a/crates/engine/src/cmd/object/commands.rs +++ b/crates/engine/src/cmd/object/commands.rs @@ -305,7 +305,7 @@ pub fn specs() -> Vec { "Live Shape Properties", [], None, - "{id?, ids?, radius?: pt (or % of each corner's maximum when `relativeRadii` is true), kind?: \"round\"|\"invertedRound\"|\"chamfer\", relativeRadii?: bool (Relative rounding, as in the reference app: store radii as fractions of each corner's maximum so they scale with the shape), corners?: [i…], items?: [{id, corners?: [i…]}] (several objects, each with its own corners, in place of ids and corners: the canvas's corner widgets across a selection), sides?: n, polygonAngle?: degrees (counter-clockwise from its first vertex straight up), polygonRadius?: pt (centre to vertex), sideLength?: pt (sets the radius), makeSidesEqual?: true (a polygon scaled unevenly: drops the uneven scale and shear, keeping its centre, angle and mean radius), pieStart?, pieEnd?: degrees (an ellipse's pie, counter-clockwise from 3 o'clock; 0 to 360 is the whole ellipse), invertPie?: true (swaps them: the other part of the ellipse), constrainPie?: bool (Constrain Pie Angle: with one of pieStart and pieEnd, not both and not with invertPie, the other angle moves by as much, so each ellipse keeps its span), lineLength?: pt (a live line's length, above 0; its first end stays), lineAngle?: degrees (a live line's angle, counter-clockwise from 3 o'clock, from its first end to its second; it turns about its midpoint)} (Live Corners on any path: radius and kind set its corners (anchors that aren't smooth, where two sides, straight or curved (#1144), meet at an angle): `corners` (anchor indices of the path with its corners uncut, counting every subpath's anchors in order: a rectangle's 0 top-left, 1 top-right, 2 bottom-right, 3 bottom-left; a polygon's from the first vertex clockwise), else the corners with a Direct-Selected anchor, else every corner; each radius is drawn no larger than half the corner's shorter side allows; a path that isn't a live shape keeps its uncut outline so its corners stay editable, and is plain again once none is cut; sides: a polygon's, which keep the radius they shared; the polygon params apply in that order: sides, makeSidesEqual, polygonAngle, then sideLength or else polygonRadius; a line's lineLength applies before its lineAngle)", + "{id?, ids?, radius?: pt (or % of each corner's maximum when `relativeRadii` is true), kind?: \"round\"|\"invertedRound\"|\"chamfer\", relativeRadii?: bool (Relative rounding, as in the reference app: store radii as fractions of each corner's maximum so they scale with the shape), corners?: [i…], rectanglesOnly?: bool (only the live rectangles among the targets; the other objects stay as they are), items?: [{id, corners?: [i…]}] (several objects, each with its own corners, in place of ids and corners: the canvas's corner widgets across a selection), sides?: n, polygonAngle?: degrees (counter-clockwise from its first vertex straight up), polygonRadius?: pt (centre to vertex), sideLength?: pt (sets the radius), makeSidesEqual?: true (a polygon scaled unevenly: drops the uneven scale and shear, keeping its centre, angle and mean radius), pieStart?, pieEnd?: degrees (an ellipse's pie, counter-clockwise from 3 o'clock; 0 to 360 is the whole ellipse), invertPie?: true (swaps them: the other part of the ellipse), constrainPie?: bool (Constrain Pie Angle: with one of pieStart and pieEnd, not both and not with invertPie, the other angle moves by as much, so each ellipse keeps its span), lineLength?: pt (a live line's length, above 0; its first end stays), lineAngle?: degrees (a live line's angle, counter-clockwise from 3 o'clock, from its first end to its second; it turns about its midpoint)} (Live Corners on any path: radius and kind set its corners (anchors that aren't smooth, where two sides, straight or curved (#1144), meet at an angle): `corners` (anchor indices of the path with its corners uncut, counting every subpath's anchors in order: a rectangle's 0 top-left, 1 top-right, 2 bottom-right, 3 bottom-left; a polygon's from the first vertex clockwise), else the corners with a Direct-Selected anchor, else every corner; each radius is drawn no larger than half the corner's shorter side allows; a path that isn't a live shape keeps its uncut outline so its corners stay editable, and is plain again once none is cut; sides: a polygon's, which keep the radius they shared; the polygon params apply in that order: sides, makeSidesEqual, polygonAngle, then sideLength or else polygonRadius; a line's lineLength applies before its lineAngle)", has_selection, set_live_shape ), diff --git a/crates/engine/src/cmd/object/shape.rs b/crates/engine/src/cmd/object/shape.rs index 661a9331ef..94cf575de1 100644 --- a/crates/engine/src/cmd/object/shape.rs +++ b/crates/engine/src/cmd/object/shape.rs @@ -124,7 +124,7 @@ fn line_edit(l: &LiveShape, len: Option, angle: Option) -> Option Result { - check_switches(p, &["constrainPie", "invertPie", "makeSidesEqual", "relativeRadii"], "object.setLiveShape")?; + check_switches(p, &["constrainPie", "invertPie", "makeSidesEqual", "rectanglesOnly", "relativeRadii"], "object.setLiveShape")?; check_numbers(p, &["radius", "sides"], "object.setLiveShape")?; // `items`: objects each with its own `corners`; else `ids` (or the selection) sharing them. let items = match p.get("items").filter(|v| !v.is_null()) { @@ -225,6 +225,13 @@ pub(super) fn set_live_shape(s: &mut Session, p: &Value) -> Result { // When every value given is the current one, the document and its undo history stay as they // are. let st = s.doc()?; + // `rectanglesOnly`: the live rectangles among the targets; the other objects stay as they are. + let ids: Vec = if p.get("rectanglesOnly").and_then(Value::as_bool) == Some(true) { + let rectangle = |id: &NodeId| matches!(st.doc.node(*id).map(|n| &n.kind), Some(NodeKind::Path { live: Some(l), .. }) if matches!(**l, LiveShape::Rectangle { .. })); + ids.into_iter().filter(rectangle).collect() + } else { + ids + }; // The lines that Line Length or Line Angle changes, as they become. A line that would reach // past the document's coordinate limit is an error before anything changes. let mut lines = std::collections::BTreeMap::new(); @@ -270,16 +277,20 @@ pub(super) fn set_live_shape(s: &mut Session, p: &Value) -> Result { (radius.is_none() || live.as_deref().is_none_or(|l| l.folded() == *l)) && picked.iter().all(|k| { *k < c.base.anchor_count() - && radius.is_none_or(|r| (c.drawn_radius(*k) - r.max(0.0)).abs() < 1e-9) + // A radius stored in document units can be larger than it draws; a relative + // one is a fraction, so it is compared as drawn. + && radius.is_none_or(|r| { + let now = if c.radii_relative() { c.drawn_radius(*k) } else { c.radius(*k) }; + (now - r.max(0.0)).abs() < 1e-9 + }) && kind.is_none_or(|kd| c.kind(*k) == kd) }) }; // The objects every value given already matches stay as they are, beside others that change. - let unchanged: BTreeSet = ids.iter().copied().filter(has_values).collect(); - if ids.iter().all(|id| unchanged.contains(id)) { + let ids: Vec = ids.into_iter().filter(|id| !has_values(id)).collect(); + if ids.is_empty() { return ok(); } - let ids: Vec = ids.into_iter().filter(|id| !unchanged.contains(id)).collect(); s.edit("Live Shape", |d, sel| { for id in &ids { let Some(NodeKind::Path { path, live, .. }) = d.node_mut(*id).map(|n| &mut n.kind) else { continue }; diff --git a/crates/engine/src/tests/livecorners.rs b/crates/engine/src/tests/livecorners.rs index 6d9d806c3e..0e67c72c33 100644 --- a/crates/engine/src/tests/livecorners.rs +++ b/crates/engine/src/tests/livecorners.rs @@ -113,6 +113,53 @@ fn a_kind_the_corners_have_leaves_a_stretched_rectangle() { assert_eq!(steps(&s), undo + 1); } +/// A radius is stored on a corner that stores a larger radius drawn at the new value, alone or +/// beside another rectangle; the radius every target already stores adds no undo step. +#[test] +fn a_radius_reaches_a_rectangle_that_already_draws_it() { + let (mut s, id) = session(); + let other = NodeId(s.execute("shape.rectangle", &json!({"x": 200, "y": 10, "width": 100, "height": 60})).unwrap()["id"].as_u64().unwrap()); + // 80 pt on every corner draws at 30 pt, half the 60 pt side. + run(&mut s, json!({"ids": [id.0], "radius": 80})); + assert_eq!(corners(&s, id).0, [80.0; 4]); + let (path, live) = node_path(&s, id); + let drawn = LiveCorners::new(&path, live.as_ref()).unwrap().drawn_radius(0); + assert!((drawn - 30.0).abs() < 1e-9, "draws at {drawn}"); + let steps = |s: &Session| s.doc().unwrap().history.undo.len(); + let undo = steps(&s); + run(&mut s, json!({"ids": [id.0], "corners": [1], "radius": 30})); + assert_eq!(corners(&s, id).0, [80.0, 30.0, 80.0, 80.0]); + assert_eq!(steps(&s), undo + 1); + run(&mut s, json!({"ids": [id.0, other.0], "corners": [0], "radius": 30})); + assert_eq!(corners(&s, id).0[0], 30.0); + assert_eq!(corners(&s, other).0[0], 30.0); + // The radius both already store adds no step. + run(&mut s, json!({"ids": [id.0, other.0], "corners": [0], "radius": 30})); + assert_eq!(steps(&s), undo + 2); +} + +/// `rectanglesOnly` sets the live rectangles among the selection and leaves a polygon as it is; an +/// action that records it holds no ids, so playing it sets the rectangles selected then. +#[test] +fn rectangles_only_sets_the_selected_rectangles_when_an_action_plays() { + let (mut s, id) = session(); + let polygon = NodeId(s.execute("shape.polygon", &json!({"cx": 300, "cy": 300, "radius": 40, "sides": 6})).unwrap()["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [id.0, polygon.0]})).unwrap(); + let start = s.journal.len(); + run(&mut s, json!({"rectanglesOnly": true, "corners": [0], "kind": "chamfer"})); + assert_eq!(corners(&s, id).1[0], CornerKind::Chamfer); + let NodeKind::Path { live: Some(l), .. } = &s.doc().unwrap().doc.node(polygon).unwrap().kind else { panic!("not live") }; + let LiveShape::Polygon { kinds, .. } = &**l else { panic!("not a polygon") }; + assert!(kinds.iter().all(|k| *k == CornerKind::Round), "the polygon keeps its corners: {kinds:?}"); + let action = s.journal_for_action(start); + assert_eq!(action.len(), 1); + assert_eq!(action[0].1.get("ids"), None); + let other = NodeId(s.execute("shape.rectangle", &json!({"x": 200, "y": 10, "width": 40, "height": 40})).unwrap()["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [other.0, polygon.0]})).unwrap(); + s.replay(&action[0].0, &action[0].1).unwrap(); + assert_eq!(corners(&s, other).1[0], CornerKind::Chamfer); +} + /// #938: `items` rounds several objects in one step, each its own corners (or all of them). #[test] fn items_round_several_objects_each_its_own_corners() { diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 9e30fd609d..2d7037c5a0 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -57,7 +57,7 @@ use std::sync::Arc; use egui::{Rect, Sense, Ui, vec2}; use serde_json::{Value, json}; use vectorcraft_color::{BlendMode, Color, Paint}; -use vectorcraft_doc::{LiveCorners, LiveShape, Node, NodeId, NodeKind, StrokeLayer}; +use vectorcraft_doc::{LiveCorners, Node, NodeId, NodeKind, StrokeLayer}; use vectorcraft_engine::inspect::StrokeMixed; use vectorcraft_geom::shapes::CornerKind; @@ -146,19 +146,12 @@ fn set_rectangle_corners(app: &mut VectorcraftApp, mut p: Value, corner: Option< // selected after it. let r = app.session.finish_tool_edit(); crate::canvas::apply_requests(app, r); - match app.session.active() { - // The command refuses the selection, with its message, while part of a symbol's art is - // selected. - Some(st) if st.selection.symbol_part.is_some() => {} - // The selected live rectangles as `ids`, all sharing `corners`. - Some(st) => { - let is_rectangle = |n: &Node| matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Rectangle { .. })); - let rectangle = |id: &&NodeId| st.doc.node(**id).is_some_and(is_rectangle); - let ids: Vec = st.selection.objects.iter().filter(rectangle).map(|id| id.0).collect(); - p["ids"] = json!(ids); - } - None => return, + if app.session.active().is_none() { + return; } + // The live rectangles of the selection when it runs, so an action that records it acts on the + // rectangles selected when it plays. + p["rectanglesOnly"] = json!(true); if let Err(e) = app.run("object.setLiveShape", p) { app.status(e); } diff --git a/docs/mcp.md b/docs/mcp.md index 655efa1b4c..eb6764b99a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -6889,7 +6889,7 @@ and files saved without it open with it off. ## Live Corners -`object.setLiveShape {id?, ids?, radius?, kind?, corners?, items?}` sets the corners of any path (one undo step): a live +`object.setLiveShape {id?, ids?, radius?, kind?, corners?, rectanglesOnly?, items?}` sets the corners of any path (one undo step): a live rectangle's or polygon's, a star's, a pen path's. A corner is an anchor where two sides, straight or curved, meet at an angle (not an open path's ends, not a smooth anchor, not one the sides run straight on through); a curved side is trimmed to what the cut leaves of it. `radius` (pt) and `kind` @@ -6908,7 +6908,9 @@ or keeps its size with Scale Corners off), and a rectangle from a file that kept (elliptical corners) gets circular ones in document units when its corners are next set. Dragging a corner widget rounds the corners whose widgets show (every corner, or the Direct-Selected ones) on every selected path at once, outlining in red those that reach their limit; the Selection tool shows the widgets of live rectangles and polygons, -the Direct Selection tool those of any path. Several objects each with their own corners are one call: +the Direct Selection tool those of any path. `rectanglesOnly: true` sets them on the live rectangles among the targets +alone and leaves the other objects as they are (the Rectangle Properties corner fields and menus send it with the +selection, so an action that records them acts on the rectangles selected when it plays). Several objects each with their own corners are one call: `items: [{id, corners?}]` in place of `ids` and `corners`. Alt-clicking one cycles their kind and double-clicking one opens Corners (`ui.corners {id?, corners?}`, dialog `corners`: `kind`, `radius`; OK runs `object.setLiveShape`). diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index d6c8cf348d..18c5721197 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1362,7 +1362,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur With Direct Selection, Shift pressed during the drag of a curved segment keeps both of its handles at right angles to the line between its anchors, on the same side and at the same length (`path.reshapeSegment {perpendicular}`). Shift held while any segment is dragged with the Anchor Point tool or the Pen with Alt does the same. With the Anchor Point tool, Shift held at the press on an anchor (or a selected blend's spine point) moves it, handles and all, instead of pulling out handles; Shift kept down keeps the move at 45° steps, and a Shift-click that doesn't move leaves the anchor as it was (`path.moveAnchor`). A selected blend spine's segment dragged with the Anchor Point tool, or a curved one dragged with Direct Selection, bends the same way (`object.blend.spine.reshapeSegment`). - **Live Corners:** drag a live rectangle's corner widgets (Selection or Direct Selection) to round all corners, with a radius readout; with Direct Selection, select corner anchors to show and round just those corners (#381). Each corner keeps its own radius and kind (Round, Inverted Round, Chamfer): Alt-click a widget to cycle the kind, double-click it for the Corners dialog, and the Properties and Transform radius fields set the selected corners (`object.setLiveShape {corners, radius, kind}`). A link toggle behind Corner Radius (the `singleCornerRadius` preference) switches the panels to a field for each corner of a live rectangle: Top Left, Top Right, Bottom Right and Bottom Left. Corners stay circular when the rectangle is scaled unevenly or along its own sides when rotated (the radius keeps its size, or scales by the mean scale with Scale Corners on); only a shear distorts them. On a rectangle that isn't square every corner is the same circle: a radius past half the shorter side stops there for all of them, the widgets sit on the corners as drawn and turn the edited corners red at that limit, CSS export writes the drawn radii, and rectangles saved stretched by older versions get circular corners when their corners are next set (#442). Live Corners work on any path's corners too, as on a rectangle's (#511): a star's, a live polygon's (which also shows them to the Selection tool, has a Corner Radius field in the Properties and Transform panels and keeps its radius as its sides change) and a pen path's, wherever two sides meet at an angle at an anchor that isn't smooth: curved sides too, trimmed to what the cut leaves of them (#1144). Direct Selection shows the widgets of every corner, or of the corners holding selected anchors; each corner is a circle tangent to both sides, drawn no larger than takes its cut halfway along its shorter side; a path keeps its uncut outline so its corners stay editable, and the same command, dialog, angle preference and View › Hide Corner Widget apply. With Direct Selection a click on a widget (no drag) selects its corner, as a click on the corner's anchor does, so the next drag on it rounds that corner alone; Shift-click toggles it (#1239). While a corner widget is dragged with the Selection tool the bounding box hides, so the rounding shows against the path alone (#1229). A round corner next to a curved side curves smoothly instead of sticking out of the shape (#1547, fixes #1512). View › Hide Edges hides the Live Corners widgets, the bounding box and the type widget, and the selection tools then do not answer a press on them or change the cursor over them. - - **Rectangle Properties corner type:** a live rectangle's Rectangle Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) have a Corner menu with Round, Inverted Round and Chamfer. With Corner Radius linked, one menu sets the kind of every corner of each selected rectangle, also corners with no radius, and shows blank when the shown rectangle's kinds differ; unlinked, each corner's row has its own menu beside its radius field, or under it in a panel too narrow for both; the unlinked radius fields and menus leave other selected paths and polygons as they are. A pick is one undo step, and picking the kind the corners already have adds none (`object.setLiveShape {kind, ids, corners}`). The help page says a rectangle's corner type can be set for each corner or for all of them at once ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html)); tying the number of menus to the Corner Radius link, the blank value and the undo steps are VectorCraft's own rules (`a_rectangle_shows_linked_and_unlinked_corner_types`, `the_shape_properties_popup_changes_a_rectangle_corner_type`, `the_linked_corner_menu_sets_every_selected_rectangle`, `the_unlinked_corner_menus_fit_a_narrow_panel`, `an_unlinked_corner_radius_leaves_other_selected_shapes`, `a_rectangle_corner_kind_without_a_selected_rectangle_changes_nothing`, `rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo`). + - **Rectangle Properties corner type:** a live rectangle's Rectangle Properties (Transform panel, the Properties panel's Transform section and the Contextual Task Bar's Shape Properties) have a Corner menu with Round, Inverted Round and Chamfer. With Corner Radius linked, one menu sets the kind of every corner of each selected rectangle, also corners with no radius, and shows blank when the shown rectangle's kinds differ; unlinked, each corner's row has its own menu beside its radius field, or under it in a panel too narrow for both; the unlinked radius fields and menus leave other selected paths and polygons as they are. A pick is one undo step, and picking the kind the corners already have adds none (`object.setLiveShape {kind, rectanglesOnly, corners}`); an action that records them acts on the rectangles selected when it plays. The help page says a rectangle's corner type can be set for each corner or for all of them at once ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html)); tying the number of menus to the Corner Radius link, the blank value and the undo steps are VectorCraft's own rules (`a_rectangle_shows_linked_and_unlinked_corner_types`, `the_shape_properties_popup_changes_a_rectangle_corner_type`, `the_linked_corner_menu_sets_every_selected_rectangle`, `the_unlinked_corner_menus_fit_a_narrow_panel`, `an_unlinked_corner_radius_leaves_other_selected_shapes`, `a_rectangle_corner_kind_without_a_selected_rectangle_changes_nothing`, `rectangle_kind_menu_targets_all_or_one_corner_and_skips_noop_undo`, `rectangles_only_sets_the_selected_rectangles_when_an_action_plays`, `a_radius_reaches_a_rectangle_that_already_draws_it`). - **Blend spine Anchor Point tool (#2544):** on a selected blend, dragging a spine corner makes symmetric Smooth handles; the tool displays and picks existing spine handles when switched to, drags one independently or retracts it on click, and clicking a point with handles retracts both. The spine is edited live without moving its key objects. Windows native canvas checks and screenshots reviewed: symmetric and independent handles, corner/retraction, Shift constraints and perpendicular reshaping, tool switching, key preservation, Undo/Redo, save/reopen, hidden handles and overlapping Path/Blend priority (PR #2643). Behaviour reference: [public path-editing documentation](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html). - **Blend spine points by marquee:** with Direct Selection, a marquee picks the spine points inside it on a selected blend, the topmost one when several are selected, and the picked points drag together as Shift-clicked ones do; Shift-marquee adds points or takes picked ones away, a plain marquee around none of them drops the picks, and Escape during the marquee keeps them. Unselected, locked and hidden blends are skipped. The spine's points are anchor points edited with Direct Selection ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/modify-spine-of-blended-objects.html)), and a boundary drag with the tool selects anchor points ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/select-anchor-points-in-paths.html)); the rules for selected, topmost and Shift are VectorCraft's own (`crates/tools/src/direct/tests.rs`, `marquee_picks_selected_blend_spine_points_which_drag_together`, `shift_marquee_toggles_selected_blend_spine_points`, `marquee_skips_unselected_locked_and_hidden_blend_spines`, `escape_cancels_a_marquee_and_keeps_the_picked_spine_points`). When no selected object is a blend, the selected-spine checks of Direct Selection's hover, press and marquee, the Anchor Point tool and the Pen return at once instead of building every blend's spine first; on 20,000 paths and 200 blends with one path selected, 500 checks took 24 µs instead of 336 ms, and the results are the same (`the_selected_spine_check_builds_no_spine_without_a_selected_blend`, `the_selected_spine_check_matches_a_filter_of_every_spine`; `selected_spine_check_timing` times it). From f4fb0d187c50c952f2a460331d4ed86e37b15b34 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 19 Nov 2026 11:39:56 -0800 Subject: [PATCH 5/5] Transform: the corner command stops when the pending edit fails to settle set_rectangle_corners reported an error from finish_tool_edit and still ran object.setLiveShape on the selection. It now returns after reporting the error. --- crates/ui-egui/src/panels.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 48e3aa5005..e73a83e9e1 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -146,8 +146,13 @@ fn set_rectangle_corners(app: &mut VectorcraftApp, mut p: Value, corner: Option< p["corners"] = corner.map_or(json!([0, 1, 2, 3]), |k| json!([k])); // The edit the tool computes on another thread comes first: the rectangles are the ones // selected after it. - let r = app.session.finish_tool_edit(); - crate::canvas::apply_requests(app, r); + match app.session.finish_tool_edit() { + Ok(reqs) => crate::canvas::apply_requests(app, Ok(reqs)), + Err(e) => { + app.status(e.to_string()); + return; + } + } if app.session.active().is_none() { return; }