Merge pull request #7304 from dotCooCoo/fix/graph-series-object-opacity-other-commands

Graphs: Global Edit, Randomize Opacity and Sort Objects keep what they give a series
This commit is contained in:
BFlat
2026-11-14 06:26:22 +07:00
committed by GitHub
6 changed files with 171 additions and 8 deletions
+8 -2
View File
@@ -806,12 +806,18 @@ pub(super) fn capture_series_writes(
/// and objects the edit left as they were keep what the graph stores. When the edit changes several marks of one series,
/// the frontmost one sets what the graph stores, whatever order `ids` are in. Returns whether the stored paint changed.
pub(crate) fn capture_series_changes(before: &vectorcraft_doc::Document, d: &mut vectorcraft_doc::Document, ids: &[NodeId]) -> bool {
let marks = series_children_in_paint_order(d, ids);
!marks.is_empty() && capture_series_writes(before, d, &marks, (false, false), (false, false), false, false)
}
/// Each of `ids` directly in a series group, from the back to the front: a later mark's capture replaces an earlier
/// one's, so the frontmost one sets what the graph stores.
pub(crate) fn series_children_in_paint_order(d: &vectorcraft_doc::Document, ids: &[NodeId]) -> Vec<NodeId> {
// Only objects directly in a series group can be marks: other edits skip the search of the document for graphs.
let in_series = |id: &NodeId| d.parent_of(*id).and_then(|p| d.node(p)).is_some_and(|g| g.extras().series_index.is_some());
let mut marks: Vec<NodeId> = ids.iter().copied().filter(in_series).collect();
// A later mark's capture replaces an earlier one's: take them in paint order.
marks.sort_by_cached_key(|id| d.index_path(*id));
!marks.is_empty() && capture_series_writes(before, d, &marks, (false, false), (false, false), false, false)
marks
}
/// Store on the graph the paint that an edit of `ids` (from `before` to `d`) leaves on the topmost visible fill and stroke