Paint: invert and complement of design art alone still reject a bad target

paint.invert and paint.complement given only the art of a graph design,
with no item, returned success for a target other than "object" or
"contents", because the topmost-fill path read the target only after the
early return for design art. The target is now read before that return.
This commit is contained in:
dotCooCoo
2026-11-15 08:36:20 -08:00
parent 531ce2a10e
commit 94c815d971
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -563,8 +563,10 @@ fn paint_edits_of_design_art_alone_leave_the_defaults() {
json!({"ids": [art.0], "item": "top"}),
json!({"ids": [art.0], "item": fill, "aligned": "yes"}),
json!({"ids": [art.0], "item": fill, "target": "nowhere"}),
json!({"ids": [art.0], "target": "nowhere"}),
] {
assert!(s.execute("paint.invert", &bad).is_err(), "{bad}");
assert!(s.execute("paint.complement", &bad).is_err(), "{bad}");
}
// So is an `item` the art has no row for, in each command that leaves the art out.
let steps = s.doc().unwrap().history.undo.len();
+2 -1
View File
@@ -1098,6 +1098,8 @@ fn proxy_recolor(s: &mut Session, p: &Value, cmd: &str, label: &str, f: &dyn Fn(
ItemTarget::Item { .. } => super::appearance::reference_of(s, p, item, cmd)?,
ItemTarget::Top => None,
};
// Read before the check below too: `targets` reads no `target` for the topmost fill or stroke.
let contents = super::appearance::targets_contents(p)?;
let ids = super::appearance::drop_design_art(&s.doc()?.doc, ids);
// Only design art was given or selected: nothing changes, the defaults and remembered colors included.
if ids.is_empty() {
@@ -1128,7 +1130,6 @@ fn proxy_recolor(s: &mut Session, p: &Value, cmd: &str, label: &str, f: &dyn Fn(
// objects change as their paint targets do (a compound path's member stands for the compound path). Design art
// inside a given graph or series group is left out.
ItemTarget::Top => {
let contents = super::appearance::targets_contents(p)?;
let mut roots = vec![];
for id in &ids {
let n = s.doc()?.doc.node(*id);