From a8a3c39ea69ac6af241a3dbca1888f4a8c8f39d8 Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Sun, 25 Oct 2026 08:23:41 -0600 Subject: [PATCH] Path mode's Radius sets the next outline only CodeRabbit on #9456: with a shape layer active, the Radius field in Path mode read and edited that layer. In Path mode the options bar now has no selected-shape target, so Radius only sets the next outline's radius. Test: path_mode_radius_leaves_the_active_shape_layer_alone Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/tools/shape_options.rs | 3 ++- .../src/tools/vector_ui/paint_tests.rs | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/tools/shape_options.rs b/crates/ui-egui/src/tools/shape_options.rs index 0a25de23870..8aabe459229 100644 --- a/crates/ui-egui/src/tools/shape_options.rs +++ b/crates/ui-egui/src/tools/shape_options.rs @@ -42,7 +42,8 @@ pub(crate) fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui, tool: Tool crate::widgets::scrub_option_label(ui, &label); }; let o = &mut app.ui.tool_options; - let target = selected_shape(&app.session); + // Path mode edits only the next outline: an active shape layer is not the target. + let target = if paint { selected_shape(&app.session) } else { None }; // Fill and Stroke edit the selected shape layer too (#3347), and still set the next shape's. let (fg, bg) = (app.session.tools.foreground, app.session.tools.background); let (mut has_fill, fill, stroke) = match &target { diff --git a/crates/ui-egui/src/tools/vector_ui/paint_tests.rs b/crates/ui-egui/src/tools/vector_ui/paint_tests.rs index 1dfbe44a546..7d99cda456e 100644 --- a/crates/ui-egui/src/tools/vector_ui/paint_tests.rs +++ b/crates/ui-egui/src/tools/vector_ui/paint_tests.rs @@ -1009,3 +1009,29 @@ fn path_mode_keeps_the_geometry_options_and_hides_paint() { } } } + +/// CodeRabbit on #9456: in Path mode the Radius field sets the next outline's radius only; it +/// must not edit a shape layer that happens to be active. +#[test] +fn path_mode_radius_leaves_the_active_shape_layer_alone() { + let mut app = app("rgb", 8); + app.run("shape.create", json!({"kind": "rect", "rect": [20, 20, 60, 40], "radii": 10})).unwrap(); + let radii = |app: &PhotocraftApp| match &shape(app).live { + Some(photocraft_doc::LiveShape::Rect { radii, .. }) => *radii, + other => panic!("expected a live rectangle, got {other:?}"), + }; + assert_eq!(radii(&app), [10.0; 4]); + app.ui.tool_options.corner_radius = 3.0; + app.ui.tool_options.shape_mode = "path".into(); + let history = app.session.active().unwrap().history.past_len(); + let mut h = harness(app, false); + h.get_all_by_role(egui::accesskit::Role::SpinButton).next().expect("the radius").click(); + h.run(); + h.key_press_modifiers(Modifiers::COMMAND, Key::A); + h.event(Event::Text("20".into())); + h.key_press(Key::Enter); + h.run_steps(3); + assert_eq!(h.state().ui.tool_options.corner_radius, 20.0, "the next outline's radius"); + assert_eq!(radii(h.state()), [10.0; 4], "the shape layer keeps its radius"); + assert_eq!(h.state().session.active().unwrap().history.past_len(), history, "no edit"); +}