From 6bca6cb51e55675110366e381a65e7fae20c875c Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Sat, 21 Nov 2026 00:18:56 +0530 Subject: [PATCH 1/5] Variables panel: add row context menu --- crates/engine/src/cmd/variablecmds.rs | 8 +- crates/ui-egui/src/panels/variables.rs | 208 ++++++++++++++++++++++++- docs/gaps.md | 5 + docs/target-app-parity.md | 4 + 4 files changed, 220 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/variablecmds.rs b/crates/engine/src/cmd/variablecmds.rs index ea6647b7a4..db1a641f2f 100644 --- a/crates/engine/src/cmd/variablecmds.rs +++ b/crates/engine/src/cmd/variablecmds.rs @@ -23,7 +23,10 @@ use vectorcraft_doc::{DataSet, DataValue, Document, NodeId, NodeKind, Selection, use super::edit::selected_roots; use super::fileio::{absolute_path, read_file_head, write_file}; use super::textedit::set_story_text; -use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, checked_ids_or_selection, cmd, has_doc, has_selection, links, str_param}; +use super::{ + CommandSpec, EngineError, Result, Session, bad, bool_or, checked_ids_or_selection, checked_ids_param, cmd, has_doc, has_selection, links, + str_param, +}; mod csv; mod library; @@ -435,7 +438,8 @@ fn bind(s: &mut Session, p: &Value) -> Result { fn unbind(s: &mut Session, p: &Value) -> Result { const C: &str = "variable.unbind"; - let ids = checked_ids_or_selection(s, p, C)?; + // Explicit bindings can include both a group and its children; retain every supplied ID. + let ids = if p.get("ids").is_some_and(|v| !v.is_null()) { checked_ids_param(s, p, "ids", C)? } else { checked_ids_or_selection(s, p, C)? }; let name = defined_variable(s, p, C)?; let n = edit_variables(s, "Unbind Variable", |vars| { let mut n = 0; diff --git a/crates/ui-egui/src/panels/variables.rs b/crates/ui-egui/src/panels/variables.rs index 1b6561f550..2d7e7568ac 100644 --- a/crates/ui-egui/src/panels/variables.rs +++ b/crates/ui-egui/src/panels/variables.rs @@ -94,12 +94,16 @@ fn headers(ui: &mut Ui, sort: VariableSort) -> Option { fn variable_row(ui: &mut Ui, row: &VarRow, selected: bool) -> Response { let t = Tokens::get(ui.ctx()); let h = ui.spacing().interact_size.y; - let (rect, r) = ui.allocate_exact_size(vec2(ui.available_width(), h), Sense::click()); + let (_, rect) = ui.allocate_space(vec2(ui.available_width(), h)); + let r = ui.interact(rect, ui.scope_id().with(("variable-row", &row.name)), Sense::click()); if selected { ui.painter().rect_filled(rect, 0.0, t.row_selected); } else if r.hovered() { ui.painter().rect_filled(rect, 0.0, t.hover); } + if r.has_focus() { + ui.painter().rect_stroke(rect, 0.0, egui::Stroke::new(1.0, t.accent), egui::StrokeKind::Inside); + } // The kind's own icon, so a text variable and a visibility one read apart. let icon = match row.kind { VariableKind::Text => "type", @@ -389,6 +393,51 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if r.double_clicked() && !locked { crate::dialogs::variables::open(app, "variable.rename", Some(&row.name)); } + // Highlight without selecting the bound art: dynamic actions use the canvas selection. + let keyboard_menu = r.has_focus() && ui.input_mut(|i| i.consume_key(egui::Modifiers::SHIFT, egui::Key::F10)); + if r.secondary_clicked() || keyboard_menu { + app.run("variable.highlight", json!({"variable": row.name})).ok(); + r.request_focus(); + } + let popup_id = egui::Popup::default_response_id(&r); + if keyboard_menu { + egui::Popup::open_id(ui.ctx(), popup_id); + } + let popup = egui::Popup::context_menu(&r); + // Keyboard-opened menus have no saved pointer position: anchor them to the row. + let popup = if r.context_menu_opened() && egui::Popup::position_of_id(ui.ctx(), popup_id).is_none() { popup.anchor(&r) } else { popup }; + popup.show(|ui| { + if widgets::menu_item(ui, tl!("Select Bound Object"), !row.bound.is_empty(), false) { + app.run("variable.highlight", json!({"variable": row.name})).ok(); + select_bound_object(app); + ui.close(); + } + if widgets::menu_item(ui, tl!("Variable Options…"), !locked, false) { + crate::dialogs::variables::open(app, "variable.rename", Some(&row.name)); + ui.close(); + } + if widgets::menu_item(ui, tl!("Unbind Variable"), !row.bound.is_empty() && !locked, false) { + app.run("variable.unbind", json!({"ids": row.bound, "variable": row.name})).ok(); + ui.close(); + } + ui.separator(); + for (label, command, enabled) in [ + (tl!("Make Text Dynamic"), "variable.makeTextDynamic", single_type), + (tl!("Make Visibility Dynamic"), "variable.makeVisibilityDynamic", has_selection), + (tl!("Make Image Dynamic"), "variable.makeImageDynamic", single_image), + (tl!("Make Graph Dynamic"), "variable.makeGraphDynamic", selection_graph), + ] { + if widgets::menu_item(ui, label, enabled && !locked, false) { + app.run(command, json!({})).ok(); + ui.close(); + } + } + ui.separator(); + if widgets::menu_item(ui, tl!("Delete Variable"), !locked, false) { + app.run("variable.delete", json!({"names": [row.name]})).ok(); + ui.close(); + } + }); } widgets::subheader(ui, tl!("Data Sets")); @@ -684,10 +733,14 @@ mod tests { /// Clicks the center of `node`. fn click(&mut self, app: &mut VectorcraftApp, node: &egui::accesskit::Node) { - use egui::{Event, Modifiers, PointerButton}; + self.click_button(app, node, egui::PointerButton::Primary); + } + + fn click_button(&mut self, app: &mut VectorcraftApp, node: &egui::accesskit::Node, button: egui::PointerButton) { + use egui::{Event, Modifiers}; let b = node.bounds().expect("bounds"); let pos = egui::pos2((b.x0 + b.x1) as f32 * 0.5, (b.y0 + b.y1) as f32 * 0.5); - let (button, none) = (PointerButton::Primary, Modifiers::default()); + let none = Modifiers::default(); self.frame(app, vec![Event::PointerMoved(pos), Event::PointerButton { pos, button, pressed: true, modifiers: none }]); self.frame(app, vec![Event::PointerButton { pos, button, pressed: false, modifiers: none }]); self.frame(app, vec![]); @@ -707,6 +760,155 @@ mod tests { } } + fn open_row_menu(d: &mut Driver, app: &mut VectorcraftApp, name: &str) -> Vec { + let nodes = d.nodes(app); + let row = nodes.iter().find(|(_, n)| n.role() == egui::accesskit::Role::ListItem && n.label() == Some(name)).expect("variable row"); + d.click_button(app, &row.1, egui::PointerButton::Secondary); + d.nodes(app).into_iter().filter(|(id, _)| !nodes.iter().any(|(before, _)| before == id)).map(|(_, n)| n).collect() + } + + fn menu_button(nodes: &[egui::accesskit::Node], label: &str) -> egui::accesskit::Node { + nodes.iter().find(|n| n.role() == egui::accesskit::Role::Button && n.label().is_some_and(|s| s.trim() == label)).expect(label).clone() + } + + #[test] + fn right_click_highlights_row_and_select_bound_object_uses_it() { + let mut app = app_with_data(); + app.run("variable.define", json!({"name": "Other", "kind": "visibility"})).unwrap(); + app.run("variable.highlight", json!({"variable": "Other"})).unwrap(); + app.run("select.set", json!({"ids": []})).unwrap(); + let mut d = Driver::new(); + let nodes = open_row_menu(&mut d, &mut app, "Name · Alice"); + let st = app.session.active().unwrap(); + assert_eq!(highlighted_row(st).as_deref(), Some("Name")); + assert!(st.selection.objects.is_empty(), "right click must preserve canvas selection"); + let bound = st.doc.variables.objects_of("Name"); + app.run("variable.highlight", json!({"variable": "Other"})).unwrap(); + d.click(&mut app, &menu_button(&nodes, "Select Bound Object")); + assert_eq!(app.session.active().unwrap().selection.objects, bound); + } + + #[test] + fn keyboard_opens_focused_row_menu_without_changing_canvas_selection() { + use egui::{Event, Key, Modifiers}; + let mut app = app_with_data(); + let selected = app.session.active().unwrap().selection.objects.clone(); + let mut d = Driver::new(); + let nodes = d.nodes(&mut app); + let row_id = nodes.iter().find(|(_, n)| n.role() == egui::accesskit::Role::ListItem).unwrap().0; + let key = |key, modifiers| Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }; + for _ in 0..20 { + if d.ctx.memory(|m| m.focused()).is_some_and(|id| id.value() == row_id.0) { + break; + } + d.frame(&mut app, vec![key(Key::Tab, Modifiers::NONE)]); + d.frame(&mut app, vec![]); + } + assert!(d.ctx.memory(|m| m.focused()).is_some_and(|id| id.value() == row_id.0), "Tab must focus the variable row"); + d.frame(&mut app, vec![key(Key::F10, Modifiers::SHIFT)]); + let nodes = d.nodes(&mut app).into_iter().map(|(_, n)| n).collect::>(); + assert!(egui::Popup::is_any_open(&d.ctx)); + assert!(!menu_button(&nodes, "Select Bound Object").is_disabled()); + assert_eq!(highlighted_row(app.session.active().unwrap()).as_deref(), Some("Name")); + assert_eq!(app.session.active().unwrap().selection.objects, selected); + d.frame(&mut app, vec![key(Key::Escape, Modifiers::NONE)]); + assert!(!egui::Popup::is_any_open(&d.ctx)); + } + + #[test] + fn context_menu_deletes_clicked_variable_in_one_undo_step() { + let mut app = app_with_data(); + app.run("variable.define", json!({"name": "Other", "kind": "visibility"})).unwrap(); + app.run("variable.highlight", json!({"variable": "Other"})).unwrap(); + let before = undo_steps(&app); + let mut d = Driver::new(); + let nodes = open_row_menu(&mut d, &mut app, "Name · Alice"); + // A command can change the highlight while this row's menu remains open. + app.run("variable.highlight", json!({"variable": "Other"})).unwrap(); + app.run("variable.sort", json!({"by": "name", "descending": true})).unwrap(); + d.frame(&mut app, vec![]); + d.click(&mut app, &menu_button(&nodes, "Delete Variable")); + let st = app.session.active().unwrap(); + assert!(st.doc.variables.variable("Name").is_none()); + assert!(st.doc.variables.variable("Other").is_some()); + assert_eq!(undo_steps(&app), before + 1); + app.run("edit.undo", json!({})).unwrap(); + assert!(app.session.active().unwrap().doc.variables.variable("Name").is_some()); + assert!(!app.session.active().unwrap().doc.variables.objects_of("Name").is_empty()); + } + + #[test] + fn context_menu_unbinds_only_clicked_variable() { + let mut app = app_with_data(); + let bound = app.session.active().unwrap().doc.variables.objects_of("Name"); + app.run("variable.define", json!({"name": "Visible", "kind": "visibility"})).unwrap(); + app.run("variable.bind", json!({"variable": "Visible", "ids": [bound[0].0]})).unwrap(); + let before = undo_steps(&app); + let mut d = Driver::new(); + let nodes = open_row_menu(&mut d, &mut app, "Name · Alice"); + d.click(&mut app, &menu_button(&nodes, "Unbind Variable")); + let st = app.session.active().unwrap(); + assert!(st.doc.variables.objects_of("Name").is_empty()); + assert_eq!(st.doc.variables.objects_of("Visible"), bound); + assert_eq!(undo_steps(&app), before + 1); + app.run("edit.undo", json!({})).unwrap(); + assert_eq!(app.session.active().unwrap().doc.variables.objects_of("Name"), bound); + } + + #[test] + fn context_menu_unbinds_both_group_and_nested_object() { + let mut app = app_with_data(); + let text = app.session.active().unwrap().doc.variables.objects_of("Name")[0]; + let rect = app.run("shape.rectangle", json!({"x": 100, "y": 100, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [text.0, rect]})).unwrap(); + let group = app.run("object.group", json!({})).unwrap()["id"].as_u64().unwrap(); + app.run("variable.define", json!({"name": "Visible", "kind": "visibility"})).unwrap(); + // Bind separately so both the group and its child have the variable. + for id in [group, text.0] { + app.run("variable.bind", json!({"variable": "Visible", "ids": [id]})).unwrap(); + } + assert_eq!(app.session.active().unwrap().doc.variables.objects_of("Visible").len(), 2); + let before = undo_steps(&app); + let mut d = Driver::new(); + let nodes = open_row_menu(&mut d, &mut app, "Visible · Multiple objects"); + d.click(&mut app, &menu_button(&nodes, "Unbind Variable")); + assert!(app.session.active().unwrap().doc.variables.objects_of("Visible").is_empty()); + assert_eq!(undo_steps(&app), before + 1); + assert_eq!(app.session.active().unwrap().doc.variables.objects_of("Name"), vec![text]); + app.run("edit.undo", json!({})).unwrap(); + assert_eq!(app.session.active().unwrap().doc.variables.objects_of("Visible").len(), 2); + } + + #[test] + fn context_menu_disables_edits_when_locked_and_selection_actions_when_empty() { + let mut app = app_with_data(); + app.run("variable.lock", json!({})).unwrap(); + let mut d = Driver::new(); + let nodes = open_row_menu(&mut d, &mut app, "Name · Alice"); + assert!(!menu_button(&nodes, "Select Bound Object").is_disabled()); + for label in [ + "Variable Options…", + "Unbind Variable", + "Make Text Dynamic", + "Make Visibility Dynamic", + "Make Image Dynamic", + "Make Graph Dynamic", + "Delete Variable", + ] { + assert!(menu_button(&nodes, label).is_disabled(), "{label}"); + } + let mut app = app_with_data(); + app.run("variable.define", json!({"name": "Unbound", "kind": "visibility"})).unwrap(); + app.run("select.set", json!({"ids": []})).unwrap(); + let nodes = open_row_menu(&mut Driver::new(), &mut app, "Unbound"); + for label in + ["Select Bound Object", "Unbind Variable", "Make Text Dynamic", "Make Visibility Dynamic", "Make Image Dynamic", "Make Graph Dynamic"] + { + assert!(menu_button(&nodes, label).is_disabled(), "{label}"); + } + assert!(!menu_button(&nodes, "Delete Variable").is_disabled()); + } + fn set_names(app: &mut VectorcraftApp) -> Vec { let sets = app.run("dataset.list", json!({})).unwrap(); sets["datasets"].as_array().unwrap().iter().map(|d| d["name"].as_str().unwrap_or_default().to_string()).collect() diff --git a/docs/gaps.md b/docs/gaps.md index 618b48ff4c..ce471c2c73 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -10,6 +10,8 @@ ## Feature submission evidence +Variables panel row context menus (2026-11-20, G12): Right-click highlights the clicked variable without changing the canvas selection and offers Select Bound Object, Variable Options…, Unbind Variable, the four Make Dynamic actions, and Delete Variable. Shift+F10 opens the same menu for the focused row; Escape dismisses it. Row actions target that variable; dynamic actions use the canvas selection. Lock and selection checks disable unavailable actions. Headless pointer/accessibility tests cover opening the menu, highlighting, bound-object selection, deletion in one undo step and restoration, and disabled actions. Scores and estimates unchanged. + Actions panel item context menus (2026-11-20): Right-clicking an Action Set row selects it and presents a context menu with New Action…, New Set…, Duplicate Set, Delete Set, and Set Options…. Right-clicking an Action row selects it and presents a context menu with Play, Record, Duplicate, Delete, Action Options…, and Batch…. Duplicate on an action duplicates that action and selects the duplicate; Delete removes it. Headless tests in `crates/ui-egui/src/panels/actions.rs`: `right_clicking_an_action_set_selects_it_and_presents_set_context_options`, `right_clicking_an_action_selects_it_and_presents_action_options`, and `clicking_duplicate_on_an_action_duplicates_that_action_in_the_set`. Scores and estimates unchanged. **Scissors cut-point preview (#8655):** A native point marker shows the anchor or position on a curve that the current Scissors click targets, including the existing snapping rules. Hovering changes no artwork; an ineligible or stale hover has no marker. Existing cut and Alt Add Anchor behavior are retained. Focused tool and Session regressions live in `crates/tools/src/draw2/anchor/tests.rs` and `crates/engine/tests/scissors_snap.rs`. Scores and estimates are unchanged. @@ -58,6 +60,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-20 | minor | G12: Variables panel row context menus implemented with row highlighting, bound-object selection, options, unbinding, selection-based dynamic actions and single-step deletion; headless regression coverage. Scores and estimates unchanged. | | 2026-11-20 | minor | G12: Asset Export tiles have item context menus for Export, Remove, Rename, Select Artwork on Canvas and collecting selected artwork; right-click selects an unselected tile and preserves an existing multi-selection. Headless regressions: panels::tests_asset_export. Scores and estimates unchanged. | | 2026-11-20 | minor | G12: Properties panel Quick Actions include contextual text actions (Create Outlines, Retype, Find and Replace…); headless tests in crates/ui-egui/src/panels/properties/tests.rs; scores and estimates unchanged. | | 2026-11-20 | minor | G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged. | @@ -522,6 +525,8 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G12 Preferences and panels that don't act yet +Variables panel row context menus (2026-11-20, G12): Right-click highlights the clicked variable without changing the canvas selection and offers Select Bound Object, Variable Options…, Unbind Variable, the four Make Dynamic actions, and Delete Variable. Shift+F10 opens the same menu for the focused row; Escape dismisses it. Row actions target that variable; dynamic actions use the canvas selection. Lock and selection checks disable unavailable actions. Headless pointer/accessibility tests cover opening the menu, highlighting, bound-object selection, deletion in one undo step and restoration, and disabled actions. Scores and estimates unchanged. + - **Implemented (2026-11-20):** Asset Export tiles have item context menus: Export and Remove act on the asset selection (plural labels for multiple assets), Rename opens the clicked tile's inline field, Select Artwork on Canvas selects that tile's source nodes, and Add Selected Artwork as One Asset / Multiple Assets are enabled with canvas selection. A right-click selects an unselected tile, clearing the previous asset selection, and preserves a multi-selection when the tile is already selected. Export reuses the raster/3D export path; Remove is one undo step and keeps the artwork. Headless regression coverage: `crates/ui-egui/src/panels/tests_asset_export.rs`. Other G12 panel gaps remain; scores and estimates unchanged. - **Implemented and tested (2026-11-20):** Appearance panel row context menus: right-clicking stroke and fill rows offers Duplicate Stroke / Duplicate Fill, Delete Stroke / Delete Fill, and Hide Stroke/Show Stroke / Hide Fill/Show Fill; effect rows offer Edit Effect…, Duplicate Effect, Delete Effect, and Hide Effect / Show Effect; the root object row offers Clear Appearance and Reduce to Basic Appearance. Right-clicking an unselected row targets that row before presenting the menu. Item actions run in one undo step. Headless regression coverage: `crates/ui-egui/src/panels/tests_appearance.rs`. Scores and estimates unchanged. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 57ac87a396..c9a3f6c22f 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -30,6 +30,8 @@ ## Feature submission evidence +Variables panel row context menus (2026-11-20, G12): Right-click highlights the clicked variable without changing the canvas selection and offers Select Bound Object, Variable Options…, Unbind Variable, the four Make Dynamic actions, and Delete Variable. Shift+F10 opens the same menu for the focused row; Escape dismisses it. Row actions target that variable; dynamic actions use the canvas selection. Lock and selection checks disable unavailable actions. Headless pointer/accessibility tests cover opening the menu, highlighting, bound-object selection, deletion in one undo step and restoration, and disabled actions. Scores and estimates unchanged. + Actions panel item context menus (2026-11-20): Right-clicking an Action Set row selects it and presents a context menu with New Action…, New Set…, Duplicate Set, Delete Set, and Set Options…. Right-clicking an Action row selects it and presents a context menu with Play, Record, Duplicate, Delete, Action Options…, and Batch…. Duplicate on an action duplicates that action and selects the duplicate; Delete removes it. Headless tests in `crates/ui-egui/src/panels/actions.rs`: `right_clicking_an_action_set_selects_it_and_presents_set_context_options`, `right_clicking_an_action_selects_it_and_presents_action_options`, and `clicking_duplicate_on_an_action_duplicates_that_action_in_the_set`. Scores and estimates unchanged. **Scissors cut-point preview (#8655):** A native point marker shows the anchor or position on a curve that the current Scissors click targets, including the existing snapping rules. Hovering changes no artwork; an ineligible or stale hover has no marker. Existing cut and Alt Add Anchor behavior are retained. Focused tool and Session regressions live in `crates/tools/src/draw2/anchor/tests.rs` and `crates/engine/tests/scissors_snap.rs`. Scores and estimates are unchanged. @@ -77,6 +79,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-20 | minor | G12: Variables panel row context menus implemented with row highlighting, bound-object selection, options, unbinding, selection-based dynamic actions and single-step deletion; headless regression coverage. Scores and estimates unchanged. | | 2026-11-20 | minor | G12: Asset Export tiles have item context menus for Export, Remove, Rename, Select Artwork on Canvas and collecting selected artwork; right-click selects an unselected tile and preserves an existing multi-selection. Headless regressions: panels::tests_asset_export. Scores and estimates unchanged. | | 2026-11-20 | minor | G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged. | | 2026-11-20 | minor | G12: Appearance panel row context menus (Duplicate Stroke/Fill, Delete Stroke/Fill, Hide/Show Stroke/Fill, Edit Effect…, Duplicate Effect, Delete Effect, Hide/Show Effect, Clear Appearance, Reduce to Basic Appearance); right-clicking an unselected row targets that row first. Headless regressions: `panels::tests_appearance`. Scores and estimates unchanged. | @@ -947,6 +950,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Command API reference:** `engine.apiReference` returns a Markdown reference written from the parameter schemas when it is asked for, and MCP serves the same text as the resource `vectorcraft://commands/reference` (`text/markdown; charset=utf-8`). Each command that has a schema gets a section in registry order with its label, menu path, API levels, what it writes, summary and return, and a table of its parameters (type, range with its ends marked included or not, unit, default, required, levels and description; members of objects as dotted rows). Commands without a schema, plug-in commands included, are left out. Schema text is escaped so it stays plain text in its table cell, the same build always returns the same bytes, and a reference past 1 MiB is an error rather than a cut-short text. The command's own schema raised the API level to 2. This is a VectorCraft documentation feature; no score changes. Tests: `cmd::apiref::tests` and `schemas::tests` in `vectorcraft-engine`, `resources::tests` in `vectorcraft-mcp`. - **Tool option errors:** `tool.setOption` checks every option it is given before it sets any: an option the tool doesn't have, a value of the wrong type, a number outside the tool's range or an unknown choice is an error naming the tool and the option (``tool `smooth`: `fidelity` must be a number from 0.05 to 100``), and no option, saved preference or undo step changes; `{}` only reads. Most ranges are the ones each tool's setter clamped to; the Arc tool's `lengthX` and `lengthY` take more than 0 up to 1e6 and the Line tool's `length` 0 to 1e6, where a negative length was taken as its absolute value. The Live Paint tools' `width` and the Shape Builder's `gapLength` are still set to the nearest end of their range. A Tool Options dialog with a refused value stays open. This is VectorCraft's own rule; no score changes. Tests: `option_check::tests` in `vectorcraft-tools`, `tests::toolsettings` in `vectorcraft-engine`, `tests::liquify` in `vectorcraft-mcp`, `dialogs::freehand::tests::a_refused_fidelity_keeps_the_dialog_open`. - **Automation:** + - Variables panel row context menus (2026-11-20, G12): Right-click highlights the clicked variable without changing the canvas selection and offers Select Bound Object, Variable Options…, Unbind Variable, the four Make Dynamic actions, and Delete Variable. Shift+F10 opens the same menu for the focused row; Escape dismisses it. Row actions target that variable; dynamic actions use the canvas selection. Lock and selection checks disable unavailable actions. Headless pointer/accessibility tests cover opening the menu, highlighting, bound-object selection, deletion in one undo step and restoration, and disabled actions. Scores and estimates unchanged. - Variables: Update Data Set writes what the art holds into the active data set for the variables that data set holds, and keeps the data set's value for a text, image or graph variable whose objects are locked or inside a locked layer or group; `dataset.update {all: true}` also adds the other variables that the art reports a value for. - Variables: `dataset.select`, `dataset.next` and `dataset.prev` rewrite type and apply the other values on hidden objects and in hidden layers and groups, which stay hidden unless a visibility value shows them, so a layer shown later holds the selected data set's text; objects that are locked or in a locked layer or group are skipped, except by a visibility value. - Variables: a visibility variable binds a locked layer, a locked object and objects inside a locked layer or group, and `dataset.select`, `dataset.next` and `dataset.prev` show and hide them without unlocking them; `dataset.list`, `dataset.capture` and `dataset.update` read whether they show. A text, image or graph variable refuses locked art. From c344a9a9d25812078d19d4ec6840bd82369659dd Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:24:37 +0530 Subject: [PATCH 2/5] docs: reconcile Variables panel context-menu evidence --- docs/gaps.md | 6 ++---- docs/target-app-parity.md | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/gaps.md b/docs/gaps.md index ce471c2c73..e72c583797 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** minor (G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: G12: Properties panel Quick Actions include contextual text actions (Create Outlines, Retype, Find and Replace…); scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; G4 and G13 Missing lists drop the shipped Touch Type, Snap to Glyph and Dimension tool, and G13's snapping entry keeps only what is still missing, the partial Snapping panel and the items not yet checked (#8387); G13 keeps one estimate (13–23 h); estimates unchanged; previously: Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** minor (G12: Variables panel row context menus; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: G12: Properties panel Quick Actions include contextual text actions (Create Outlines, Retype, Find and Replace…); scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; G4 and G13 Missing lists drop the shipped Touch Type, Snap to Glyph and Dimension tool, and G13's snapping entry keeps only what is still missing, the partial Snapping panel and the items not yet checked (#8387); G13 keeps one estimate (13–23 h); estimates unchanged; previously: Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > Scissors snapping update (2026-11-11): with Alt released, hover and cuts use the Pen's path, alignment, intersection and anchor snaps (#6470). Scores and estimates unchanged. @@ -10,7 +10,7 @@ ## Feature submission evidence -Variables panel row context menus (2026-11-20, G12): Right-click highlights the clicked variable without changing the canvas selection and offers Select Bound Object, Variable Options…, Unbind Variable, the four Make Dynamic actions, and Delete Variable. Shift+F10 opens the same menu for the focused row; Escape dismisses it. Row actions target that variable; dynamic actions use the canvas selection. Lock and selection checks disable unavailable actions. Headless pointer/accessibility tests cover opening the menu, highlighting, bound-object selection, deletion in one undo step and restoration, and disabled actions. Scores and estimates unchanged. +- **Implemented and tested (2026-11-20, G12):** Variables panel row context menus: Right-click highlights the clicked variable without changing the canvas selection and offers Select Bound Object, Variable Options…, Unbind Variable, the four Make Dynamic actions, and Delete Variable. Shift+F10 opens the same menu for the focused row; Escape dismisses it. Row actions target that variable; dynamic actions use the canvas selection. Lock and selection checks disable unavailable actions. Headless pointer/accessibility tests cover opening the menu, highlighting, bound-object selection, deletion in one undo step and restoration, and disabled actions. Scores and estimates unchanged. Actions panel item context menus (2026-11-20): Right-clicking an Action Set row selects it and presents a context menu with New Action…, New Set…, Duplicate Set, Delete Set, and Set Options…. Right-clicking an Action row selects it and presents a context menu with Play, Record, Duplicate, Delete, Action Options…, and Batch…. Duplicate on an action duplicates that action and selects the duplicate; Delete removes it. Headless tests in `crates/ui-egui/src/panels/actions.rs`: `right_clicking_an_action_set_selects_it_and_presents_set_context_options`, `right_clicking_an_action_selects_it_and_presents_action_options`, and `clicking_duplicate_on_an_action_duplicates_that_action_in_the_set`. Scores and estimates unchanged. @@ -525,8 +525,6 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G12 Preferences and panels that don't act yet -Variables panel row context menus (2026-11-20, G12): Right-click highlights the clicked variable without changing the canvas selection and offers Select Bound Object, Variable Options…, Unbind Variable, the four Make Dynamic actions, and Delete Variable. Shift+F10 opens the same menu for the focused row; Escape dismisses it. Row actions target that variable; dynamic actions use the canvas selection. Lock and selection checks disable unavailable actions. Headless pointer/accessibility tests cover opening the menu, highlighting, bound-object selection, deletion in one undo step and restoration, and disabled actions. Scores and estimates unchanged. - - **Implemented (2026-11-20):** Asset Export tiles have item context menus: Export and Remove act on the asset selection (plural labels for multiple assets), Rename opens the clicked tile's inline field, Select Artwork on Canvas selects that tile's source nodes, and Add Selected Artwork as One Asset / Multiple Assets are enabled with canvas selection. A right-click selects an unselected tile, clearing the previous asset selection, and preserves a multi-selection when the tile is already selected. Export reuses the raster/3D export path; Remove is one undo step and keeps the artwork. Headless regression coverage: `crates/ui-egui/src/panels/tests_asset_export.rs`. Other G12 panel gaps remain; scores and estimates unchanged. - **Implemented and tested (2026-11-20):** Appearance panel row context menus: right-clicking stroke and fill rows offers Duplicate Stroke / Duplicate Fill, Delete Stroke / Delete Fill, and Hide Stroke/Show Stroke / Hide Fill/Show Fill; effect rows offer Edit Effect…, Duplicate Effect, Delete Effect, and Hide Effect / Show Effect; the root object row offers Clear Appearance and Reduce to Basic Appearance. Right-clicking an unselected row targets that row before presenting the menu. Item actions run in one undo step. Headless regression coverage: `crates/ui-egui/src/panels/tests_appearance.rs`. Scores and estimates unchanged. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index c9a3f6c22f..fd0006b881 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -58,7 +58,7 @@ Spiral decay now applies after each full wind of four segments. A newly drawn sp Creating a gradient from solid or empty paint uses the document's color model for its default stops, including drawing its vector with the Gradient tool. Explicit `keepModel: true` retains RGB defaults, and existing gradients keep their own colors. Scores and estimates are unchanged. -**Feature evidence last updated:** 2026-11-19. +**Feature evidence last updated:** 2026-11-20. Window → Help Bar toggles the bottom tool-help strip independently of the status bar. Its visibility is saved with workspaces and UI preferences; Presentation Mode hides both bars. Scores and estimates are unchanged. From fb591db314bbb746f7939bbfcb3a8b826ab27198 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Sat, 21 Nov 2026 10:47:31 +0530 Subject: [PATCH 3/5] Variables panel: scope row menus and respect text bindings --- crates/ui-egui/src/panels/variables.rs | 82 ++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/panels/variables.rs b/crates/ui-egui/src/panels/variables.rs index 2d7e7568ac..525d39b596 100644 --- a/crates/ui-egui/src/panels/variables.rs +++ b/crates/ui-egui/src/panels/variables.rs @@ -91,11 +91,11 @@ fn headers(ui: &mut Ui, sort: VariableSort) -> Option { /// Draw one variable row across the three columns: its kind's icon, its name and the object it /// drives. Each column clips its text to its own width. -fn variable_row(ui: &mut Ui, row: &VarRow, selected: bool) -> Response { +fn variable_row(ui: &mut Ui, row: &VarRow, selected: bool, doc_uid: u64) -> Response { let t = Tokens::get(ui.ctx()); let h = ui.spacing().interact_size.y; let (_, rect) = ui.allocate_space(vec2(ui.available_width(), h)); - let r = ui.interact(rect, ui.scope_id().with(("variable-row", &row.name)), Sense::click()); + let r = ui.interact(rect, ui.scope_id().with(("variable-row", doc_uid, &row.name)), Sense::click()); if selected { ui.painter().rect_filled(rect, 0.0, t.row_selected); } else if r.hovered() { @@ -282,7 +282,7 @@ struct Picked { has_selection: bool, /// Unbind needs a bound object under the selection, not just any selection. selection_bound: bool, - /// Make Text Dynamic needs exactly one type object: a text variable only drives type. + /// Make Text Dynamic needs one type object without an existing text variable. single_type: bool, /// Make Image Dynamic needs exactly one image object. single_image: bool, @@ -293,7 +293,15 @@ struct Picked { fn picked(st: &vectorcraft_engine::DocState) -> Picked { let selected: Vec = st.selection.objects.iter().map(|i| i.0).collect(); let selection_bound = selected.iter().any(|id| st.doc.variables.bindings.contains_key(&NodeId(*id))); - let single_type = matches!(selected.as_slice(), [one] if st.doc.node(NodeId(*one)).is_some_and(|n| matches!(n.kind, NodeKind::Text(_)))); + let single_type = match selected.as_slice() { + [one] if st.doc.node(NodeId(*one)).is_some_and(|n| matches!(n.kind, NodeKind::Text(_))) => st + .doc + .variables + .bindings + .get(&NodeId(*one)) + .is_none_or(|bound| !st.doc.variables.variables.iter().any(|v| v.kind == VariableKind::Text && bound.contains(&v.name))), + _ => false, + }; let single_image = matches!(selected.as_slice(), [one] if st.doc.node(NodeId(*one)).is_some_and(|n| matches!(n.kind, NodeKind::Image(_)))); let selection_graph = !selected.is_empty() && selected.iter().all(|id| st.doc.node(NodeId(*id)).is_some_and(|n| n.extras().graph.is_some())); Picked { has_selection: !selected.is_empty(), selected, selection_bound, single_type, single_image, selection_graph } @@ -337,6 +345,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { // Lock Variables: no variable is defined, deleted or renamed until they are unlocked. let locked = st.doc.variables.locked; let sort = st.variables_sort; + let doc_uid = st.uid; // The current data set across the top: its name in a box that renames it, the list that // chooses another, and the arrows that step through them. @@ -384,7 +393,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { widgets::dim_label(ui, tl!("None")); } for row in vars { - let r = variable_row(ui, row, highlighted.as_deref() == Some(row.name.as_str())); + let r = variable_row(ui, row, highlighted.as_deref() == Some(row.name.as_str()), doc_uid); // A click highlights the row and selects what it drives; a double click opens // Variable Options for it. if r.clicked() { @@ -879,6 +888,69 @@ mod tests { assert_eq!(app.session.active().unwrap().doc.variables.objects_of("Visible").len(), 2); } + #[test] + fn context_menu_cannot_act_on_same_named_variable_in_another_document() { + use egui::accesskit::{Action, ActionRequest, TreeId}; + for label in ["Delete Variable", "Unbind Variable"] { + let mut app = app_with_data(); + let original = app.session.active().unwrap().doc.variables.clone(); + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + let text = app.run("text.create", json!({"x": 10, "y": 40, "text": "Alice"})).unwrap()["id"].clone(); + app.run("variable.define", json!({"name": "Name", "kind": "text"})).unwrap(); + app.run("variable.bind", json!({"variable": "Name", "ids": [text]})).unwrap(); + let other = app.session.active().unwrap().doc.variables.clone(); + assert!(app.session.set_active(0)); + let mut d = Driver::new(); + let nodes = open_row_menu(&mut d, &mut app, "Name · Alice"); + let action = menu_button(&nodes, label); + let target_node = d + .nodes(&mut app) + .into_iter() + .find(|(_, n)| n.role() == egui::accesskit::Role::Button && n.label() == action.label()) + .expect("the open menu action") + .0; + assert!(app.session.set_active(1)); + assert!(!d.nodes(&mut app).iter().any(|(id, _)| *id == target_node), "{label}: the old menu carried over"); + // A queued accessibility click must not dispatch the old menu action in the new document. + d.frame( + &mut app, + vec![egui::Event::AccessKitActionRequest(ActionRequest { + action: Action::Click, + target_node, + target_tree: TreeId::ROOT, + data: None, + })], + ); + assert_eq!(app.session.active().unwrap().doc.variables, other, "{label}: changed the second document"); + assert!(app.session.set_active(0)); + assert_eq!(app.session.active().unwrap().doc.variables, original, "{label}: changed the first document"); + } + } + + #[test] + fn context_menu_make_text_dynamic_requires_text_without_a_text_binding() { + let mut app = app_with_data(); + let text = app.session.active().unwrap().doc.variables.objects_of("Name")[0]; + app.run("select.set", json!({"ids": [text.0]})).unwrap(); + let mut d = Driver::new(); + let nodes = open_row_menu(&mut d, &mut app, "Name · Alice"); + assert!(menu_button(&nodes, "Make Text Dynamic").is_disabled()); + assert!(!menu_button(&nodes, "Make Visibility Dynamic").is_disabled()); + egui::Popup::close_all(&d.ctx); + app.run("variable.unbind", json!({"ids": [text.0], "variable": "Name"})).unwrap(); + app.run("variable.define", json!({"name": "Visible", "kind": "visibility"})).unwrap(); + app.run("variable.bind", json!({"variable": "Visible", "ids": [text.0]})).unwrap(); + let nodes = open_row_menu(&mut d, &mut app, "Name"); + assert!(!menu_button(&nodes, "Make Text Dynamic").is_disabled(), "visibility bindings do not prevent a text variable"); + let before = undo_steps(&app); + d.click(&mut app, &menu_button(&nodes, "Make Text Dynamic")); + let vars = &app.session.active().unwrap().doc.variables; + let bound = vars.bindings.get(&text).unwrap(); + assert!(bound.contains("Visible")); + assert_eq!(vars.variables.iter().filter(|v| v.kind == VariableKind::Text && bound.contains(&v.name)).count(), 1); + assert_eq!(undo_steps(&app), before + 1); + } + #[test] fn context_menu_disables_edits_when_locked_and_selection_actions_when_empty() { let mut app = app_with_data(); From 77a12e40bb8b745079588b42b77f95c4caeaf0c2 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 25 Nov 2026 23:13:46 +0530 Subject: [PATCH 4/5] Fix floating document raise after Presentation Mode --- crates/ui-egui/src/doc_windows.rs | 9 ++++- crates/ui-egui/src/doc_windows/tests.rs | 47 ++++++++++++++++--------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/crates/ui-egui/src/doc_windows.rs b/crates/ui-egui/src/doc_windows.rs index 9c65f48e24..216d3b65b9 100644 --- a/crates/ui-egui/src/doc_windows.rs +++ b/crates/ui-egui/src/doc_windows.rs @@ -335,6 +335,7 @@ fn show_windows(app: &mut VectorcraftApp, ui: &mut egui::Ui) { // Presentation Mode fits each floating window it shows to the main window: back in their // floating windows, those views fit their windows again. let presenting = presenting(app); + let restoring = !presenting && app.canvas.windows.presented.is_some(); if presenting { let is_floating = current.is_some_and(|k| floating(app, &k)); let shown = app.canvas.windows.presented.get_or_insert_default(); @@ -365,9 +366,15 @@ fn show_windows(app: &mut VectorcraftApp, ui: &mut egui::Ui) { return; } let raise = current.filter(|u| app.canvas.windows.current != Some(*u)); - app.canvas.windows.current = current; let ctx = ui.ctx().clone(); let os_windows = WindowHost::of(&ctx).viewports_available(); + if restoring && !os_windows && raise.is_some() { + // egui raises every reappearing area in this pass, preserving their old order. Repeat + // the current window's raise next frame, when the other windows no longer request it. + ctx.request_repaint(); + } else { + app.canvas.windows.current = current; + } // An OS window's place is in desktop points: the main window's own origin shifts it. let origin = if os_windows { ctx.input(|i| i.viewport().inner_rect.map(|r| r.min)).filter(|p| p.is_finite()).unwrap_or(egui::Pos2::ZERO).to_vec2() diff --git a/crates/ui-egui/src/doc_windows/tests.rs b/crates/ui-egui/src/doc_windows/tests.rs index 3e8ffbff5b..931813e14a 100644 --- a/crates/ui-egui/src/doc_windows/tests.rs +++ b/crates/ui-egui/src/doc_windows/tests.rs @@ -417,23 +417,36 @@ fn presentation_mode_shows_the_floating_current_document_in_the_main_window() { #[test] fn a_document_made_current_in_presentation_mode_comes_to_the_front_after_it() { - let mut app = app_with(2); - let ctx = crate::testing::ui_context(); - frame(&mut app, &ctx, vec![]); - app.run("window.arrange.floatAllInWindows", json!({})).unwrap(); - frame(&mut app, &ctx, vec![]); - frame(&mut app, &ctx, vec![]); - // Where the two windows overlap: document 1's title bar, over document 0's body. - let overlap = app.ui.floating[1].place.min + vec2(60.0, 10.0); - app.run("view.presentation", json!({})).unwrap(); - frame(&mut app, &ctx, vec![]); - app.run("document.activate", json!({"index": 0})).unwrap(); - frame(&mut app, &ctx, vec![]); - app.run("view.presentation", json!({})).unwrap(); - frame(&mut app, &ctx, vec![]); - frame(&mut app, &ctx, vec![]); - click(&mut app, &ctx, overlap); - assert_eq!(app.session.active_index(), Some(0), "document 0's window is in front where they overlap"); + for change_during_presentation in [false, true] { + let mut app = app_with(2); + let ctx = crate::testing::ui_context(); + frame(&mut app, &ctx, vec![]); + app.run("window.arrange.floatAllInWindows", json!({})).unwrap(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + // Where the two windows overlap: document 1's title bar, over document 0's body. + let overlap = app.ui.floating[1].place.min + vec2(60.0, 10.0); + // Cover both an unchanged current document and one chosen while the windows are hidden. + if !change_during_presentation { + app.run("document.activate", json!({"index": 0})).unwrap(); + frame(&mut app, &ctx, vec![]); + } + app.run("view.presentation", json!({})).unwrap(); + frame(&mut app, &ctx, vec![]); + if change_during_presentation { + app.run("document.activate", json!({"index": 0})).unwrap(); + frame(&mut app, &ctx, vec![]); + } + app.run("view.presentation", json!({})).unwrap(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + click(&mut app, &ctx, overlap); + assert_eq!( + app.session.active_index(), + Some(0), + "document 0's window is in front (changed during presentation: {change_during_presentation})" + ); + } } /// A stand-in for the window system of the documents' OS windows: it runs each one's frame and asks From c0495c4e31ec9cabd4e630a8ab642dd2c27b0c2d Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:54:00 +0530 Subject: [PATCH 5/5] Revert "Fix floating document raise after Presentation Mode" This reverts commit 77a12e40bb8b745079588b42b77f95c4caeaf0c2. --- crates/ui-egui/src/doc_windows.rs | 9 +---- crates/ui-egui/src/doc_windows/tests.rs | 47 +++++++++---------------- 2 files changed, 18 insertions(+), 38 deletions(-) diff --git a/crates/ui-egui/src/doc_windows.rs b/crates/ui-egui/src/doc_windows.rs index 216d3b65b9..9c65f48e24 100644 --- a/crates/ui-egui/src/doc_windows.rs +++ b/crates/ui-egui/src/doc_windows.rs @@ -335,7 +335,6 @@ fn show_windows(app: &mut VectorcraftApp, ui: &mut egui::Ui) { // Presentation Mode fits each floating window it shows to the main window: back in their // floating windows, those views fit their windows again. let presenting = presenting(app); - let restoring = !presenting && app.canvas.windows.presented.is_some(); if presenting { let is_floating = current.is_some_and(|k| floating(app, &k)); let shown = app.canvas.windows.presented.get_or_insert_default(); @@ -366,15 +365,9 @@ fn show_windows(app: &mut VectorcraftApp, ui: &mut egui::Ui) { return; } let raise = current.filter(|u| app.canvas.windows.current != Some(*u)); + app.canvas.windows.current = current; let ctx = ui.ctx().clone(); let os_windows = WindowHost::of(&ctx).viewports_available(); - if restoring && !os_windows && raise.is_some() { - // egui raises every reappearing area in this pass, preserving their old order. Repeat - // the current window's raise next frame, when the other windows no longer request it. - ctx.request_repaint(); - } else { - app.canvas.windows.current = current; - } // An OS window's place is in desktop points: the main window's own origin shifts it. let origin = if os_windows { ctx.input(|i| i.viewport().inner_rect.map(|r| r.min)).filter(|p| p.is_finite()).unwrap_or(egui::Pos2::ZERO).to_vec2() diff --git a/crates/ui-egui/src/doc_windows/tests.rs b/crates/ui-egui/src/doc_windows/tests.rs index 931813e14a..3e8ffbff5b 100644 --- a/crates/ui-egui/src/doc_windows/tests.rs +++ b/crates/ui-egui/src/doc_windows/tests.rs @@ -417,36 +417,23 @@ fn presentation_mode_shows_the_floating_current_document_in_the_main_window() { #[test] fn a_document_made_current_in_presentation_mode_comes_to_the_front_after_it() { - for change_during_presentation in [false, true] { - let mut app = app_with(2); - let ctx = crate::testing::ui_context(); - frame(&mut app, &ctx, vec![]); - app.run("window.arrange.floatAllInWindows", json!({})).unwrap(); - frame(&mut app, &ctx, vec![]); - frame(&mut app, &ctx, vec![]); - // Where the two windows overlap: document 1's title bar, over document 0's body. - let overlap = app.ui.floating[1].place.min + vec2(60.0, 10.0); - // Cover both an unchanged current document and one chosen while the windows are hidden. - if !change_during_presentation { - app.run("document.activate", json!({"index": 0})).unwrap(); - frame(&mut app, &ctx, vec![]); - } - app.run("view.presentation", json!({})).unwrap(); - frame(&mut app, &ctx, vec![]); - if change_during_presentation { - app.run("document.activate", json!({"index": 0})).unwrap(); - frame(&mut app, &ctx, vec![]); - } - app.run("view.presentation", json!({})).unwrap(); - frame(&mut app, &ctx, vec![]); - frame(&mut app, &ctx, vec![]); - click(&mut app, &ctx, overlap); - assert_eq!( - app.session.active_index(), - Some(0), - "document 0's window is in front (changed during presentation: {change_during_presentation})" - ); - } + let mut app = app_with(2); + let ctx = crate::testing::ui_context(); + frame(&mut app, &ctx, vec![]); + app.run("window.arrange.floatAllInWindows", json!({})).unwrap(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + // Where the two windows overlap: document 1's title bar, over document 0's body. + let overlap = app.ui.floating[1].place.min + vec2(60.0, 10.0); + app.run("view.presentation", json!({})).unwrap(); + frame(&mut app, &ctx, vec![]); + app.run("document.activate", json!({"index": 0})).unwrap(); + frame(&mut app, &ctx, vec![]); + app.run("view.presentation", json!({})).unwrap(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + click(&mut app, &ctx, overlap); + assert_eq!(app.session.active_index(), Some(0), "document 0's window is in front where they overlap"); } /// A stand-in for the window system of the documents' OS windows: it runs each one's frame and asks