Path mode: a click opens no Create dialog

CodeRabbit on #9456 (outside-diff comment, canvas.rs 6814): in Path mode
a click on Rectangle, Ellipse, Triangle or Polygon still opened the
Create dialog, whose OK makes a shape layer; Path mode never draws one.
The dialog now opens in Shape mode only.

Test: a_path_mode_click_opens_no_create_dialog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hector VillarrealandClaude Opus 5.5 committed 2026-11-02 11:22:07 -06:00
1 parent 9a0dd2a554
commit e81e7cd1dc
3 files changed
+18 -2

No files matched your search

+3 -1
View File
@@ -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),
@@ -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");
}
}
+1 -1
View File
@@ -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;