mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Magnetic Lasso: a border on another document holds back no menu (#11689)
The right-click check asked only whether a border existed. Over the control channel no frame runs between events, so a border left on one document stayed in place after a switch and kept the selection menu from opening on the next. The check, now magnetic_lasso_ui::drawing, also asks that the border belongs to the document in front, the same test frame() uses to drop a stale border. The canvas, the control channel and frame() share it. agent_right_click_on_another_document_still_opens_the_selection_menu fails without this change. The context-menu parity doc records the behaviour.
This commit is contained in:
1 parent
14a27b360f
commit
8519977bc1
5 files changed
+31
-6
No files matched your search
@@ -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
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) |
|
||||
|
||||
Reference in new issue
Block a user