mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-18 10:07:27 +00:00
Attributes: overprint reads the art of graph designs in series
attributes.info read its overprint values through the same targets as object.setOverprint, which leave out the art of graph designs drawn in graph series. With only that art selected, overprintFill and overprintStroke came back null while ids listed the art. The edits still leave the art out; the panel's read now includes it.
This commit is contained in:
@@ -493,6 +493,16 @@ fn paint_commands_leave_a_graph_designs_art_out() {
|
||||
refused_on_design_art(&mut s, "paint.freeform.addPoint", json!({"ids": [art.0], "at": [0, 0]}));
|
||||
}
|
||||
|
||||
/// `attributes.info` reads the overprint of a graph design's art in a series, which the overprint edits leave out.
|
||||
#[test]
|
||||
fn attributes_info_reads_a_graph_designs_art() {
|
||||
let (mut s, _, _, art, _) = design_art();
|
||||
let info = s.execute("attributes.info", &json!({"ids": [art.0]})).unwrap();
|
||||
assert_eq!(info["ids"], json!([art.0]));
|
||||
assert_eq!(info["overprintFill"], json!(false), "{info}");
|
||||
assert_eq!(info["overprintStroke"], json!(false), "{info}");
|
||||
}
|
||||
|
||||
/// With only the art of a graph design selected, `stroke.setAdvanced` and the stroke mode of `paint.editGradient` act
|
||||
/// as edits of a selection, not of the stroke the next object drawn takes.
|
||||
#[test]
|
||||
|
||||
@@ -133,7 +133,7 @@ fn aims(s: &Session, p: &Value, cmd: &str, kinds: impl IntoIterator<Item = bool>
|
||||
.into_iter()
|
||||
.map(|fill| {
|
||||
let it = item.of_kind(s, fill);
|
||||
Ok((fill, it, super::appearance::drop_design_art(&s.doc()?.doc, it.targets(s, p)?)))
|
||||
Ok((fill, it, it.targets(s, p)?))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -156,10 +156,15 @@ pub(super) fn edit_counted(s: &mut Session, label: &str, f: impl FnOnce(&mut Doc
|
||||
pub(super) type OverprintJob = ((bool, ItemTarget, Vec<NodeId>), bool);
|
||||
|
||||
/// The overprint edits `p` asks for under `keys` (the fill's and the stroke's), aimed as
|
||||
/// `object.setOverprint` aims.
|
||||
/// `object.setOverprint` aims, leaving out the art of graph designs drawn in graph series.
|
||||
pub(super) fn overprint_jobs(s: &Session, p: &Value, cmd: &str, keys: [&str; 2]) -> Result<Vec<OverprintJob>> {
|
||||
let kinds = kinds(p, cmd, keys)?;
|
||||
Ok(aims(s, p, cmd, kinds.iter().map(|k| k.0))?.into_iter().zip(kinds.iter().map(|k| k.1)).collect())
|
||||
let d = &s.doc()?.doc;
|
||||
Ok(aims(s, p, cmd, kinds.iter().map(|k| k.0))?
|
||||
.into_iter()
|
||||
.map(|(fill, it, ids)| (fill, it, super::appearance::drop_design_art(d, ids)))
|
||||
.zip(kinds.iter().map(|k| k.1))
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Apply `jobs` to `d`, adding the objects changed to `changed`.
|
||||
|
||||
Reference in New Issue
Block a user