Color Wheel: a Live Paint group answers the opacity of the parts it sets

paint.setFill {opacity} sets a selected Live Paint group's faces and
paint.setStroke {opacity} its edges. paint.proxies now reads fillOpacity
from the faces and strokeOpacity from the edges, so the Color Wheel's
opacity row shows the value the row sets. Before, strokeOpacity could
answer a face's stroke.
This commit is contained in:
dotCooCoo committed 2026-11-19 05:52:18 -08:00
1 parent 98692d9d48
commit 256a1a2f47
3 files changed
+23 -3

No files matched your search

+5 -2
View File
@@ -160,7 +160,7 @@ pub fn proxy_specs() -> Vec<CommandSpec> {
"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, a Live Paint group's first face's fill and first edge's stroke, 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, a Live Paint group counting with its faces' fills and its edges' strokes, shown as a \"?\" proxy (a gradient mesh with points picked counts with their colors), fillOpacity, strokeOpacity: 0..100, the opacity of the fill item that paint.setFill {opacity} sets (the stroke item that paint.setStroke {opacity} sets), from the first selected object (or painted object in a selected group; a selected path of a compound path stands for its compound) 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 Live Paint Bucket is the active tool, while the Type tool has characters selected, 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, a Live Paint group's first face's fill and first edge's stroke, 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, a Live Paint group counting with its faces' fills and its edges' strokes, shown as a \"?\" proxy (a gradient mesh with points picked counts with their colors), fillOpacity, strokeOpacity: 0..100, the opacity of the fill item that paint.setFill {opacity} sets (the stroke item that paint.setStroke {opacity} sets), from the first selected object (or painted object in a selected group; a selected path of a compound path stands for its compound, and a Live Paint group for its faces' fills and its edges' strokes) 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 Live Paint Bucket is the active tool, while the Type tool has characters selected, and when only type characters or objects without that item are selected}",
always,
proxies
),
@@ -300,8 +300,11 @@ impl Session {
of(n, at?.resolve(&n.appearance, !stroke, "paint.proxies").ok()?)
});
}
// A Live Paint group stands for its faces in a fill edit and for its edges in a stroke edit
// (ItemTarget::targets_for).
let leaves = super::leaf_targets(self, &st.selection.objects).ok()?;
leaves.iter().filter(editable).filter_map(|id| st.doc.node(*id)).find_map(|n| of(n, None))
let skipped = live_paint_parts_skipped(&st.doc, &st.selection.objects, !stroke);
leaves.iter().filter(editable).filter(|id| !skipped.contains(*id)).filter_map(|id| st.doc.node(*id)).find_map(|n| of(n, None))
}
pub(crate) fn remember_paint_now(&mut self, p: &Paint) {
+16
View File
@@ -417,6 +417,22 @@ fn a_null_id_leaves_the_paint_to_the_selected_characters() {
}
}
/// A selected Live Paint group stands for its faces in a fill opacity and for its edges in a stroke
/// opacity, and `paint.proxies` answers from those same parts.
#[test]
fn a_live_paint_group_answers_from_the_parts_it_sets() {
let mut s = session();
let id = rect(&mut s, 10.0);
s.execute("livePaint.make", &json!({"ids": [id.0]})).unwrap();
let g = s.doc().unwrap().selection.objects[0];
select(&mut s, &[g]);
s.execute("paint.setStroke", &json!({"opacity": 30})).unwrap();
assert_eq!(proxies(&mut s)["strokeOpacity"], 30.0);
s.execute("paint.setFill", &json!({"opacity": 40})).unwrap();
assert_eq!(proxies(&mut s)["fillOpacity"], 40.0);
assert_eq!(proxies(&mut s)["strokeOpacity"], 30.0);
}
/// While the Live Paint Bucket is the active tool, a fill or stroke chosen goes to the bucket, so
/// `paint.proxies` answers no opacity for the selection and an opacity is an error that leaves the
/// document as it was.
+2 -1
View File
@@ -862,7 +862,8 @@ 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. Without a new paint, `objects` counts only the targets that took the opacity. `paint.proxies` answers it as `fillOpacity` and `strokeOpacity`, from the first selected object that has
that row (a selected path of a compound path answers with its compound path's row, which the commands edit). It answers null with nothing selected, for an object selected in a symbol instance, while the Live Paint Bucket is the
that row (a selected path of a compound path answers with its compound path's row, which the commands edit, and a
selected Live Paint group answers with its faces' fills and its edges' strokes). It answers null with nothing selected, for an object selected in a symbol instance, while the Live Paint Bucket is the
active tool, 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