diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index dca3941de9..6c9af248e4 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -913,7 +913,7 @@ fn handle_canvas_tool_menus(app: &mut PhotocraftApp, input: &CanvasToolInput<'_> } // A Magnetic Lasso border being drawn: no menu over it, and the border stays live, as in // Photoshop (#11689). - let magnetic_drawing = tool == Tool::MagneticLasso && app.ui.magnetic.active(); + let magnetic_drawing = crate::magnetic_lasso_ui::drawing(app); if right_click && !lasso_retracted && !transforming diff --git a/crates/ui-egui/src/control/dispatch.rs b/crates/ui-egui/src/control/dispatch.rs index 888d9fe661..13f462f25f 100644 --- a/crates/ui-egui/src/control/dispatch.rs +++ b/crates/ui-egui/src/control/dispatch.rs @@ -1437,7 +1437,7 @@ fn secondary_canvas_menu_took(app: &mut PhotocraftApp, ctx: &egui::Context, g: & let (x, y) = (s.x, s.y); let down = matches!(s.ev, ToolEvent::Down { .. }); // A Magnetic Lasso border being drawn: no menu over it, as on the canvas (#11689). - if app.ui.tool == crate::state::Tool::MagneticLasso && app.ui.magnetic.active() { + if crate::magnetic_lasso_ui::drawing(app) { return true; } if crate::canvas_tool_menu::pasteboard_at(app, app.ui.tool, [x, y]) { diff --git a/crates/ui-egui/src/tools/magnetic_lasso_ui.rs b/crates/ui-egui/src/tools/magnetic_lasso_ui.rs index 28ef343212..442c5dbf34 100644 --- a/crates/ui-egui/src/tools/magnetic_lasso_ui.rs +++ b/crates/ui-egui/src/tools/magnetic_lasso_ui.rs @@ -365,10 +365,17 @@ pub fn replaces_selection(app: &PhotocraftApp) -> bool { app.ui.magnetic.active() && app.ui.magnetic.mode == "replace" } +/// The Magnetic Lasso is drawing a border on the document in front. A border left behind by a +/// tool or document switch doesn't count, even before [`frame`] drops it: the control channel's +/// events run no frame. +pub fn drawing(app: &PhotocraftApp) -> bool { + let m = &app.ui.magnetic; + m.active() && app.ui.tool == Tool::MagneticLasso && app.session.active().map(|d| d.doc.id.0) == Some(m.doc) +} + /// Once a frame: a border left behind by a tool or document switch is dropped. pub fn frame(app: &mut PhotocraftApp) { - let m = &app.ui.magnetic; - if m.active() && (app.ui.tool != Tool::MagneticLasso || app.session.active().map(|d| d.doc.id.0) != Some(m.doc)) { + if app.ui.magnetic.active() && !drawing(app) { cancel(app); } } diff --git a/crates/ui-egui/tests/it/magnetic_lasso_right_click.rs b/crates/ui-egui/tests/it/magnetic_lasso_right_click.rs index 27fbff4588..99dd83997a 100644 --- a/crates/ui-egui/tests/it/magnetic_lasso_right_click.rs +++ b/crates/ui-egui/tests/it/magnetic_lasso_right_click.rs @@ -77,6 +77,23 @@ fn agent_right_click_while_drawing_opens_no_menu_and_keeps_the_border() { assert!(sel.sample_channel(150, 100, 0) > 0.9, "the inside is selected"); } +#[test] +fn agent_right_click_on_another_document_still_opens_the_selection_menu() { + // A border left on the first document doesn't hold the menu back on the second: the agent's + // events run no frame, so nothing has dropped that border yet. + let mut app = app(); + agent_click(&mut app, CORNERS[0], "left", false); + agent_click(&mut app, CORNERS[1], "left", true); + app.run("file.new", json!({"width": 400, "height": 300})).expect("second document"); + app.sync_views(); + assert!(app.ui.magnetic.active(), "the first document's border is still there"); + + agent_click(&mut app, INSIDE, "right", false); + let (_, menu) = inspect(&mut app); + let entries = menu["entries"].as_array().expect("the selection menu opened"); + assert!(entries.iter().any(|e| e["id"] == "select.all"), "{menu}"); +} + #[test] fn agent_right_click_without_a_border_still_opens_the_selection_menu() { let mut app = app(); diff --git a/docs/context-menu-parity.md b/docs/context-menu-parity.md index 1ef971ef33..c0eca73f08 100644 --- a/docs/context-menu-parity.md +++ b/docs/context-menu-parity.md @@ -1,6 +1,6 @@ # Context-menu parity contract -> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-21 · **Change:** minor (Crop tool menu on a pending crop, #6561; Zoom tool menu order, #6005; Type tool menu over committed type, #7324; earlier: Path Selection canvas menu, #1056; pasteboard row: the menu exists, #2462) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-11-06 · **Change:** minor (Magnetic Lasso: no menu over a border being drawn, #11689; earlier: Crop tool menu on a pending crop, #6561; Zoom tool menu order, #6005; Type tool menu over committed type, #7324; earlier: Path Selection canvas menu, #1056; pasteboard row: the menu exists, #2462) · **Target:** Adobe Photoshop 2026 Status: implementation contract, updated 2026-10-09. Scope: canvas, document tabs, and panels. “Right-click” means a secondary pointer click; macOS Control-click should also open the same menu where the platform sends a context-menu gesture. Photoshop changes a context menu with the active tool, selection, and panel item. Adobe documents that principle but does not publish a complete current menu catalog. **Documented** means an Adobe source explicitly names the gesture or action. **Inferred** means a PhotoCraft design target or an item known from a main menu whose presence in a Photoshop context menu still needs a current-product capture. Do not present inferred rows as exact Photoshop menus. [Adobe: panels and menus](https://helpx.adobe.com/photoshop/using/panels-menus.html), [Adobe: shortcuts and context menus](https://helpx.adobe.com/sa_en/photoshop/using/customizing-keyboard-shortcuts.html). @@ -21,7 +21,7 @@ The “PhotoCraft at branch point” column records behavior before this PR. Pic | Tool(s) in PhotoCraft | Photoshop / desired contextual action | PhotoCraft at branch point | Priority, evidence | |---|---|---|---| | Move | Choose a layer at the point; an auto-select choice also exists in the options bar | Layers | P0; [Adobe layer movement](https://helpx.adobe.com/photoshop/using/moving-stacking-locking-layers.html); exact pop-up layout requires capture | -| Rectangular/Elliptical Marquee, Lasso, Polygonal Lasso, Magnetic Lasso, Magic Wand, Quick Selection, Object Selection | Active selection: the 2026 selection menu (see *Selection canvas reference* below); no selection: making a selection | Quick Selection: Picker (a brush tool, as in Photoshop); the other six: the selection menu below (#614, #738) | P1; no-selection variant still needs a dated capture | +| Rectangular/Elliptical Marquee, Lasso, Polygonal Lasso, Magnetic Lasso, Magic Wand, Quick Selection, Object Selection | Active selection: the 2026 selection menu (see *Selection canvas reference* below); no selection: making a selection | Quick Selection: Picker (a brush tool, as in Photoshop); the other six: the selection menu below (#614, #738). A Magnetic Lasso border being drawn gets no menu, and the border stays live (measured in Photoshop, #11689); ⌘/Ctrl+right-click still lists the layers | P1; no-selection variant still needs a dated capture | | Crop | During crop: ratio/preset, overlay, clear/reset, commit/cancel **(inferred context placement)** | On a pending crop (canvas_tool_menu.rs `crop_rows`, #6561): the options bar's preset dropdown in its order (Ratio, W x H x Resolution, the ratios, the size presets, saved crop presets, Front Image), Clear, New/Delete Crop Preset…, the six overlays and Auto/Always/Never Show Overlay (checked as in the bar), Cancel and Crop; also outside the image while a crop is pending. The untouched default frame has no menu. Esc closes only the menu. Reset remains open (no reset of frame, rotation and ratio yet, nor the options bar's ↺). Photoshop's menu also lists Reset Crop and Rotate Crop Box ([Kost](https://jkost.com/blog/2017/05/essential-tips-for-cropping-in-photoshop-cc.html)); both missing | P1; pending crop target; item list still needs a dated Photoshop capture | | Eyedropper | Sample-size/source choices **(inferred)** | No tool menu | P2; [Adobe illustration uses Eyedropper](https://helpx.adobe.com/photoshop/using/panels-menus.html), but does not publish item text | | Ruler, Note, Count | Unit / measurement, note edit/delete, count-group operations **(inferred)** | No tool menu | P2 | @@ -100,6 +100,7 @@ Each slice needs pure model tests (including every item dispatching a known comm | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | Magnetic Lasso: no menu over a border being drawn (#11689) | | 2026-10-21 | minor | Crop tool menu on a pending crop (#6561) | | 2026-10-20 | trivial | Zoom tool menu order (#6005) | | 2026-10-18 | minor | Type tool menu over committed type (#7324) |