From 401dc96ef2bcdacf7cb9a3b360d85ee7797c9b0e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 11:54:25 -0800 Subject: [PATCH] Color Wheel: opacity row follows the Type tool's characters and keeps the hue - paint.proxies answers no fill or stroke opacity while the Type tool has characters selected, so the Color Wheel's opacity row is gray instead of offering a value that paint.setFill {opacity} refuses. - paint.setFill and paint.setStroke with `id` paint that object while the Type tool has characters selected, as they already do with `ids`. - An opacity edit of a gradient stop or freeform point keeps the hue picked last for an achromatic color. - With a None fill, a screen reader's set value on the Brightness strip sets the fill even when the value equals the hidden number of the last color. --- crates/engine/src/cmd/paint.rs | 13 ++++-- crates/engine/src/cmd/textedit.rs | 13 ++++-- crates/engine/src/tests/paintopacity.rs | 43 +++++++++++++++++++ crates/ui-egui/src/panels/color_wheel.rs | 12 ++++++ .../src/panels/tests_color_wheel_box.rs | 16 +++++++ .../src/panels/tests_color_wheel_opacity.rs | 22 ++++++++++ crates/ui-egui/src/widgets/color.rs | 19 ++++++-- docs/mcp.md | 5 ++- 8 files changed, 131 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/cmd/paint.rs b/crates/engine/src/cmd/paint.rs index a77f613d11..42b0298987 100644 --- a/crates/engine/src/cmd/paint.rs +++ b/crates/engine/src/cmd/paint.rs @@ -21,7 +21,7 @@ pub fn specs() -> Vec { "Fill", [], None, - "{color?:\"#rrggbb\"|[r,g,b]|{c,m,y,k}|{gray}|{l,a,b} (CIE Lab; #rrggbbaa and #rgba are refused), none?: true, swatch?: name (a global or spot colour stays linked, so swatch edits recolour it; a tint swatch links to its base at its tint; a gradient swatch is recorded as the gradient's swatch and fits each object, keeping its aspect; the built-in \"[Registration]\" prints on every plate), tint?: 0..100 (% of a global or spot `swatch`; default 100, or a tint swatch's own), gradient?: {kind?: linear|radial|conic|diamond|freeform (conic, also accepted as angle or conical: the stops sweep once around the center `start`, clockwise from the vector; diamond: the stops run from the center `start` out to a square with a corner at `end`), method?: classic|perceptual|hue-clockwise|hue-counterclockwise (as paint.editGradient; default classic), spread?: pad|repeat|reflect (as paint.editGradient; default pad), repeats?: 1..100 (as paint.editGradient; default 1), stops?: [{offset 0..1, color, opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: global or spot colour (or tint) swatch the stop links to (its colour comes from the swatch), tint?: 0..100}] (at least 2; default white→black), angle?: deg counter-clockwise (0: the gradient runs left to right), start?: [x,y], end?: [x,y] (the vector in document coordinates, both or neither; type objects keep it in text space), aspect?: % (radial, conic and diamond; a negative one mirrors a conic's sweep, counterclockwise, and is an error for the other kinds; without start/end the gradient is placed on each object's bounds), focal?: [x,y] (radial, with start/end: the focal point, where the first stop sits; an error with a conic or diamond), dither?: bool (linear, radial, conic and diamond fills: drawn with fine noise that hides banding, and as pixels in SVG and PDF exports; strokes ignore it), swatch?: linked gradient swatch name}, item?: appearance item index|null (omitted: the Appearance panel's active item if it is a fill, else the top fill), aligned?: bool (index and item are rows of the first target's stack: each other target edits its equal one, as the Appearance panel does for a mixed selection; with the art of a graph design in a series given first, rows of the art's stack: docs/mcp.md), opacity?: 0..100 (a percentage, as transparency.set's; the opacity of that fill item on each target, in the undo step of the paint, or alone without color, none, swatch or gradient, when it changes neither the defaults nor the recent colors; the gradient mesh points picked with the Mesh tool, Direct Selection or the Lasso take it themselves; with no paint, a target without that fill item is left as it is (a paint given with the opacity creates the item, which then takes it), and an opacity that no target takes is an error that also leaves the paint undone; type characters have no opacity of their own, so an opacity that only characters would take is an error, and so are one with nothing selected and no ids and one for an object selected in a symbol instance), ids?|id?, focus?: true (false keeps the active proxy), keepModel?: false (in a CMYK document, RGB colours and gradient stops are stored as CMYK unless true; Gray stays Gray), target?: \"object\"|\"contents\", span?: \"object\" (default: each target fits a gradient to its own bounds)|\"selection\" (a linear, radial, conic or diamond `gradient` without start/end is placed once on the union of the targets' bounds, so it runs across them)} sets the selection's fill and the default (new art fits a gradient to itself); a solid color recolors only the gradient mesh points picked with the Mesh tool, Direct Selection or the Lasso (unless an `item` index is given or the Appearance panel's active item is a fill); while the Type tool has characters selected (and no ids or item are given), the paint goes to those characters only; without `item`, a grayscale or 1-bit image takes a solid color as the color it is drawn in (white pixels transparent; `none` takes it off; an image with an alpha channel takes only a spot color, black or white; a colorized image whose link is missing takes a solid color as its new colorize color, and refuses a process color while its color is a spot color, black or white); with an object of a dynamic symbol instance selected by Direct Selection and no ids, id or item, that object's fill changes for this instance only (solid, none, gradient or pattern). On a path directly in a graph series, the graph also stores the paint of the topmost visible fill when the command wrote that row or changed it, and its opacity when `opacity` changed it (exceptions: docs/mcp.md); on a graph label, the graph stores the paint for every label of its kind, as a character fill when the characters took it and with the label's rows when a row did → {objects: how many objects took the paint (the objects inside a group, unless an appearance item of the group's own is targeted; 0 when only the default changed)}", + "{color?:\"#rrggbb\"|[r,g,b]|{c,m,y,k}|{gray}|{l,a,b} (CIE Lab; #rrggbbaa and #rgba are refused), none?: true, swatch?: name (a global or spot colour stays linked, so swatch edits recolour it; a tint swatch links to its base at its tint; a gradient swatch is recorded as the gradient's swatch and fits each object, keeping its aspect; the built-in \"[Registration]\" prints on every plate), tint?: 0..100 (% of a global or spot `swatch`; default 100, or a tint swatch's own), gradient?: {kind?: linear|radial|conic|diamond|freeform (conic, also accepted as angle or conical: the stops sweep once around the center `start`, clockwise from the vector; diamond: the stops run from the center `start` out to a square with a corner at `end`), method?: classic|perceptual|hue-clockwise|hue-counterclockwise (as paint.editGradient; default classic), spread?: pad|repeat|reflect (as paint.editGradient; default pad), repeats?: 1..100 (as paint.editGradient; default 1), stops?: [{offset 0..1, color, opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: global or spot colour (or tint) swatch the stop links to (its colour comes from the swatch), tint?: 0..100}] (at least 2; default white→black), angle?: deg counter-clockwise (0: the gradient runs left to right), start?: [x,y], end?: [x,y] (the vector in document coordinates, both or neither; type objects keep it in text space), aspect?: % (radial, conic and diamond; a negative one mirrors a conic's sweep, counterclockwise, and is an error for the other kinds; without start/end the gradient is placed on each object's bounds), focal?: [x,y] (radial, with start/end: the focal point, where the first stop sits; an error with a conic or diamond), dither?: bool (linear, radial, conic and diamond fills: drawn with fine noise that hides banding, and as pixels in SVG and PDF exports; strokes ignore it), swatch?: linked gradient swatch name}, item?: appearance item index|null (omitted: the Appearance panel's active item if it is a fill, else the top fill), aligned?: bool (index and item are rows of the first target's stack: each other target edits its equal one, as the Appearance panel does for a mixed selection; with the art of a graph design in a series given first, rows of the art's stack: docs/mcp.md), opacity?: 0..100 (a percentage, as transparency.set's; the opacity of that fill item on each target, in the undo step of the paint, or alone without color, none, swatch or gradient, when it changes neither the defaults nor the recent colors; the gradient mesh points picked with the Mesh tool, Direct Selection or the Lasso take it themselves; with no paint, a target without that fill item is left as it is (a paint given with the opacity creates the item, which then takes it), and an opacity that no target takes is an error that also leaves the paint undone; type characters have no opacity of their own, so an opacity that only characters would take is an error, and so are one with nothing selected and no ids and one for an object selected in a symbol instance), ids?|id?, focus?: true (false keeps the active proxy), keepModel?: false (in a CMYK document, RGB colours and gradient stops are stored as CMYK unless true; Gray stays Gray), target?: \"object\"|\"contents\", span?: \"object\" (default: each target fits a gradient to its own bounds)|\"selection\" (a linear, radial, conic or diamond `gradient` without start/end is placed once on the union of the targets' bounds, so it runs across them)} sets the selection's fill and the default (new art fits a gradient to itself); a solid color recolors only the gradient mesh points picked with the Mesh tool, Direct Selection or the Lasso (unless an `item` index is given or the Appearance panel's active item is a fill); while the Type tool has characters selected (and no ids, id or item are given), the paint goes to those characters only; without `item`, a grayscale or 1-bit image takes a solid color as the color it is drawn in (white pixels transparent; `none` takes it off; an image with an alpha channel takes only a spot color, black or white; a colorized image whose link is missing takes a solid color as its new colorize color, and refuses a process color while its color is a spot color, black or white); with an object of a dynamic symbol instance selected by Direct Selection and no ids, id or item, that object's fill changes for this instance only (solid, none, gradient or pattern). On a path directly in a graph series, the graph also stores the paint of the topmost visible fill when the command wrote that row or changed it, and its opacity when `opacity` changed it (exceptions: docs/mcp.md); on a graph label, the graph stores the paint for every label of its kind, as a character fill when the characters took it and with the label's rows when a row did → {objects: how many objects took the paint (the objects inside a group, unless an appearance item of the group's own is targeted; 0 when only the default changed)}", has_doc, |s, p| set_paint(s, p, true) ), @@ -154,7 +154,7 @@ pub fn proxy_specs() -> Vec { "Fill and Stroke", [], None, - "{} → {fill, stroke: the paints the Fill/Stroke proxies show (the Appearance panel's active item for the proxy of its kind, else the first selected object's, a group's first painted object's, type: its first run's; else the defaults for new art; when that object is a gradient mesh with points picked by the Mesh tool, Direct Selection or the Lasso and no fill item is active, the fill is its first picked point's color), fillActive, fillMixed, strokeMixed: the selected objects' (or a selected group's contents') fills (strokes) differ, shown as a \"?\" proxy (a gradient mesh with points picked counts with their colors), fillOpacity, strokeOpacity: 0..100, the opacity of the fill (stroke) item that paint.setFill {opacity} sets, from the first selected object (or painted object in a selected group) that has one (a gradient mesh's first picked point's), or null with nothing selected (the defaults for new art), for an object selected in a symbol instance, and when only type characters or objects without that item are selected}", + "{} → {fill, stroke: the paints the Fill/Stroke proxies show (the Appearance panel's active item for the proxy of its kind, else the first selected object's, a group's first painted object's, type: its first run's; else the defaults for new art; when that object is a gradient mesh with points picked by the Mesh tool, Direct Selection or the Lasso and no fill item is active, the fill is its first picked point's color), fillActive, fillMixed, strokeMixed: the selected objects' (or a selected group's contents') fills (strokes) differ, shown as a \"?\" proxy (a gradient mesh with points picked counts with their colors), fillOpacity, strokeOpacity: 0..100, the opacity of the fill (stroke) item that paint.setFill {opacity} sets, from the first selected object (or painted object in a selected group) that has one (a gradient mesh's first picked point's), or null with nothing selected (the defaults for new art), for an object selected in a symbol instance, while the Type tool has characters selected, and when only type characters or objects without that item are selected}", always, proxies ), @@ -216,13 +216,17 @@ impl Session { /// or for a gradient mesh with points picked the first picked point's. The rows the command /// would edit are read in order (a group without an active Appearance row stands for its /// contents), and the first that exists answers. `None` with nothing selected, for an object - /// selected in a symbol instance, and when only type characters or objects without that item - /// are selected. + /// selected in a symbol instance, while the Type tool has characters selected, and when only + /// type characters or objects without that item are selected. pub fn proxy_opacity(&self, stroke: bool) -> Option { let st = self.active()?; if st.selection.symbol_part.is_some() { return None; } + // The command would give the opacity to the characters, which have none of their own. + if super::textedit::selected_range(self).is_some_and(|(_, a, b)| a != b) { + return None; + } let item = self.appearance_item(); let of = |n: &Node, item: Option| -> Option { if item.is_none() && matches!(n.kind, NodeKind::Text(_)) { @@ -555,6 +559,7 @@ fn apply_paint_opacity(s: &mut Session, p: &Value, paint: Option, opacity }; // Characters selected with the Type tool take the paint, not the whole type object (#1063). if p.get("ids").is_none() + && p.get("id").is_none() && p.get("item").is_none() && let Some((id, a, b)) = super::textedit::editing_range(s)? && a != b diff --git a/crates/engine/src/cmd/textedit.rs b/crates/engine/src/cmd/textedit.rs index eb62962ad9..4bf97055d0 100644 --- a/crates/engine/src/cmd/textedit.rs +++ b/crates/engine/src/cmd/textedit.rs @@ -1884,14 +1884,21 @@ enum Step { /// The Type tool's selected text while it edits (its typing session ends first: one undo step). pub(crate) fn editing_range(s: &mut Session) -> Result> { - let o = s.tool_options(); - let Some(id) = o.get("editing").and_then(Value::as_u64).map(NodeId) else { return Ok(None) }; + let Some(range) = selected_range(s) else { return Ok(None) }; if super::edit::typing_in_progress(s) { s.set_tool_option("commitTyping", &Value::Bool(true)); s.commit_interaction()?; } + Ok(Some(range)) +} + +/// The Type tool's selected text while it edits, as [`editing_range`] reads it, with its typing +/// session left running. +pub(crate) fn selected_range(s: &Session) -> Option<(NodeId, usize, usize)> { + let o = s.tool_options(); + let id = o.get("editing").and_then(Value::as_u64).map(NodeId)?; let at = |k: &str| byte_param(&o, k).unwrap_or(0); - Ok(Some((id, at("start"), at("end")))) + Some((id, at("start"), at("end"))) } /// The frames of the story whose whole text the Type tool has selected after Select All in a diff --git a/crates/engine/src/tests/paintopacity.rs b/crates/engine/src/tests/paintopacity.rs index 3c3fa12bbe..a1e2018e83 100644 --- a/crates/engine/src/tests/paintopacity.rs +++ b/crates/engine/src/tests/paintopacity.rs @@ -182,6 +182,49 @@ fn errors_leave_the_document_and_defaults_alone() { assert_eq!(proxies(&mut s)["fillOpacity"], Value::Null); } +/// Select characters of `t` with the Type tool. +fn select_characters(s: &mut Session, t: NodeId) { + s.select_tool("type", ViewInfo::default()).unwrap(); + s.set_tool_option("textSelection", &json!({"editing": t.0, "anchor": 0, "caret": 2})); +} + +/// While the Type tool has characters selected, `paint.proxies` answers no opacity even when the +/// type object has a fill row of its own that the Appearance panel has active, since +/// `paint.setFill {opacity}` would give the opacity to the characters. +#[test] +fn with_characters_selected_the_proxy_answers_no_opacity() { + let mut s = session(); + let t = text(&mut s); + select(&mut s, &[t]); + s.execute("appearance.addFill", &json!({})).unwrap(); + let row = node(&s, t).appearance.items.iter().position(|it| it.is_fill()).unwrap(); + s.execute("appearance.setActiveItem", &json!({"index": row})).unwrap(); + assert_eq!(proxies(&mut s)["fillOpacity"], 100.0, "the type object's own fill row"); + select_characters(&mut s, t); + let e = s.execute("paint.setFill", &json!({"opacity": 40})).unwrap_err(); + assert!(e.to_string().contains("type characters have no opacity of their own"), "{e}"); + assert_eq!(proxies(&mut s)["fillOpacity"], Value::Null); +} + +/// While the Type tool has characters selected, an object named by `id` takes the opacity and the +/// paint, and the characters keep theirs. +#[test] +fn with_characters_selected_an_id_takes_the_opacity() { + let mut s = session(); + let r = rect(&mut s, 10.0); + let t = text(&mut s); + select(&mut s, &[t]); + select_characters(&mut s, t); + let before = node(&s, t); + s.execute("paint.setFill", &json!({"id": r.0, "opacity": 40})).unwrap(); + assert!((fill_opacity(&s, r) - 0.4).abs() < 1e-6); + s.execute("paint.setStroke", &json!({"id": r.0, "color": "#ff0000", "opacity": 30})).unwrap(); + let stroke = node(&s, r).appearance.stroke().unwrap().clone(); + assert!((stroke.opacity - 0.3).abs() < 1e-6); + assert_eq!(stroke.paint, Paint::solid(Color::rgb8(255, 0, 0))); + assert_eq!(node(&s, t), before, "the characters keep their paint"); +} + /// A type object whose characters take the paint is left alone beside a rectangle that takes the /// opacity, with no error; alone, it answers the characters error. #[test] diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index 6356d96666..d453aceb29 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -445,7 +445,19 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { }); if app.ui.color_wheel.opacity { let shown = color.unwrap_or(app.session.last_solid); + let owner = color.map(|c| Owner::of(app, &tgt, c)); opacity_row(app, ui, &tgt, &shown); + // An opacity edit of a gradient stop or point changes the gradient its owner holds, and the + // HSB picked last stays with the new gradient. + if let (Some(c), Some(was)) = (color, owner) + && let Some((remembered, rgb, hsb)) = pstate::>(ui.ctx(), MEMORY) + && remembered == was + { + let now = Owner::of(app, &tgt, c); + if now != was { + set_pstate(ui.ctx(), MEMORY, Some((now, rgb, hsb))); + } + } } let Some((hsb, phase)) = pick else { return }; let behind = super::alt_held(ui); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_box.rs b/crates/ui-egui/src/panels/tests_color_wheel_box.rs index a19d472d70..048aff00ea 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_box.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_box.rs @@ -235,6 +235,22 @@ fn with_a_none_fill_the_strip_reads_zero_and_its_actions_set_the_fill() { assert!(near(hsb(&fill(h.state())), [last[0], last[1], 0.25], 0.01), "{last:?} → {:?}", hsb(&fill(h.state()))); } +/// With None, a screen reader's set value equal to the last solid color's own number still sets +/// the fill. +#[test] +fn with_a_none_fill_a_set_value_equal_to_the_hidden_number_sets_the_fill() { + let mut app = app(json!("#ff0000"), "brightness"); + app.run("paint.setFill", json!({"none": true})).unwrap(); + let mut h = harness(app); + let last = hsb(&h.state().session.last_solid); + assert!((last[2] - 1.0).abs() < 0.01, "{last:?}"); + let (target_node, target_tree) = h.get_by_label("Brightness").accesskit_node().locate(); + let data = Some(ActionData::NumericValue(100.0)); + h.event(Event::AccessKitActionRequest(ActionRequest { target_node, target_tree, action: Action::SetValue, data })); + h.run_steps(1); + assert!(near(hsb(&fill(h.state())), last, 0.01), "{last:?} → {:?}", crate::panels::current_paints(h.state()).0); +} + /// `ui.colorWheel` answers every junk parameter without a panic. #[test] fn ui_color_wheel_answers_junk_params_without_a_panic() { diff --git a/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs b/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs index 8dbcf0f15f..b794dc3c54 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_opacity.rs @@ -194,6 +194,28 @@ fn without_a_selected_stop_the_first_takes_the_opacity() { assert!((o[0] - 0.3).abs() < 1e-6 && (o[1] - 1.0).abs() < 1e-6, "{o:?}"); } +/// The hue picked last for a white gradient stop stays on the ring after the row sets the stop's +/// opacity. +#[test] +fn an_opacity_edit_keeps_the_hue_picked_for_a_white_stop() { + let mut app = app(); + let stops = json!([{"offset": 0, "color": "#ffffff"}, {"offset": 1, "color": "#0000ff"}]); + app.run("paint.setFill", json!({"gradient": {"stops": stops, "start": [10, 35], "end": [60, 35]}})).unwrap(); + app.select_tool("gradient"); + app.run("gradient.selectStop", json!({"index": 0})).unwrap(); + let mut h = harness(app); + let ring = |h: &Harness<'static, VectorcraftApp>| h.get_by_label("Hue ring").accesskit_node().numeric_value(); + let (target_node, target_tree) = h.get_by_label("Hue ring").accesskit_node().locate(); + let data = Some(ActionData::NumericValue(120.0)); + h.event(Event::AccessKitActionRequest(ActionRequest { target_node, target_tree, action: Action::SetValue, data })); + h.run_steps(2); + assert_eq!(ring(&h), Some(120.0), "the ring shows the hue picked for white"); + action(&mut h, Action::SetValue, Some(ActionData::NumericValue(30.0))); + let Paint::Gradient(g) = crate::panels::current_paints(h.state()).0 else { panic!("still a gradient") }; + assert!((g.gradient.stops[0].opacity - 0.3).abs() < 1e-6, "{:?}", g.gradient.stops); + assert_eq!(ring(&h), Some(120.0), "the ring keeps the hue after the opacity edit"); +} + /// A drag across the slider previews and ends as one undo step named Opacity. #[test] fn a_drag_is_one_undo_step() { diff --git a/crates/ui-egui/src/widgets/color.rs b/crates/ui-egui/src/widgets/color.rs index 3229c09260..a2503626a8 100644 --- a/crates/ui-egui/src/widgets/color.rs +++ b/crates/ui-egui/src/widgets/color.rs @@ -545,8 +545,9 @@ pub fn channel_slider_valued( /// the rail of [`color_slider_stepped`] does: a click or a drag gives it the keyboard focus, and /// while it has the focus ↑ and → raise the number `shown` holds and ↓ and ← lower it. When not /// `marked`, the rail draws no arrows and screen readers read 0, as [`hue_ring`] does, while the -/// keys and actions still step from `shown`. Returns the new value from 0 to 1 that a click or a -/// drag gives, its phase, and the number in `shown`'s units that a key or an action gives. +/// keys and actions still step from `shown`, and a set value applies even when it equals `shown`'s +/// number. Returns the new value from 0 to 1 that a click or a drag gives, its phase, and the +/// number in `shown`'s units that a key or an action gives. #[allow(clippy::too_many_arguments)] pub fn channel_slider_stepped( ui: &mut Ui, @@ -558,10 +559,22 @@ pub fn channel_slider_stepped( size: Vec2, track: &dyn Fn(f32) -> Color32, ) -> (Option, Live, Option) { + use egui::accesskit::{Action, ActionData}; let id = id_with(ui.scope_id(), id); let read = if marked { shown.clone() } else { shown.as_ref().map(|s| SliderValue { value: 0.0, text: None, ..s.clone() }) }; let (resp, picked, phase) = channel_rail(ui, id, name, read, value, marked, size, track); - let stepped = slider_keys(ui, &resp, shown); + let unmarked = shown.as_ref().filter(|_| !marked && ui.is_enabled()).map(|s| s.value); + let mut stepped = slider_keys(ui, &resp, shown); + // Without a marker there is no color yet, so a set value applies even when it leaves the number + // as it was. + if stepped.is_none() + && let Some(v) = unmarked + && ui.input(|i| { + i.accesskit_action_requests(resp.id, Action::SetValue).any(|r| matches!(r.data, Some(ActionData::NumericValue(n)) if n.is_finite())) + }) + { + stepped = Some(v); + } (picked, phase, stepped.filter(|_| picked.is_none())) } diff --git a/docs/mcp.md b/docs/mcp.md index 547a9b05ff..f4be29c572 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -788,8 +788,9 @@ its kind (`paint.proxies`) and the Gradient tool's annotator then show that row. (0 to 100, a percentage as in `transparency.set`), which sets the opacity of the fill or stroke row they paint, with or without a new paint, as one undo step. An opacity that no target takes is an error and also leaves the paint undone. `paint.proxies` answers it as `fillOpacity` and `strokeOpacity`, from the first selected object that has -that row. It answers null with nothing selected, for an object selected in a symbol instance, and when only type -characters (which have no opacity of their own) or objects without that row are selected. Live effects take the same `item` to apply to one fill or +that row. It answers null with nothing selected, for an object selected in a symbol instance, while the Type tool +has characters selected, and when only type characters (which have no opacity of their own) or objects without that +row are selected. Live effects take the same `item` to apply to one fill or stroke instead of the whole object: `run_command effect.apply {"effect": "path.offsetPath", "item": 0}`, and `effect.remove`, `effect.setParams` (`visible` toggles one) and `effect.duplicate` address that item's effects; `apply_effect` uses the active item. `effect.list` reports each object's item effects under `applied[].items`.