diff --git a/crates/ui-egui/src/canvas/gesture.rs b/crates/ui-egui/src/canvas/gesture.rs index 6e4e015d9f..eb6dc447e2 100644 --- a/crates/ui-egui/src/canvas/gesture.rs +++ b/crates/ui-egui/src/canvas/gesture.rs @@ -86,8 +86,10 @@ pub(crate) fn finish_gesture(app: &mut PhotocraftApp, d: Drag) { crate::vector_ui::freeform_finish_owned(app, &d.points, d.lasso.as_ref().map_or(&[], |l| l.straight()), owner); } } - // Photoshop: a click without dragging opens Create Rectangle / Ellipse / … instead. + // Photoshop: a click without dragging opens Create Rectangle / Ellipse / … instead. Not in + // Path mode: the dialog makes a shape layer, and Path mode never draws one. t if crate::vector_ui::is_shape_tool(t) + && !crate::vector_ui::draws_path(&app.ui.tool_options) && crate::shape_dialog::is_click(d.start, &d.points, app.point_zoom()) && crate::shape_dialog::open(app, t, d.start).is_some() => {} t if crate::vector_ui::is_shape_tool(t) => crate::vector_ui::finish_shape(app, t, d.start, [end[0], end[1]], d.live), diff --git a/crates/ui-egui/src/dialogs/shape_dialog/tests.rs b/crates/ui-egui/src/dialogs/shape_dialog/tests.rs index 7af252f087..9f02db8bb6 100644 --- a/crates/ui-egui/src/dialogs/shape_dialog/tests.rs +++ b/crates/ui-egui/src/dialogs/shape_dialog/tests.rs @@ -354,3 +354,17 @@ fn right_click_picks_the_unit_of_that_field_only_and_it_is_not_remembered() { let s = sides(&frame(&egui::Context::default(), &app, &mut f, vec![])); assert_eq!(shown(&s), [("1.76".to_string(), "cm".to_string()), ("3.53".to_string(), "cm".to_string())]); } + +/// CodeRabbit on #9456: in Path mode a click opens no Create dialog, whose OK would make a shape +/// layer; Path mode never draws one (a drag adds its outline to the work path). +#[test] +fn a_path_mode_click_opens_no_create_dialog() { + for tool in [Tool::Rectangle, Tool::EllipseShape, Tool::Triangle, Tool::Polygon] { + let mut app = app(); + app.ui.tool_options.shape_mode = "path".into(); + let before = layers(&app); + press(&mut app, tool, [20.4, 30.2], [20.4, 30.2]); + assert!(app.ui.dialogs.is_empty(), "{tool:?}: no Create dialog in Path mode"); + assert_eq!(layers(&app), before, "{tool:?}: and no layer"); + } +} diff --git a/crates/ui-egui/src/tools/vector_ui.rs b/crates/ui-egui/src/tools/vector_ui.rs index 0749b87434..2d8e51b44e 100644 --- a/crates/ui-egui/src/tools/vector_ui.rs +++ b/crates/ui-egui/src/tools/vector_ui.rs @@ -30,7 +30,7 @@ pub(crate) use curvature::curvature_anchor_at; pub use curvature::{curvature_down, curvature_move, curvature_toggle, curvature_up}; #[cfg(test)] use options::{corner_radii_patch, solid_paint}; -pub(crate) use options::{enabled_stroke_width, paint_gesture}; +pub(crate) use options::{draws_path, enabled_stroke_width, paint_gesture}; pub use options::{options_bar, shape_properties}; pub use overlay::draw_overlay; pub(crate) use overlay::selected_saved_path_index;