diff --git a/crates/ui-egui/src/tools/anchor_tools/delete_anchor_targeted_path_tests.rs b/crates/ui-egui/src/tools/anchor_tools/delete_anchor_targeted_path_tests.rs index dbe47aeeff..5a48b6756f 100644 --- a/crates/ui-egui/src/tools/anchor_tools/delete_anchor_targeted_path_tests.rs +++ b/crates/ui-egui/src/tools/anchor_tools/delete_anchor_targeted_path_tests.rs @@ -93,3 +93,16 @@ fn with_a_saved_path_selected_a_click_on_the_active_shape_does_nothing() { assert_eq!(shape_path(&mut app, shape), before); assert_eq!(steps(&app), n); } + +#[test] +fn with_the_work_path_selected_a_click_on_the_active_shape_does_nothing() { + let (mut app, shape) = setup(Tool::DeleteAnchorPoint); + select_layer(&mut app, shape); + let path = json!({"subpaths": [{"closed": true, "knots": [[50, 450], [150, 450], [150, 550], [50, 550]]}]}); + app.run("path.set", json!({"path": path})).unwrap(); + app.ui.selected_path = Some("work".into()); + let (before, n) = (shape_path(&mut app, shape), steps(&app)); + click(&mut app, [650.0, 250.0]); + assert_eq!(shape_path(&mut app, shape), before); + assert_eq!(steps(&app), n); +} diff --git a/crates/ui-egui/src/tools/direct_select.rs b/crates/ui-egui/src/tools/direct_select.rs index 1e834c51cd..0ece93cf6f 100644 --- a/crates/ui-egui/src/tools/direct_select.rs +++ b/crates/ui-egui/src/tools/direct_select.rs @@ -353,11 +353,13 @@ pub(crate) fn hit_target(app: &PhotocraftApp, p: [f64; 2], handles: bool) -> Opt pub(crate) fn hit_active(app: &PhotocraftApp, p: [f64; 2]) -> Option<(PathRef, Path, Hit)> { let tol = 6.0 / f64::from(app.point_zoom().max(0.01)); let st = app.session.active()?; - // A path selected in the Paths panel is the only target; otherwise the Pen draft first (as + // A path selected in the Paths panel (saved or Work Path) is the only target; otherwise the Pen draft first (as // `candidates` builds it), then the active paths. The draft's destination is private to // `vector_ui`, so it is not filtered here. let targets: Vec<(PathRef, Path)> = match crate::vector_ui::selected_saved_path_index(app) { Some((i, path)) => Some((PathRef::Saved(i), path)).filter(|(r, _)| writable(app, r)).into_iter().collect(), + // The Work Path selected in the Paths panel is the only target too, as for Path Selection. + None if app.ui.selected_path.as_deref() == Some("work") => active_paths(app).into_iter().filter(|(r, _)| *r == PathRef::Work).collect(), None => { let pen = app .ui