mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-16 08:32:52 +00:00
A fill or stroke row that the Appearance commands gave a graph label, its object opacity, and the characters the Eyedropper gave it lasted only until the graph was drawn again: the graph stored nothing for a label's rows, and the Eyedropper's character attributes were not stored. - The graph keeps, for value axis numbers, category labels and legend labels, the paint, weight, opacity and blend mode of a label's topmost visible fill and stroke row, their order and place relative to the Characters row, and the label's object opacity and blend mode (labelStyles valuesRows, categoriesRows, legendRows). Every label of the kind gets those rows when the graph is drawn again, with a placed gradient fitted to each label. - Every appearance.* command stores them, and so do graphicStyle.apply and redefine and the paint, stroke, gradient and transparency edits aimed at a row, even when the label already showed them. transparency.set without a row and object.setProps store only the object opacity and blend mode. With several labels of a kind, the last one edited wins. - appearance.copyFrom onto all of a label's text stores the character attributes it applied and, from type, the paragraph attributes; a transparency pick stores the object opacity and blend mode, and append stores the rows. - paint.setFill and paint.setStroke store a character fill or stroke only when the characters take the paint (the whole label, or all of its text highlighted with the Type tool); aimed at a row, they store the row. - Document Color Mode and swatch edits reach the kept rows. Docs: docs/mcp.md, the commands' params text, docs/target-app-parity.md.
55 lines
1.9 KiB
Rust
55 lines
1.9 KiB
Rust
//! Graphs: the nine graph tools and Object → Graph (Type…, Data…).
|
|
//!
|
|
//! A graph is a group carrying a [`GraphSpec`]; its children (axes, labels, one group per series
|
|
//! with that series' legend swatch, like Illustrator's group-selectable series) are generated from
|
|
//! the spec. Editing the data or the type regenerates them in place, keeping any move/scale the
|
|
//! user applied to the graph since it was generated.
|
|
|
|
use std::collections::HashMap;
|
|
use std::sync::Arc;
|
|
|
|
use serde_json::{Value, json};
|
|
use vectorcraft_color::{Color, Paint};
|
|
use vectorcraft_doc::{
|
|
Appearance, CharStyle, ColumnDesign, ColumnType, Document, Fractions, GraphDesign, GraphKind, GraphSpec, Justify, Node, NodeId, NodeKind,
|
|
TextObject, TickLength, ValueAxisSide,
|
|
};
|
|
use vectorcraft_geom::{Affine, BezPath, FillRule, PathData, Point, Rect, shapes};
|
|
|
|
use super::typecmd::refresh_bounds;
|
|
use super::{
|
|
CommandSpec, EngineError, Result, Session, bad, cmd, f64_req, has_doc, has_selection, named_id, number_or, ok, str_param, switch_or, text_param,
|
|
};
|
|
|
|
mod axis;
|
|
mod columns;
|
|
mod commands;
|
|
mod data;
|
|
mod designs;
|
|
mod edit;
|
|
mod generate;
|
|
mod labels;
|
|
mod markers;
|
|
mod series;
|
|
|
|
#[cfg(test)]
|
|
use axis::{nice_axis, tick_values};
|
|
#[cfg(test)]
|
|
use columns::{fill_totals, total_text};
|
|
pub use commands::specs;
|
|
pub(crate) use data::apply_csv;
|
|
#[cfg(test)]
|
|
use data::{fmt_value, parse_csv, to_csv};
|
|
#[cfg(test)]
|
|
use generate::generate;
|
|
#[cfg(test)]
|
|
use series::default_series_color;
|
|
pub(crate) use series::{
|
|
LabelTextChange, capture_label_anti_alias, capture_label_object_opacity, capture_label_paragraphs, capture_label_rows, capture_label_styles,
|
|
capture_label_text, capture_series_object_opacity, capture_series_opacity, capture_series_top_paints, label_object_opacity_differs,
|
|
paint_targets, series_group_marks, series_group_marks_where, series_marks_in, series_object_opacity_differs, shown_paint,
|
|
};
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|