Merge fix/graph-axis-paint-kept into fix/graph-axes-group-edits-kept

Takes #7375's later fixes: Move Appearance onto an axis line behind its
source, picks and added styles without transparency, Default Fill and
Stroke on an axis line, and edits that keep only the line attributes they
change. Aligned row edits, hidden rows, reorders and Default Fill and
Stroke on labels keep this branch's behavior.
This commit is contained in:
dotCooCoo
2026-11-14 16:45:22 -08:00
10 changed files with 398 additions and 109 deletions
+1 -1
View File
@@ -260,7 +260,7 @@ fn copy_paint(s: &mut Session, p: &Value, to_stroke: bool) -> Result<Value> {
let series = super::super::appearance::capture_series_paint_writes(&before, d, &ids, &written);
let labels = super::super::graph::capture_label_styles(d, &ids, &copy_run);
let painted: Vec<NodeId> = written.iter().map(|(id, _)| *id).collect();
let lines = super::super::graph::capture_line_rows(d, &painted);
let lines = super::super::graph::capture_line_changes(&before, d, &painted);
Ok(objects + usize::from(series || labels || lines))
})?;
}
+53 -36
View File
@@ -48,7 +48,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Add New Fill",
["Window", "Appearance"],
Some("Cmd+/"),
"{ids?|id?, target?: \"object\"|\"contents\"} add a fill on top of each selected object's own stack, on an image right below its Contents row, with its top fill's paint (type without one: its characters' fill; else the default fill). With a fill row active (appearance.setActiveItem), no `ids`, no `id` and no `target: \"contents\"`, the new fill takes that row's paint, goes right above it, and becomes the active row; appearance.duplicateItem copies a whole row. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind",
"{ids?|id?, target?: \"object\"|\"contents\"} add a fill on top of each selected object's own stack, on an image right below its Contents row, with its top fill's paint (type without one: its characters' fill; else the default fill). With a fill row active (appearance.setActiveItem), no `ids`, no `id` and no `target: \"contents\"`, the new fill takes that row's paint, goes right above it, and becomes the active row; appearance.duplicateItem copies a whole row. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes)",
has_doc,
|s, p| add_item(s, p, true)
),
@@ -57,7 +57,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Add New Stroke",
["Window", "Appearance"],
Some("Cmd+Alt+/"),
"{ids?|id?, target?} add a stroke on top of each selected object's own stack, on an image right below its Contents row, with its top stroke's paint (else the default stroke) and that stroke's weight when it has paint, at least 1 pt. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind",
"{ids?|id?, target?} add a stroke on top of each selected object's own stack, on an image right below its Contents row, with its top stroke's paint (else the default stroke) and that stroke's weight when it has paint, at least 1 pt. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes)",
has_doc,
|s, p| add_item(s, p, false)
),
@@ -75,7 +75,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Reduce to Basic Appearance",
["Window", "Appearance"],
None,
"{ids?|id?, target?} keep only one visible fill and stroke (without ids: the Appearance panel's active row in place of the topmost one of its kind; else the topmost), without their own opacity, blend mode or effects (a group keeps no rows it lacked), and drop the object's effects. On a path directly in a graph series (a series group's id stands for those paths and the group), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind",
"{ids?|id?, target?} keep only one visible fill and stroke (without ids: the Appearance panel's active row in place of the topmost one of its kind; else the topmost), without their own opacity, blend mode or effects (a group keeps no rows it lacked), and drop the object's effects. On a path directly in a graph series (a series group's id stands for those paths and the group), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes)",
has_doc,
reduce_basic
),
@@ -84,7 +84,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Appearance Item",
[],
None,
"{index: paint-order item index, ids?|id? (default: the selection), target?: \"object\"|\"contents\", opacity?: 0..100, blend?: name, visible?: bool, weight?: pt (strokes), color?|none?|swatch?|gradient? (as paint.setFill), tint?: 0..100, keepModel?: bool (both as paint.setFill), 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)} edit one fill/stroke of each target object's own appearance stack. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; when their rows differ, `index` needs `aligned` and is a row of the backmost one), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind",
"{index: paint-order item index, ids?|id? (default: the selection), target?: \"object\"|\"contents\", opacity?: 0..100, blend?: name, visible?: bool, weight?: pt (strokes), color?|none?|swatch?|gradient? (as paint.setFill), tint?: 0..100, keepModel?: bool (both as paint.setFill), 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)} edit one fill/stroke of each target object's own appearance stack. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; when their rows differ, `index` needs `aligned` and is a row of the backmost one), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes)",
has_doc,
set_item
),
@@ -93,7 +93,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Remove Item",
[],
None,
"{index | indices: [..] (paint-order item indices), ids?|id?, target?, 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)} remove those fills/strokes from each target object's own stack. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; when their rows differ, the indices need `aligned` and are rows of the backmost one), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind",
"{index | indices: [..] (paint-order item indices), ids?|id?, target?, 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)} remove those fills/strokes from each target object's own stack. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; when their rows differ, the indices need `aligned` and are rows of the backmost one), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes)",
has_doc,
remove_item
),
@@ -111,7 +111,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Duplicate Item",
["Window", "Appearance"],
None,
"{index | indices: [..] (paint-order item indices), to?: paint-order index of the copy (with several, of the lowest copy: they land together in their order; default: each right above its item; not with aligned rows of a mixed selection), contents?: count (with `to`: how many items paint below the Contents (Characters) row afterwards; default: it stays between the same items), ids?|id?, target?, 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)} copy fills/strokes with their effects, as Alt-dragging rows places them. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; when their rows differ, the indices need `aligned` and are rows of the backmost one), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind",
"{index | indices: [..] (paint-order item indices), to?: paint-order index of the copy (with several, of the lowest copy: they land together in their order; default: each right above its item; not with aligned rows of a mixed selection), contents?: count (with `to`: how many items paint below the Contents (Characters) row afterwards; default: it stays between the same items), ids?|id?, target?, 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)} copy fills/strokes with their effects, as Alt-dragging rows places them. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; when their rows differ, the indices need `aligned` and are rows of the backmost one), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes)",
has_doc,
duplicate_item
),
@@ -120,7 +120,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Reorder Appearance Item",
[],
None,
"{from: paint-order item index | \"contents\", indices?: [..] (several items instead of from: they move as one block in their order, the lowest landing at `to`; a block landing next to the Contents row keeps its lowest item's side), to, contents?: count, ids?|id?, target?, aligned?: bool (refused when the targets' appearances differ)} move fill/stroke `from` to paint-order index `to`; on a group, layer or type the Contents (Characters) row stays between the same items (a moved item landing next to it keeps its side) unless `contents` says how many items paint below it afterwards. from \"contents\": move that row so `to` items paint below the members (characters) and the rest above. On a path directly in a graph series (a series group's id stands for those paths, except with from \"contents\", which moves the group's own row), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; moving rows of such a group whose members' rows differ is an error), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind → {index: where the item landed | contents: the row's slot}",
"{from: paint-order item index | \"contents\", indices?: [..] (several items instead of from: they move as one block in their order, the lowest landing at `to`; a block landing next to the Contents row keeps its lowest item's side), to, contents?: count, ids?|id?, target?, aligned?: bool (refused when the targets' appearances differ)} move fill/stroke `from` to paint-order index `to`; on a group, layer or type the Contents (Characters) row stays between the same items (a moved item landing next to it keeps its side) unless `contents` says how many items paint below it afterwards. from \"contents\": move that row so `to` items paint below the members (characters) and the rest above. On a path directly in a graph series (a series group's id stands for those paths, except with from \"contents\", which moves the group's own row), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels; moving rows of such a group whose members' rows differ is an error), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes) → {index: where the item landed | contents: the row's slot}",
has_doc,
move_item
),
@@ -129,7 +129,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Eyedropper",
[],
None,
"{source: id, ids?, pickUp?, apply? (trees as eyedropper.setOptions, merged over the Eyedropper Options for this call), reverse?: bool, append?: bool, defaultsOnly?: bool} copy the attributes both picked up and applied (by default the whole appearance stack, opacity and blend mode, and from type to type the character and paragraph attributes using effective character dimensions while preserving target transforms) from `source` to ids (default: highlighted characters while editing type, after Select All in a frame of threaded text the text of the story's frames, leaving out `source`, otherwise the object selection; highlighted characters reject enabled non-neutral object transparency), the fill, stroke and weight also to the paint defaults; `defaultsOnly` updates only paint defaults and cannot be combined with ids, reverse or append; `reverse` (Alt-click) copies from the first selected object (or ids) onto `source` instead, or with nothing selected what the Eyedropper picked up last (a click without Alt); `append` (Shift+Alt-click) adds the source's fills, strokes and effects on top of each target's stack; placed gradients land at the same place relative to each target's bounds (defaults: fitted to new art); with an object of a dynamic symbol instance selected by Direct Selection and no ids, reverse, append or defaultsOnly, that object takes the source's fill and stroke (solid, none, gradient or pattern) for this instance only, as the Eyedropper Options allow, and a source that is not a path, compound path or type, or options that pick up neither color, are refused. On a path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke and the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, the graph stores, for every label of its kind, the character attributes the pick gives all of its text, its object opacity and blend mode, and with `append` its topmost visible fill and stroke rows; on a graph's axis line, tick mark or radar ring, its topmost visible fill and stroke rows (when the pick takes a paint, a stroke weight or a row's opacity and blend mode, or appends) and object opacity and blend mode for every line of its kind → {ids}",
"{source: id, ids?, pickUp?, apply? (trees as eyedropper.setOptions, merged over the Eyedropper Options for this call), reverse?: bool, append?: bool, defaultsOnly?: bool} copy the attributes both picked up and applied (by default the whole appearance stack, opacity and blend mode, and from type to type the character and paragraph attributes using effective character dimensions while preserving target transforms) from `source` to ids (default: highlighted characters while editing type, after Select All in a frame of threaded text the text of the story's frames, leaving out `source`, otherwise the object selection; highlighted characters reject enabled non-neutral object transparency), the fill, stroke and weight also to the paint defaults; `defaultsOnly` updates only paint defaults and cannot be combined with ids, reverse or append; `reverse` (Alt-click) copies from the first selected object (or ids) onto `source` instead, or with nothing selected what the Eyedropper picked up last (a click without Alt); `append` (Shift+Alt-click) adds the source's fills, strokes and effects on top of each target's stack; placed gradients land at the same place relative to each target's bounds (defaults: fitted to new art); with an object of a dynamic symbol instance selected by Direct Selection and no ids, reverse, append or defaultsOnly, that object takes the source's fill and stroke (solid, none, gradient or pattern) for this instance only, as the Eyedropper Options allow, and a source that is not a path, compound path or type, or options that pick up neither color, are refused. On a path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke and the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, the graph stores, for every label of its kind, the character attributes the pick gives all of its text, its object opacity and blend mode when transparency is applied, and with `append` its topmost visible fill and stroke rows; on a graph's axis line, tick mark or radar ring, its topmost visible fill and stroke rows, and when transparency is applied its object opacity and blend mode, for every line of its kind (a pick of some attributes without `append`: only what it changes) → {ids}",
has_doc,
copy_from
),
@@ -147,7 +147,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Show All Hidden Attributes",
["Window", "Appearance"],
None,
"{ids?|id?, target?} make every hidden fill, stroke and effect (the object's and each item's) of each selected object visible again; errors when nothing is hidden. On a path directly in a graph series (a series group's id stands for those paths and the group), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind → {ids}",
"{ids?|id?, target?} make every hidden fill, stroke and effect (the object's and each item's) of each selected object visible again; errors when nothing is hidden. On a path directly in a graph series (a series group's id stands for those paths and the group), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind (of a line, only what the edit changes) → {ids}",
has_doc,
show_all_hidden
),
@@ -572,7 +572,7 @@ fn shown_rows_edited(before: &Document, d: &Document, ids: Vec<NodeId>, wrote: i
/// What the edit changes on the topmost visible fill and stroke of graph series marks, and on the
/// rows and characters of graph labels, is stored on their graphs in the same step
/// ([`capture_series_changes`], [`super::graph::capture_label_changes`]), and so are the rows of
/// the graph lines it reaches ([`super::graph::capture_line_rows`]). Nothing targeted is not
/// the graph lines it reaches ([`super::graph::capture_line_changes`]). Nothing targeted is not
/// an edit, and when `f` leaves every target as it was, the document and its undo history stay as
/// they are.
pub(crate) fn edit_items(
@@ -587,7 +587,7 @@ pub(crate) fn edit_items(
edit_items_then(s, ids, item, cmd, label, fill, f, |before, d, edited| {
let series = capture_series_changes(before, d, edited);
// The rows `f` edited are kept by `edit_items_then`.
let labels = super::graph::capture_label_changes(before, d, edited, false);
let labels = super::graph::capture_label_changes(before, d, edited, false, None);
Ok(series || labels)
})
}
@@ -632,14 +632,27 @@ pub(crate) fn edit_items_then(
}
}
let more = after(&before, d, &edited)?;
// A graph line keeps only the attributes of its rows that the edit changed: the others stay as its kind keeps
// them, which the line may not show yet.
rows.retain(|id| !super::graph::is_graph_line(d, *id));
let labels = super::graph::capture_label_rows(d, &shown_rows_edited(&before, d, rows, |id| wrote.contains(&id)));
// A graph line keeps the rows the edit wrote, also when the line already showed them.
let lines = super::graph::capture_line_rows(d, &shown_rows_edited(&before, d, edited.clone(), |id| wrote.contains(&id)));
let lines = super::graph::capture_line_changes(&before, d, &edited);
Ok(count_changed(d, &before, &edited) + usize::from(more || labels || lines))
})?;
Ok(())
}
/// Keep the object rows of the graph labels among `ids` for every label of their kind
/// ([`super::graph::capture_label_rows`]), and of the graph lines among them only the attributes the edit changed
/// ([`super::graph::capture_line_changes`]): a line's other attributes stay as its kind keeps them, which the line may
/// not show yet. Returns whether what a graph keeps changed.
fn capture_row_edits(before: &vectorcraft_doc::Document, d: &mut vectorcraft_doc::Document, ids: &[NodeId]) -> bool {
let labels: Vec<NodeId> = ids.iter().copied().filter(|id| !super::graph::is_graph_line(d, *id)).collect();
let labels = super::graph::capture_label_rows(d, &labels);
let lines = super::graph::capture_line_changes(before, d, ids);
labels || lines
}
/// How many of `ids` differ in `d` from `before`.
pub(crate) fn count_changed(d: &vectorcraft_doc::Document, before: &vectorcraft_doc::Document, ids: &[NodeId]) -> usize {
ids.iter().filter(|id| d.node(**id) != before.node(**id)).count()
@@ -772,7 +785,7 @@ fn add_item(s: &mut Session, p: &Value, fill: bool) -> Result<Value> {
let mut rows = top_paint_changed(&before, d, &ids);
rows.extend(painted_rows(d, added));
super::graph::capture_series_top_paints(d, &rows);
super::graph::capture_label_rows(d, &ids);
capture_row_edits(&before, d, &ids);
Ok(())
})?;
// A fill added above the active row becomes the active row; otherwise the rows above the new
@@ -1006,8 +1019,9 @@ fn transfer(s: &mut Session, p: &Value) -> Result<Value> {
rows.extend(painted_rows(d, both_kinds(&targets)));
let painted = super::graph::capture_series_top_paints(d, &rows);
let object = super::graph::capture_series_object_opacity(d, &changed);
// The targets last: on two labels of one kind, the target's rows are the ones the kind keeps.
let labels = super::graph::capture_label_rows(d, &changed);
// The targets last: on two labels of one kind, the target's rows are the ones the kind keeps. Graph lines are
// taken in paint order, so the targets are captured again on their own, after a cleared source in front of them.
let labels = super::graph::capture_label_rows(d, &changed) | super::graph::capture_label_rows(d, &targets);
let all: Vec<NodeId> = from.iter().chain(&targets).chain(&group).copied().collect();
Ok(count_changed(d, &before, &all) + usize::from(kept || painted || object || labels || forgot))
})?;
@@ -1065,7 +1079,7 @@ fn reduce_basic(s: &mut Session, p: &Value) -> Result<Value> {
}
let kept = super::graph::capture_series_opacity(d, &both_kinds(&ids));
let painted = super::graph::capture_series_top_paints(d, &top_paint_changed(&before, d, &ids));
let labels = super::graph::capture_label_rows(d, &ids);
let labels = capture_row_edits(&before, d, &ids);
Ok(count_changed(d, &before, &ids) + usize::from(kept || painted || labels))
})?;
s.active_appearance_item = None;
@@ -1147,7 +1161,7 @@ fn set_item(s: &mut Session, p: &Value) -> Result<Value> {
rows.extend(painted_rows(d, written));
let painted = super::graph::capture_series_top_paints(d, &rows);
let reached = shown_rows_edited(&before, d, reached, |id| edited.iter().any(|(e, _)| *e == id));
let labels = super::graph::capture_label_rows(d, &reached);
let labels = capture_row_edits(&before, d, &reached);
Ok(count_changed(d, &before, &ids) + usize::from(kept || painted || labels))
})?;
if let Some(pa) = &paint {
@@ -1200,7 +1214,7 @@ fn remove_item(s: &mut Session, p: &Value) -> Result<Value> {
}
let kept = super::graph::capture_series_opacity(d, &top_opacity_changed(&before, d, &ids));
let painted = super::graph::capture_series_top_paints(d, &top_paint_changed(&before, d, &ids));
let labels = super::graph::capture_label_rows(d, &shown_rows_edited(&before, d, reached, |_| false));
let labels = capture_row_edits(&before, d, &shown_rows_edited(&before, d, reached, |_| false));
Ok(count_changed(d, &before, &ids) + usize::from(kept || painted || labels))
})?;
// The rows removed from the active row's object, which need not come first in `ids`.
@@ -1293,8 +1307,7 @@ fn duplicate_item(s: &mut Session, p: &Value) -> Result<Value> {
let top_copies: Vec<NodeId> = added.iter().map(|(id, _)| *id).collect();
rows.extend(painted_rows(d, added));
super::graph::capture_series_top_paints(d, &rows);
let reached = shown_rows_edited(&before, d, reached, |id| top_copies.contains(&id));
super::graph::capture_label_rows(d, &reached);
capture_row_edits(&before, d, &shown_rows_edited(&before, d, reached, |id| top_copies.contains(&id)));
Ok(())
})?;
// Rows at or above each copy move up by one (by the block, for copies placed at `to`).
@@ -1334,7 +1347,7 @@ fn show_all_hidden(s: &mut Session, p: &Value) -> Result<Value> {
}
super::graph::capture_series_opacity(d, &top_opacity_changed(&before, d, &shown));
super::graph::capture_series_top_paints(d, &top_paint_changed(&before, d, &shown));
super::graph::capture_label_rows(d, &shown);
capture_row_edits(&before, d, &shown);
Ok(shown)
})?;
Ok(json!({ "ids": ids.iter().map(|i| i.0).collect::<Vec<_>>() }))
@@ -1381,7 +1394,7 @@ fn move_item(s: &mut Session, p: &Value) -> Result<Value> {
}
let kept = super::graph::capture_series_opacity(d, &top_opacity_changed(&before, d, &ids));
let painted = super::graph::capture_series_top_paints(d, &top_paint_changed(&before, d, &ids));
let labels = super::graph::capture_label_changes(&before, d, &ids, true);
let labels = super::graph::capture_label_changes(&before, d, &ids, true, None);
Ok(count_changed(d, &before, &ids) + usize::from(kept || painted || labels))
})?;
// The moved row stays the active one; the rows it passed shift by one.
@@ -1427,7 +1440,7 @@ fn move_items(s: &mut Session, p: &Value, ids: &[NodeId], to: usize) -> Result<V
}
let kept = super::graph::capture_series_opacity(d, &top_opacity_changed(&before, d, ids));
let painted = super::graph::capture_series_top_paints(d, &top_paint_changed(&before, d, ids));
let labels = super::graph::capture_label_changes(&before, d, ids, true);
let labels = super::graph::capture_label_changes(&before, d, ids, true, None);
Ok(count_changed(d, &before, ids) + usize::from(kept || painted || labels))
})?;
let m = idx.len();
@@ -1461,7 +1474,7 @@ fn move_contents(s: &mut Session, ids: &[NodeId], to: usize) -> Result<Value> {
}
slot.ok_or_else(|| bad("appearance.moveItem", "only groups, layers, type and images have a Contents (Characters) row"))?;
// A graph label's kind keeps where its rows paint relative to the characters.
let labels = super::graph::capture_label_rows(d, ids);
let labels = capture_row_edits(&before, d, ids);
Ok(count_changed(d, &before, ids) + usize::from(labels))
})?;
Ok(json!({ "contents": slot }))
@@ -1728,20 +1741,24 @@ fn copy_from(s: &mut Session, p: &Value) -> Result<Value> {
let object = super::graph::capture_series_object_opacity(d, &objects);
// Graph labels keep their new rows, characters and paragraphs per kind of label.
// On type, only `append` adds rows and a transparency pick changes the object's opacity and blend mode; the other
// attributes go to the characters.
let rows = if append {
super::graph::capture_label_rows(d, &targets)
} else {
attrs.appearance.transparency && super::graph::capture_label_object_opacity(d, &targets)
// attributes go to the characters. Without a transparency pick, the object opacity and blend mode a kind keeps stay,
// also when the label or line picked onto still shows other ones until the graph is drawn again.
let transparency = attrs.appearance.transparency;
let rows = match (append, transparency) {
(true, true) => super::graph::capture_label_rows(d, &targets),
(true, false) => super::graph::capture_label_fill_stroke_rows(d, &targets),
(false, _) => transparency && super::graph::capture_label_object_opacity(d, &targets),
};
// `append` adds rows and leaves the characters as they were.
let text = !append && super::graph::capture_label_text(d, &targets, kept_text, kept_para)?;
// A graph line is a path: a pick of a paint, a weight or a row's opacity and blend mode writes the rows its kind
// keeps. A pick of only the object's opacity and blend mode, or of row attributes the graph does not keep (overprint,
// caps, joins, miter limit, dashes), leaves the fill and stroke its kind keeps, as `capture_label_object_opacity`
// keeps them.
let to_rows = append || fill.color || fill.transparency || stroke.color || stroke.transparency || stroke.weight;
let lines = to_rows && super::graph::capture_line_rows(d, &targets);
// A graph line is a path: a whole pick and `append` write its rows. A pick of some attributes keeps those it
// changed, and the rest stay as its kind keeps them, which the line may not show yet. Row attributes the graph
// does not keep (overprint, caps, joins, miter limit, dashes) leave what its kind keeps as it is.
let lines = match (rows_written, transparency) {
(true, true) => super::graph::capture_line_rows(d, &targets),
(true, false) => super::graph::capture_line_fill_stroke_rows(d, &targets),
(false, _) => super::graph::capture_line_changes(&before, d, &targets),
};
Ok(count_changed(d, &before, &targets) + usize::from(kept || painted || object || rows || text || lines))
})?;
Ok(finish(s, &targets))
+1 -1
View File
@@ -522,7 +522,7 @@ pub(crate) fn keeping_series_paint(d: &mut Document, roots: &[NodeId], recolor:
let n = recolor(d)?;
if let Some(before) = before.filter(|_| n > 0) {
super::appearance::capture_series_changes(&before, d, &marks);
super::graph::capture_label_changes(&before, d, &labels, true);
super::graph::capture_label_changes(&before, d, &labels, true, Some(roots));
}
Ok(n)
}
+5 -4
View File
@@ -46,10 +46,11 @@ use generate::generate;
#[cfg(test)]
use series::default_series_color;
pub(crate) use series::{
LabelTextChange, capture_label_anti_alias, capture_label_changes, capture_label_object_opacity, capture_label_paragraphs, capture_label_rows,
capture_label_styles, capture_label_styles_given, capture_label_text, capture_line_rows, capture_series_object_opacity, capture_series_opacity,
capture_series_top_paints, graph_part_members, is_design_art, label_object_opacity_differs, label_rows, labels_in, paint_targets,
series_group_marks, series_group_marks_where, series_groups_among, series_marks_in, series_object_opacity_differs, shown_paint,
LabelTextChange, capture_label_anti_alias, capture_label_changes, capture_label_fill_stroke_rows, capture_label_object_opacity,
capture_label_paragraphs, capture_label_rows, capture_label_styles, capture_label_styles_given, capture_label_text, capture_line_changes,
capture_line_fill_stroke_rows, capture_line_rows, capture_series_object_opacity, capture_series_opacity, capture_series_top_paints,
graph_part_members, is_design_art, is_graph_line, label_object_opacity_differs, label_rows, labels_in, paint_targets, series_group_marks,
series_group_marks_where, series_groups_among, series_marks_in, series_object_opacity_differs, shown_paint,
};
#[cfg(test)]
+121 -46
View File
@@ -855,30 +855,51 @@ fn lines_of(doc: &Document, ids: &[NodeId]) -> Vec<(NodeId, NodeId, Line)> {
out
}
/// What lines of kind `line` keep (`slot`) after line `n` shows its rows ([`label_rows`]), or with `object_only` what
/// `slot` keeps with the line's object opacity and blend mode: `None` when that is how the graph draws them with no
/// kept rows.
fn line_rows_after(slot: Option<&vectorcraft_doc::LabelRows>, line: Line, n: &Node, object_only: bool) -> Option<vectorcraft_doc::LabelRows> {
/// Which of the object rows ([`label_rows`]) a graph label or line shows its kind keeps after an edit.
#[derive(Clone, Copy, PartialEq, Eq)]
enum Keep {
/// All of them.
All,
/// Only the object opacity and blend mode; the fill and stroke rows stay as the kind keeps them.
Object,
/// The fill and stroke rows; the object opacity and blend mode stay as the kind keeps them.
Rows,
}
/// `shown` with the parts of the rows `kept` keeps that `keep` leaves as they are.
fn keep_rows(kept: vectorcraft_doc::LabelRows, shown: vectorcraft_doc::LabelRows, keep: Keep) -> vectorcraft_doc::LabelRows {
match keep {
Keep::All => shown,
Keep::Object => {
let mut kept = kept;
(kept.paint.opacity, kept.paint.blend) = (shown.paint.opacity, shown.paint.blend);
kept
}
Keep::Rows => {
let mut shown = shown;
(shown.paint.opacity, shown.paint.blend) = (kept.paint.opacity, kept.paint.blend);
shown
}
}
}
/// What lines of kind `line` keep (`slot`) after line `n` shows its rows ([`label_rows`]), of which `keep` says what is
/// taken from the line: `None` when that is how the graph draws them with no kept rows.
fn line_rows_after(slot: Option<&vectorcraft_doc::LabelRows>, line: Line, n: &Node, keep: Keep) -> Option<vectorcraft_doc::LabelRows> {
let shown = label_rows(n).unwrap_or_default();
let rows = if object_only {
let mut kept = slot.cloned().unwrap_or_else(|| line.default_rows());
(kept.paint.opacity, kept.paint.blend) = (shown.paint.opacity, shown.paint.blend);
kept
} else {
shown
};
let rows = keep_rows(slot.cloned().unwrap_or_else(|| line.default_rows()), shown, keep);
(rows != line.default_rows()).then_some(rows)
}
/// Keep the object rows ([`label_rows`]) of the graph lines among `ids` for every line of their kind (axis lines and tick
/// marks, or a radar graph's rings), with `object_only` only their object opacity and blend mode, even when a line
/// already showed them. Returns whether kept rows changed.
fn store_line_rows(doc: &mut Document, ids: &[NodeId], object_only: bool) -> bool {
/// marks, or a radar graph's rings), the part of them `keep` says, even when a line already showed them. Returns whether
/// kept rows changed.
fn store_line_rows(doc: &mut Document, ids: &[NodeId], keep: Keep) -> bool {
let mut changed = false;
for (id, graph, line) in lines_of(doc, ids) {
let Some(spec) = doc.node(graph).and_then(|n| n.extras().graph.as_deref()) else { continue };
let Some(n) = doc.node(id) else { continue };
let kept = line_rows_after(kept_line_rows(&spec.label_styles, line), line, n, object_only);
let kept = line_rows_after(kept_line_rows(&spec.label_styles, line), line, n, keep);
let Some(spec) = doc.node_mut(graph).and_then(|n| n.extras_if_any().and_then(|e| e.graph.as_deref_mut())) else { continue };
let slot = line_slot(&mut spec.label_styles, line);
changed |= *slot != kept;
@@ -891,22 +912,68 @@ fn store_line_rows(doc: &mut Document, ids: &[NodeId], object_only: bool) -> boo
/// for an edit that wrote their fill or stroke. Lines of a kind that the edit reached differently take the frontmost
/// one's rows. Called inside the same edit, so they undo together. Returns whether kept rows changed.
pub(crate) fn capture_line_rows(doc: &mut Document, ids: &[NodeId]) -> bool {
store_line_rows(doc, ids, false)
store_line_rows(doc, ids, Keep::All)
}
/// Keep the object rows of the graph lines among `ids` whose rows an edit changed (`before`: the document before the
/// edit) for every line of their kind. Returns whether kept rows changed.
fn capture_line_changes(before: &Document, doc: &mut Document, ids: &[NodeId]) -> bool {
let changed: Vec<NodeId> = ids
.iter()
.copied()
.filter(|id| graph_line(doc, *id).is_some() && before.node(*id).map(label_rows) != doc.node(*id).map(label_rows))
.collect();
store_line_rows(doc, &changed, false)
/// [`capture_line_rows`] for an edit that wrote the fill and stroke rows of graph lines `ids` and left their object
/// opacity and blend mode alone: those stay as the kind keeps them, also when a line still shows other ones until the
/// graph is drawn again.
pub(crate) fn capture_line_fill_stroke_rows(doc: &mut Document, ids: &[NodeId]) -> bool {
store_line_rows(doc, ids, Keep::Rows)
}
/// Would [`store_line_rows`] with `object_only` change what a graph keeps for the lines among `ids`? Reads the document
/// without copying it.
/// Keep, for every line of their kind, the attributes of the object rows ([`label_rows`]) that an edit changed on the
/// graph lines among `ids` (`before`: the document before the edit). The attributes the edit left alone stay as the kind
/// keeps them, also when a line still shows other ones until the graph is drawn again. Lines of a kind that the edit
/// changed differently take the frontmost one's attributes. Called inside the same edit, so they undo together. Returns
/// whether kept rows changed.
pub(crate) fn capture_line_changes(before: &Document, doc: &mut Document, ids: &[NodeId]) -> bool {
let mut changed = false;
for (id, graph, line) in lines_of(doc, ids) {
let old = before.node(id).and_then(label_rows).unwrap_or_default();
let new = doc.node(id).and_then(label_rows).unwrap_or_default();
if old == new {
continue;
}
let Some(spec) = doc.node_mut(graph).and_then(|n| n.extras_if_any().and_then(|e| e.graph.as_deref_mut())) else { continue };
let slot = line_slot(&mut spec.label_styles, line);
let mut rows = slot.clone().unwrap_or_else(|| line.default_rows());
merge_row_edits(&mut rows, &old, &new);
let kept = (rows != line.default_rows()).then_some(rows);
changed |= *slot != kept;
*slot = kept;
}
changed
}
/// Is `id` a graph line: a path directly in a graph's Axes group?
pub(crate) fn is_graph_line(doc: &Document, id: NodeId) -> bool {
graph_line(doc, id).is_some()
}
/// Set each attribute of `rows` that differs between `old` and `new` as `new` has it.
fn merge_row_edits(rows: &mut vectorcraft_doc::LabelRows, old: &vectorcraft_doc::LabelRows, new: &vectorcraft_doc::LabelRows) {
fn take<T: PartialEq + Clone>(kept: &mut T, old: &T, new: &T) {
if old != new {
*kept = new.clone();
}
}
let (k, o, n) = (&mut rows.paint, &old.paint, &new.paint);
take(&mut k.fill, &o.fill, &n.fill);
take(&mut k.stroke, &o.stroke, &n.stroke);
take(&mut k.stroke_width, &o.stroke_width, &n.stroke_width);
take(&mut k.fill_opacity, &o.fill_opacity, &n.fill_opacity);
take(&mut k.stroke_opacity, &o.stroke_opacity, &n.stroke_opacity);
take(&mut k.fill_blend, &o.fill_blend, &n.fill_blend);
take(&mut k.stroke_blend, &o.stroke_blend, &n.stroke_blend);
take(&mut k.opacity, &o.opacity, &n.opacity);
take(&mut k.blend, &o.blend, &n.blend);
take(&mut rows.below, &old.below, &new.below);
take(&mut rows.stroke_under, &old.stroke_under, &new.stroke_under);
}
/// Would [`store_line_rows`] with [`Keep::Object`] change what a graph keeps for the lines among `ids`? Reads the
/// document without copying it.
fn line_object_opacity_differs(doc: &Document, ids: &[NodeId]) -> bool {
let mut kept: Vec<(NodeId, Line, Option<vectorcraft_doc::LabelRows>)> = vec![];
for (id, graph, line) in lines_of(doc, ids) {
@@ -915,7 +982,7 @@ fn line_object_opacity_differs(doc: &Document, ids: &[NodeId]) -> bool {
Some(i) => kept.swap_remove(i).2,
None => kept_line_rows(&spec.label_styles, line).cloned(),
};
kept.push((graph, line, line_rows_after(slot.as_ref(), line, n, true)));
kept.push((graph, line, line_rows_after(slot.as_ref(), line, n, Keep::Object)));
}
kept.into_iter().any(|(graph, line, rows)| {
doc.node(graph).and_then(|n| n.extras().graph.as_deref()).is_some_and(|spec| kept_line_rows(&spec.label_styles, line) != rows.as_ref())
@@ -928,14 +995,22 @@ fn line_object_opacity_differs(doc: &Document, ids: &[NodeId]) -> bool {
/// looked up. The graph lines among `ids` keep their rows for every line of their kind too ([`capture_line_rows`]).
/// Called inside the same edit, so they undo together. Returns whether kept rows changed.
pub(crate) fn capture_label_rows(doc: &mut Document, ids: &[NodeId]) -> bool {
store_label_rows(doc, ids, false)
store_label_rows(doc, ids, Keep::All)
}
/// Keep the object opacity and blend mode of graph labels and graph lines `ids` for every label or line of their kind, as
/// [`capture_label_rows`] keeps them, and leave the kept fill and stroke rows as they are. Returns whether what the graph
/// keeps changed.
pub(crate) fn capture_label_object_opacity(doc: &mut Document, ids: &[NodeId]) -> bool {
store_label_rows(doc, ids, true)
store_label_rows(doc, ids, Keep::Object)
}
/// Keep the fill and stroke rows of graph labels and graph lines `ids` for every label or line of their kind, as
/// [`capture_label_rows`] keeps them, for an edit that left their object opacity and blend mode alone: those stay as the
/// kind keeps them, also when a label or line still shows other ones until the graph is drawn again. Returns whether what
/// the graph keeps changed.
pub(crate) fn capture_label_fill_stroke_rows(doc: &mut Document, ids: &[NodeId]) -> bool {
store_label_rows(doc, ids, Keep::Rows)
}
/// Would [`capture_label_object_opacity`] change what a graph keeps for labels `ids`? Reads the document without copying
@@ -949,13 +1024,13 @@ pub(crate) fn label_object_opacity_differs(doc: &Document, ids: &[NodeId]) -> bo
Role::Category => &spec.label_styles.categories_rows,
Role::Legend => &spec.label_styles.legend_rows,
};
*slot != kept_label_rows(slot, rows, true)
*slot != kept_label_rows(slot, rows, Keep::Object)
})
}
/// [`capture_label_rows`], or with `object_only` [`capture_label_object_opacity`].
fn store_label_rows(doc: &mut Document, ids: &[NodeId], object_only: bool) -> bool {
let mut changed = store_line_rows(doc, ids, object_only);
/// [`capture_label_rows`], [`capture_label_object_opacity`] or [`capture_label_fill_stroke_rows`], as `keep` says.
fn store_label_rows(doc: &mut Document, ids: &[NodeId], keep: Keep) -> bool {
let mut changed = store_line_rows(doc, ids, keep);
for (graph, role, rows) in label_rows_of(doc, ids) {
let Some(spec) = doc.node_mut(graph).and_then(|n| n.extras_if_any().and_then(|e| e.graph.as_deref_mut())) else { continue };
let slot = match role {
@@ -963,26 +1038,23 @@ fn store_label_rows(doc: &mut Document, ids: &[NodeId], object_only: bool) -> bo
Role::Category => &mut spec.label_styles.categories_rows,
Role::Legend => &mut spec.label_styles.legend_rows,
};
let kept = kept_label_rows(slot, rows, object_only);
let kept = kept_label_rows(slot, rows, keep);
changed |= *slot != kept;
*slot = kept;
}
changed
}
/// What a kind keeps after a label of it shows `rows`: those rows, or with `object_only` what `slot` keeps with the
/// label's object opacity and blend mode.
/// What a kind keeps (`slot`) after a label of it shows `rows`, of which `keep` says what is taken from the label.
fn kept_label_rows(
slot: &Option<vectorcraft_doc::LabelRows>,
rows: Option<vectorcraft_doc::LabelRows>,
object_only: bool,
keep: Keep,
) -> Option<vectorcraft_doc::LabelRows> {
if !object_only {
if keep == Keep::All {
return rows;
}
let mut kept = slot.clone().unwrap_or_default();
let shown = rows.unwrap_or_default();
(kept.paint.opacity, kept.paint.blend) = (shown.paint.opacity, shown.paint.blend);
let kept = keep_rows(slot.clone().unwrap_or_default(), rows.unwrap_or_default(), keep);
(kept != vectorcraft_doc::LabelRows::default()).then_some(kept)
}
@@ -1145,9 +1217,11 @@ pub(crate) fn labels_in(doc: &Document, roots: &[NodeId]) -> Vec<NodeId> {
/// and stroke attributes ([`RUN_PAINT`]) that changed on all of a label's characters, on the kind's kept style. The
/// frontmost label of a kind sets what that kind keeps, whatever order `ids` are in. On a graph that colors its legend
/// labels itself ([`picks_legend_fill`]), their fill is kept only when the legend labels among `ids` end up with one
/// fill. The graph lines among `ids` whose rows changed keep them for every line of their kind ([`capture_line_rows`]),
/// with or without `rows`. Called inside the same edit, so they undo together. Returns whether what a graph keeps changed.
pub(crate) fn capture_label_changes(before: &Document, doc: &mut Document, ids: &[NodeId], rows: bool) -> bool {
/// fill and the edit named them: with `named`, only a legend label among `named` (an edit that reached the others
/// through the graph or a group leaves them the graph's black or white); without it, every label in `ids`. The graph
/// lines among `ids` whose rows changed keep what changed for every line of their kind ([`capture_line_changes`]), with or without
/// `rows`. Called inside the same edit, so they undo together. Returns whether what a graph keeps changed.
pub(crate) fn capture_label_changes(before: &Document, doc: &mut Document, ids: &[NodeId], rows: bool, named: Option<&[NodeId]>) -> bool {
let lines = capture_line_changes(before, doc, ids);
if !ids.iter().any(|id| doc.node(*id).is_some_and(|n| matches!(n.kind, NodeKind::Text(_)))) {
return lines;
@@ -1175,7 +1249,8 @@ pub(crate) fn capture_label_changes(before: &Document, doc: &mut Document, ids:
if rows && label_rows(was) != label_rows(now) {
changed_rows.push(id);
}
let fill = kind.1 != Role::Legend || one_fill(kind.0);
let aimed = !wedge_fills.contains_key(&kind.0) || named.is_none_or(|n| n.contains(&id));
let fill = kind.1 != Role::Legend || (one_fill(kind.0) && aimed);
characters.extend(run_paint_change(was, now, fill).map(|change| (kind, change)));
}
let mut changed = capture_label_rows(doc, &changed_rows) | lines;
+183
View File
@@ -6659,6 +6659,24 @@ fn a_recolor_leaves_wedge_legend_labels_their_contrast() {
assert_eq!(kept.and_then(|f| f.color()).map(|c| c.to_hex()).as_deref(), Some("#ffffff"));
}
/// A recolor of the whole graph that turns every wedge legend label the same color (one series) still leaves them to
/// the graph's black or white, so a label stays readable when its wedge is painted light again.
#[test]
fn a_recolor_of_a_one_series_pie_leaves_its_wedge_label_its_contrast() {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = make(&mut s, "pie", ",a\nP1,1");
s.execute("graph.setType", &json!({"id": id.0, "pieLegend": "wedges"})).unwrap();
s.execute("paint.setFill", &json!({"ids": [series_0_group(&s, id).0.0], "color": "#ffffff"})).unwrap();
// The white wedge turns black and its black label white.
s.execute("edit.colors.invert", &json!({"ids": [id.0]})).unwrap();
assert_eq!(spec(&s, id).label_styles.legend, None);
s.execute("paint.setFill", &json!({"ids": [series_0_group(&s, id).0.0], "color": "#ffffff"})).unwrap();
s.execute("graph.setData", &json!({"id": id.0, "rows": [[1]]})).unwrap();
let NodeKind::Text(t) = label_node(&s, id, "Legend", "a").kind else { panic!("a is not type") };
assert_eq!(t.runs[0].style.fill.color().map(|c| c.to_hex()).as_deref(), Some("#000000"));
}
/// The lines in graph `id`'s Axes group (axis lines, tick marks and a radar graph's rings), in paint order.
fn line_nodes(s: &Session, id: NodeId) -> Vec<vectorcraft_doc::Node> {
let n = s.doc().unwrap().doc.node(id).unwrap().clone();
@@ -6781,6 +6799,21 @@ fn the_frontmost_axis_line_sets_what_its_recolor_keeps() {
assert_eq!(kept.as_deref(), Some("#00ffff"), "the inverted red of the frontmost line");
}
/// An appearance moved from an axis line to one behind it is kept for every axis line, not the cleared source's.
#[test]
fn an_appearance_moved_to_an_axis_line_behind_is_kept() {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = graph(&mut s, "column");
let lines = line_nodes(&s, id);
let (back, front) = (lines[0].id, lines[lines.len() - 1].id);
s.execute("paint.setStroke", &json!({"ids": [front.0], "color": "#ff0000"})).unwrap();
s.execute("appearance.transfer", &json!({"source": front.0, "target": back.0})).unwrap();
let kept = spec(&s, id).label_styles.axis_rows.unwrap().paint.stroke.and_then(|p| p.color()).map(|c| c.to_hex());
assert_eq!(kept.as_deref(), Some("#ff0000"), "the moved red, not the cleared source");
assert!(redrawn_line_looks(&mut s, id).iter().all(|l| l.0 == "#ff0000"));
}
/// A radar graph's spoke brought in front of its rings is still a spoke: what is set on it is kept for the spokes.
#[test]
fn a_radar_spoke_moved_in_front_of_the_rings_keeps_its_kind() {
@@ -6881,6 +6914,139 @@ fn a_reorder_that_changes_nothing_on_an_axis_line_keeps_the_stroke_its_kind_keep
assert!(looks.iter().all(|l| l.0 == "#ff0000"), "{looks:?}");
}
/// An Eyedropper pick that applies only the object's transparency to an axis line keeps the stroke its kind keeps, though
/// the line it is applied to still shows the default stroke.
#[test]
fn a_transparency_only_pick_on_an_axis_line_keeps_the_stroke_its_kind_keeps() {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = graph(&mut s, "column");
let rect = NodeId(s.execute("shape.rectangle", &json!({"x": 600, "y": 600, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap());
s.execute("transparency.set", &json!({"ids": [rect.0], "opacity": 50})).unwrap();
let lines = line_nodes(&s, id);
s.execute("paint.setStroke", &json!({"ids": [lines[0].id.0], "color": "#ff0000"})).unwrap();
assert_eq!(line_look(&line_nodes(&s, id)[1]).0, "#000000", "the other lines show black until the graph is drawn again");
let fill = json!({"color": false, "transparency": false, "overprint": false});
let stroke = json!({"color": false, "transparency": false, "overprint": false, "weight": false, "cap": false, "join": false, "miter": false, "dash": false});
let apply = json!({"appearance": {"transparency": true, "fill": fill, "stroke": stroke}, "character": false, "paragraph": false});
s.execute("appearance.copyFrom", &json!({"source": rect.0, "ids": [lines[1].id.0], "apply": apply})).unwrap();
let looks = redrawn_line_looks(&mut s, id);
assert!(looks.iter().all(|l| l.0 == "#ff0000" && (l.2 - 0.5).abs() < 1e-6), "{looks:?}");
}
/// The Eyedropper Options that apply every fill and stroke attribute but not the object's transparency.
fn every_row_attribute_without_transparency() -> serde_json::Value {
let fill = json!({"color": true, "transparency": true, "overprint": true});
let stroke =
json!({"color": true, "transparency": true, "overprint": true, "weight": true, "cap": true, "join": true, "miter": true, "dash": true});
json!({"appearance": {"transparency": false, "fill": fill, "stroke": stroke}, "character": false, "paragraph": false})
}
/// An Eyedropper pick of every fill and stroke attribute without the object's transparency, with or without `append`,
/// keeps the object opacity the axis lines keep from another line, though the line it is applied to still shows 100%.
#[test]
fn a_pick_without_transparency_on_an_axis_line_keeps_the_opacity_its_kind_keeps() {
for append in [false, true] {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = graph(&mut s, "column");
let rect = NodeId(s.execute("shape.rectangle", &json!({"x": 600, "y": 600, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap());
s.execute("paint.setStroke", &json!({"ids": [rect.0], "color": "#ff0000"})).unwrap();
s.execute("paint.setFill", &json!({"ids": [rect.0], "none": true})).unwrap();
let lines = line_nodes(&s, id);
s.execute("transparency.set", &json!({"ids": [lines[0].id.0], "opacity": 40})).unwrap();
assert_eq!(line_look(&line_nodes(&s, id)[1]).2, 1.0, "append {append}: the other lines show 100% until the graph is drawn again");
let pick = json!({"source": rect.0, "ids": [lines[1].id.0], "apply": every_row_attribute_without_transparency(), "append": append});
s.execute("appearance.copyFrom", &pick).unwrap();
let looks = redrawn_line_looks(&mut s, id);
assert!(looks.iter().all(|l| l.0 == "#ff0000" && (l.2 - 0.4).abs() < 1e-6), "append {append}: {looks:?}");
}
}
/// A graphic style added on top of a graph label's or axis line's appearance keeps the object opacity its kind keeps
/// from another label or line, though the one it is added to still shows 100%.
#[test]
fn a_graphic_style_added_to_a_label_or_axis_line_keeps_the_opacity_its_kind_keeps() {
for label in [false, true] {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = graph(&mut s, "column");
let rect = NodeId(s.execute("shape.rectangle", &json!({"x": 600, "y": 600, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap());
s.execute("paint.setStroke", &json!({"ids": [rect.0], "color": "#ff0000"})).unwrap();
s.execute("paint.setFill", &json!({"ids": [rect.0], "none": true})).unwrap();
s.execute("graphicStyle.new", &json!({"id": rect.0, "name": "Red"})).unwrap();
let (first, second) = if label {
(text_id(&s, id, "Axes", "Q1"), text_id(&s, id, "Axes", "Q2"))
} else {
let lines = line_nodes(&s, id);
(lines[0].id, lines[1].id)
};
s.execute("transparency.set", &json!({"ids": [first.0], "opacity": 40})).unwrap();
assert_eq!(s.doc().unwrap().doc.node(second).unwrap().opacity, 1.0, "label {label}: 100% until the graph is drawn again");
s.execute("graphicStyle.apply", &json!({"name": "Red", "ids": [second.0], "add": true})).unwrap();
if label {
let looks = redrawn_label_rows(&mut s, id);
for q in ["Q1", "Q2", "Q3"] {
let (rows, opacity) = rows_of(&looks, q);
assert!((opacity - 0.4).abs() < 1e-6 && rows.iter().any(|r| !r.0 && r.1 == "#ff0000"), "{q}: {rows:?} {opacity}");
}
} else {
let looks = redrawn_line_looks(&mut s, id);
assert!(looks.iter().all(|l| l.0 == "#ff0000" && (l.2 - 0.4).abs() < 1e-6), "{looks:?}");
}
}
}
/// An Eyedropper pick with `append` and without the object's transparency on a graph label keeps the object opacity its
/// kind keeps from another label, though the label it is applied to still shows 100%.
#[test]
fn an_appended_pick_without_transparency_on_a_label_keeps_the_opacity_its_kind_keeps() {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = graph(&mut s, "column");
let rect = NodeId(s.execute("shape.rectangle", &json!({"x": 600, "y": 600, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap());
s.execute("paint.setStroke", &json!({"ids": [rect.0], "color": "#ff0000"})).unwrap();
s.execute("paint.setFill", &json!({"ids": [rect.0], "none": true})).unwrap();
s.execute("transparency.set", &json!({"ids": [text_id(&s, id, "Axes", "Q1").0], "opacity": 40})).unwrap();
let q2 = text_id(&s, id, "Axes", "Q2");
assert_eq!(s.doc().unwrap().doc.node(q2).unwrap().opacity, 1.0, "Q2 shows 100% until the graph is drawn again");
let pick = json!({"source": rect.0, "ids": [q2.0], "apply": every_row_attribute_without_transparency(), "append": true});
s.execute("appearance.copyFrom", &pick).unwrap();
let looks = redrawn_label_rows(&mut s, id);
for q in ["Q1", "Q2", "Q3"] {
let (rows, opacity) = rows_of(&looks, q);
assert!((opacity - 0.4).abs() < 1e-6, "{q}: {opacity}");
assert!(rows.iter().any(|r| !r.0 && r.1 == "#ff0000"), "{q}: {rows:?}");
}
}
/// An edit of some attributes on an axis line that still shows the default stroke keeps what it changes, and the stroke
/// its kind keeps from another line stays: a cap is not kept, so it changes nothing the kind keeps.
#[test]
fn an_edit_of_some_attributes_on_an_axis_line_keeps_the_rest_its_kind_keeps() {
let cases = [
("stroke.set", json!({"cap": "round"}), ""),
("paint.setFill", json!({"color": "#0000ff"}), "#0000ff"),
("appearance.setItem", json!({"index": 0, "color": "#00ff00"}), "#00ff00"),
];
for (cmd, params, fill) in cases {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = graph(&mut s, "column");
let lines = line_nodes(&s, id);
s.execute("paint.setStroke", &json!({"ids": [lines[0].id.0], "color": "#ff0000"})).unwrap();
assert_eq!(line_look(&line_nodes(&s, id)[1]).0, "#000000", "{cmd}: the other lines show black until the graph is drawn again");
let mut p = params.clone();
p["ids"] = json!([lines[1].id.0]);
s.execute(cmd, &p).unwrap();
let looks = redrawn_line_looks(&mut s, id);
assert!(looks.iter().all(|l| *l == ("#ff0000".into(), 0.5, 1.0)), "{cmd}: {looks:?}");
let fills: Vec<String> =
line_nodes(&s, id).iter().map(|n| n.appearance.fill_paint().color().map(|c| c.to_hex()).unwrap_or_default()).collect();
assert!(fills.iter().all(|f| f == fill), "{cmd}: {fills:?}");
}
}
/// An opacity and a stroke weight given to a radar graph's ring are kept for its rings, and its spokes keep their own.
#[test]
fn transparency_and_stroke_weight_on_a_radar_ring_are_kept_for_its_rings() {
@@ -7167,6 +7333,23 @@ fn a_style_given_a_radar_graphs_axes_group_is_kept_for_spokes_and_rings() {
assert!(looks.iter().all(|l| l.0.is_empty()), "the style has no stroke: {looks:?}");
}
/// Default Fill and Stroke on an axis line that already shows the default paint is kept for every axis line, in place of
/// the stroke the kind keeps from another line, and leaves the object opacity the kind keeps from another line.
#[test]
fn default_fill_and_stroke_on_an_axis_line_that_shows_it_is_kept() {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap();
let id = graph(&mut s, "column");
let lines = line_nodes(&s, id);
s.execute("paint.default", &json!({"ids": [lines[0].id.0]})).unwrap();
s.execute("paint.setStroke", &json!({"ids": [lines[1].id.0], "color": "#ff0000"})).unwrap();
s.execute("object.setProps", &json!({"ids": [lines[1].id.0], "opacity": 50})).unwrap();
s.execute("paint.default", &json!({"ids": [lines[0].id.0]})).unwrap();
let looks = redrawn_line_looks(&mut s, id);
assert!(looks.iter().all(|l| (l.0.as_str(), l.1) == ("#000000", 1.0)), "the 1 pt black default stroke: {looks:?}");
assert!(looks.iter().all(|l| (l.2 - 0.5).abs() < 1e-6), "the kind keeps its 50% opacity: {looks:?}");
}
#[test]
fn pie_names_and_wedge_labels_keep_their_style() {
let mut s = Session::new();
+5 -4
View File
@@ -989,7 +989,7 @@ fn swap(s: &mut Session, p: &Value) -> Result<Value> {
}
// The swap writes the paint of the topmost fill and stroke, not their opacity.
let kept = super::appearance::capture_series_writes(&before, d, &ids, (true, true), (false, false), true, false);
let labels = super::graph::capture_label_changes(&before, d, &ids, false);
let labels = super::graph::capture_label_changes(&before, d, &ids, false, None);
Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept || labels))
})?;
}
@@ -1019,13 +1019,14 @@ fn default_paint(s: &mut Session, p: &Value) -> Result<Value> {
}
}
let kept = super::appearance::capture_series_writes(&before, d, &ids, (true, true), (true, true), false, false);
// The graph keeps the default paint for every label and line of a kind it reached, also when one already
// showed it.
// The graph keeps the default paint for every label of a kind it reached, and the default fill and stroke rows
// for every line of a kind it reached, also when one already showed them; the object opacity a line kind keeps
// stays.
let labels = super::graph::capture_label_styles(d, &ids, &|st| {
st.fill = Paint::solid(Color::BLACK);
st.stroke = Paint::None;
});
let lines = super::graph::capture_line_rows(d, &ids);
let lines = super::graph::capture_line_fill_stroke_rows(d, &ids);
Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept || labels || lines))
})?;
}
+1 -1
View File
@@ -22,7 +22,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Stroke Options",
["Window", "Stroke"],
None,
"{weight?: pt, cap?: butt|round|square, join?: miter|round|bevel, miterLimit?, align?: center|inside|outside, dash?: [d,g,…]|null (a 0 dash with a round or projecting cap draws dots or squares; a new pattern keeps the current offset and alignment), dashOffset? (exact dashes only), alignDashes?: bool (true: dashes fitted to corners and path ends, every run between them holding whole periods with a dash centred on each corner and end; false, the default for a new pattern: exact lengths), startArrow?, endArrow?: Arrow|ArrowOpen|LineArrow|Barbed|Concave|DoubleArrow|HalfArrowLeft|HalfArrowRight|Chevron|Feather|Swallowtail|Triangle|TriangleOpen|TriangleReverse|TriangleBar|Kite|Leaf|Drop|Circle|CircleOpen|HalfCircle|Oval|Target|Square|SquareOpen|Tag|TagOpen|Diamond|DiamondOpen|Hexagon|HexagonOpen|Star|Cross|Plus|Bar|DoubleBar|DotOnBar|Slash|DoubleSlash|Bracket|Fork|null|{custom: name} (a custom arrowhead of the arrowheads file, stroke.arrowheads.list)|{Custom: {name, path}} (a custom head with its art, as document.inspect reports one; refused when the path fills no area, parts thinner than a millionth of a head unit counting as none, or has more than 4096 anchors, more than 4096 subpaths or a point more than 64 head units from the tip) (HalfArrowLeft/Right: one barb, left or right of the direction the head points), arrowAlign?: \"extend\" (tip past the end point, default)|\"tip\" (tip on the end point; the stroke is shortened), profile?: \"uniform\"|\"lens\"|\"taperStart\"|\"taperEnd\"|\"pinch\"|\"teardrop\"|\"wave\"|a saved profile's name (stroke.widthProfile.list), widthPoints?, gradientMode? (as document.inspect reports them in strokeOptions, so those read back unchanged; ignored here: a custom profile is set with the Width tool, gradientMode with paint.editGradient), item?: stroke item index|null (omitted: the Appearance panel's active item if it is a stroke, else the top stroke, created when missing), ids?|id?, target?: \"object\"|\"contents\", 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)} Without a stroke item, type takes weight, cap, join, miterLimit, align (around its glyph outlines; the type stays live) and the dash options as its characters' stroke (every run; text.setRangeStyle `strokeOptions` styles a range), and images and symbol instances (also in groups) are left alone. With nothing selected (and no ids) they set up the next object drawn (appearance.newArt; weight always does). On a path directly in a graph series, the graph also stores a weight it changes on the topmost visible stroke (docs/mcp.md); on a graph label's stroke row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind, and on its characters the stroke options they take; on a graph's axis line, tick mark or radar ring, the graph stores the paint, weight, opacity and blend mode of its topmost visible fill and stroke rows for every line of its kind, and not its caps, joins, dashes, alignment or arrowheads → {objects: how many objects took the stroke options}",
"{weight?: pt, cap?: butt|round|square, join?: miter|round|bevel, miterLimit?, align?: center|inside|outside, dash?: [d,g,…]|null (a 0 dash with a round or projecting cap draws dots or squares; a new pattern keeps the current offset and alignment), dashOffset? (exact dashes only), alignDashes?: bool (true: dashes fitted to corners and path ends, every run between them holding whole periods with a dash centred on each corner and end; false, the default for a new pattern: exact lengths), startArrow?, endArrow?: Arrow|ArrowOpen|LineArrow|Barbed|Concave|DoubleArrow|HalfArrowLeft|HalfArrowRight|Chevron|Feather|Swallowtail|Triangle|TriangleOpen|TriangleReverse|TriangleBar|Kite|Leaf|Drop|Circle|CircleOpen|HalfCircle|Oval|Target|Square|SquareOpen|Tag|TagOpen|Diamond|DiamondOpen|Hexagon|HexagonOpen|Star|Cross|Plus|Bar|DoubleBar|DotOnBar|Slash|DoubleSlash|Bracket|Fork|null|{custom: name} (a custom arrowhead of the arrowheads file, stroke.arrowheads.list)|{Custom: {name, path}} (a custom head with its art, as document.inspect reports one; refused when the path fills no area, parts thinner than a millionth of a head unit counting as none, or has more than 4096 anchors, more than 4096 subpaths or a point more than 64 head units from the tip) (HalfArrowLeft/Right: one barb, left or right of the direction the head points), arrowAlign?: \"extend\" (tip past the end point, default)|\"tip\" (tip on the end point; the stroke is shortened), profile?: \"uniform\"|\"lens\"|\"taperStart\"|\"taperEnd\"|\"pinch\"|\"teardrop\"|\"wave\"|a saved profile's name (stroke.widthProfile.list), widthPoints?, gradientMode? (as document.inspect reports them in strokeOptions, so those read back unchanged; ignored here: a custom profile is set with the Width tool, gradientMode with paint.editGradient), item?: stroke item index|null (omitted: the Appearance panel's active item if it is a stroke, else the top stroke, created when missing), ids?|id?, target?: \"object\"|\"contents\", 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)} Without a stroke item, type takes weight, cap, join, miterLimit, align (around its glyph outlines; the type stays live) and the dash options as its characters' stroke (every run; text.setRangeStyle `strokeOptions` styles a range), and images and symbol instances (also in groups) are left alone. With nothing selected (and no ids) they set up the next object drawn (appearance.newArt; weight always does). On a path directly in a graph series, the graph also stores a weight it changes on the topmost visible stroke (docs/mcp.md); on a graph label's stroke row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind, and on its characters the stroke options they take; on a graph's axis line, tick mark or radar ring, the graph stores the paint, weight, opacity and blend mode of its topmost visible fill and stroke rows that the edit changes for every line of its kind, and not its caps, joins, dashes, alignment or arrowheads → {objects: how many objects took the stroke options}",
has_doc,
stroke_set
),
+8 -3
View File
@@ -31,7 +31,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Apply Graphic Style",
["Window", "Graphic Styles"],
None,
"{name, add?: bool, ids?|id? (layers too), target?: \"object\"|\"contents\"} give the objects (default: the selection; a group or layer itself, its fills and strokes painting its members and its effects applying to them as one piece; target contents: the objects inside instead) the style's appearance, opacity, blend mode, isolate and knockout, and link them to it (placed gradients land at the same place relative to each object's bounds); add: true (Alt-click) adds its fills, strokes and effects on top of the existing appearance instead and unlinks. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (with `add`: of the kinds of row the style shows) and, without `add`, the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind. With nothing selected (and no ids) the next object drawn takes the style instead (see appearance.newArt) → {newArt: true}",
"{name, add?: bool, ids?|id? (layers too), target?: \"object\"|\"contents\"} give the objects (default: the selection; a group or layer itself, its fills and strokes painting its members and its effects applying to them as one piece; target contents: the objects inside instead) the style's appearance, opacity, blend mode, isolate and knockout, and link them to it (placed gradients land at the same place relative to each object's bounds); add: true (Alt-click) adds its fills, strokes and effects on top of the existing appearance instead and unlinks. On a path directly in a graph series (a series group's id stands for those paths), the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (with `add`: of the kinds of row the style shows) and, without `add`, the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and, without `add`, its object opacity and blend mode for every label or line of its kind. With nothing selected (and no ids) the next object drawn takes the style instead (see appearance.newArt) → {newArt: true}",
has_doc,
style_apply
),
@@ -374,8 +374,13 @@ fn style_apply(s: &mut Session, p: &Value) -> Result<Value> {
super::appearance::clear_stood_for(d, &groups);
super::appearance::capture_series_writes(&before, d, &ids, (true, true), (true, true), false, true);
}
// A label keeps its new rows for its kind of label.
super::graph::capture_label_rows(d, &ids);
// A label or graph line keeps its new rows for its kind. A style added on top leaves the object opacity and blend
// mode, so the kind keeps its own.
if add {
super::graph::capture_label_fill_stroke_rows(d, &ids);
} else {
super::graph::capture_label_rows(d, &ids);
}
Ok(())
})?;
ok()
+20 -13
View File
@@ -882,10 +882,11 @@ placement they set there. A stroke weight and dashes are stored as the label sho
scaled. When the characters of labels of one kind change differently, the frontmost label sets what the kind keeps. On
a pie with Legends in Wedges, a fill a command sets on the legend labels is drawn on every wedge, black included, until
that command is undone; a size, font or stroke change does not set one. Before that, their fill is stored only when
every legend label the command reaches ends up with the same fill. Otherwise they are drawn again in black, or white on
a dark wedge. `paint.default` stores the black fill and no stroke for the kind of each label it reaches, also when the
label already showed them. What they change on a graph's axis lines, tick marks and radar rings is stored as described
below.
every legend label the command reaches ends up with the same fill. The recolor commands also need to be given the legend
labels themselves: a recolor given the graph or a group that holds it does not store their fill. When their fill is not
stored, they are drawn again in black, or white on a dark wedge. `paint.default` stores the black fill and no stroke for
the kind of each label it reaches, also when the label already showed them. What these commands change on a graph's
axis lines, tick marks and radar rings is stored as described below.
`text.setFormat` without `start` and `end`, on a graph or on its labels, stores the character and paragraph attributes
it sets for each kind of label it reaches (value axis numbers, category labels, legend labels), and every label of that
@@ -906,9 +907,10 @@ kind of label: the paint, weight, opacity and blend mode of its topmost visible
their place relative to the Characters row, and the label's object opacity and blend mode. They store them even when the
label already showed them, but an edit of a hidden row that leaves the topmost visible rows as they were stores nothing. `transparency.set` without an `item`, `object.setProps` with an opacity or blend mode, and
an `appearance.copyFrom` (Eyedropper) pick of transparency store only the label's object opacity and blend mode;
`appearance.copyFrom` with `append` stores the rows. When the graph is drawn again, every label of that kind gets what
is stored, with a placed gradient fitted to each label, and the graph saves it as `valuesRows`, `categoriesRows` and
`legendRows` in its label styles. Rows below the topmost one of each kind, a row's effects, other stroke options (caps,
`appearance.copyFrom` with `append` stores the rows, and the object opacity and blend mode only when it also applies
the object's transparency. `graphicStyle.apply` with `add` stores the rows and leaves the object opacity and blend
mode the kind keeps. When the graph is drawn again, every label of that kind gets what is stored, with a placed
gradient fitted to each label, and the graph saves it as `valuesRows`, `categoriesRows` and `legendRows` in its label styles. Rows below the topmost one of each kind, a row's effects, other stroke options (caps,
joins, dashes) and effects applied with `effect.*` are not stored. When labels of one kind are edited together, the
last one in the order of the targets (`ids` as given, otherwise paint order) sets what the kind keeps.
`appearance.copyFrom` onto the whole text of a label also stores the character attributes it applies and, from type,
@@ -925,12 +927,17 @@ opacity and blend mode. `paint.setFill`, `paint.setStroke` and the recolor comma
graph, its Axes group or a group that holds the graph, so the lines keep the paint those commands give a whole graph.
The other commands store them when given the line itself, and the `appearance.*` and graphic style commands and
`transparency.set` with an `item` also when given the Axes group, as described above. `transparency.set` without an
`item` and `object.setProps` store only the object opacity and blend mode. `appearance.copyFrom` stores the rows when it
picks up a paint, a stroke weight or a row's opacity and blend mode, or adds rows with `append`; any other pick stores
only the object opacity and blend mode, when it picks them up. The recolor commands and `paint.swap` store a line's rows when they change them. The
other commands store them even when the line already showed them, except that rows equal to a kind's default stroke
(0.5 pt black for axis lines and tick marks, 0.25 pt gray for rings) are not saved, and an edit of a hidden row that
leaves the topmost visible rows as they were stores nothing. When one command reaches several lines of one kind, the frontmost line in
`item` and `object.setProps` store only the object opacity and blend mode. `appearance.clear`, `appearance.transfer`,
`graphicStyle.apply`, `graphicStyle.redefine`, and `appearance.copyFrom` with every attribute picked up and applied or
with `append`, store a line's rows even when the line already showed them. The other commands, an `appearance.copyFrom`
of some attributes included, store only what they change on a line's rows; the kind keeps its other attributes, also
when the line still shows different ones until the graph is drawn again. An `appearance.copyFrom` that does not apply
the object's transparency, and `graphicStyle.apply` with `add`, leave the object opacity and blend mode a kind keeps as
they are, also when the line still shows other ones. `paint.default` stores the default fill and stroke rows for a
line's kind even when the line already showed them, and leaves the object opacity and blend mode the kind keeps. Rows
equal to a kind's default stroke (0.5 pt black for axis lines and tick marks, 0.25 pt gray for rings) are not saved, and
an edit of a hidden row that leaves the topmost visible rows as they were stores nothing. When one command reaches
several lines of one kind, the frontmost line in
paint order sets what the kind keeps, whatever order the `ids` are in. A gradient is stored without its placement, and
each line fits it when the graph is drawn again. The graph saves the rows as `axisRows` and `ringRows` in its label
styles. Other stroke options (caps, joins, miter limit, alignment, dashes and arrowheads), rows below the topmost one of