mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 10:30:03 +00:00
Graphs: Default Fill and Stroke on an axis line stores the default rows for its kind
Default Fill and Stroke on an axis line, tick mark or radar ring that already shows the default paint now stores the default fill and stroke rows for every line of its kind, so a stroke the kind kept from another line no longer comes back when the graph is drawn again. The object opacity and blend mode the kind keeps stay as they are.
This commit is contained in:
@@ -6753,6 +6753,23 @@ fn default_fill_and_stroke_and_fill_to_stroke_on_an_axis_line_are_kept() {
|
||||
assert!(redrawn_line_looks(&mut s, id).iter().all(|l| l.0 == "#0000ff"), "the blue fill on the stroke");
|
||||
}
|
||||
|
||||
/// 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();
|
||||
|
||||
@@ -1020,7 +1020,10 @@ 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);
|
||||
let labels = super::graph::capture_label_changes(&before, d, &ids, false, None);
|
||||
Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept || labels))
|
||||
// The graph keeps the default fill and stroke rows for every line of a kind it reached, also when one already
|
||||
// showed them; the object opacity the kind keeps stays.
|
||||
let lines = super::graph::capture_line_fill_stroke_rows(d, &ids);
|
||||
Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept || labels || lines))
|
||||
})?;
|
||||
}
|
||||
super::newart::reset(s);
|
||||
|
||||
Reference in New Issue
Block a user