Symbolism: the Sprayer's User Defined Style applies the style picked in Graphic Styles

A click in the Graphic Styles panel set the style only for the Symbol
Styler, so the Sprayer with Style: User Defined sent no style and sprayed
the document's first style after the default one. The two tools now share
the style option.
This commit is contained in:
dotCooCoo
2026-11-18 15:28:52 -08:00
parent 97a2b802a4
commit 83a1fbbcd8
3 changed files with 11 additions and 6 deletions
+3 -2
View File
@@ -44,8 +44,9 @@ const ROWS: &[Row] = &[
"affectsDensity",
],
),
// The graphic style the Symbol Styler applies, set from the Graphic Styles panel.
(&["symbolStyler"], None, &["style"]),
// The graphic style the Symbol Styler and the Symbol Sprayer's User Defined Style apply, set
// from the Graphic Styles panel.
(&["symbolSprayer", "symbolStyler"], Some("symbolismStyle"), &["style"]),
(&["mirrorCut"], None, &["axis", "keep"]),
(&["puppetWarp"], None, &["showMesh", "expand"]),
(&["arc"], None, &["closed", "lengthX", "lengthY", "reference", "baseAlong", "slope", "fillArc"]),
+6 -2
View File
@@ -3,7 +3,8 @@
//! shows the shape outlined in black and filled with white, under a red slash. Clicking a style applies it to the
//! selection (Alt-click adds it on top); Shift-click adds to the panel's selection every style from
//! the last one clicked without Shift through this one; Cmd/Ctrl-click adds or removes one. The
//! style last clicked into the selection is the one the Symbol Styler applies. Double-click opens
//! style last clicked into the selection is the one the Symbol Styler and the Symbol Sprayer's User
//! Defined Style apply. Double-click opens
//! Graphic Style Options. Dragging a style moves it in the list (dropped on
//! another style with Alt held, replaces that style with its look), applies it
//! to the art it is dropped on (`canvas::panel_drop`), or, dropped on New Graphic Style, adds a
@@ -553,7 +554,8 @@ fn act(app: &mut VectorcraftApp, ui: &Ui, s: &Shown, ev: Events, picker: bool) {
Some(Click::Pick(name, m)) => {
let order: Vec<&str> = s.d.graphic_styles.iter().map(|g| g.name.as_str()).collect();
let sel = super::swatches::click_selection(ui, "gs-anchor", selected(ui.ctx(), s.d), &order, &name, m);
// The style clicked into the selection is the one the Symbol Styler applies.
// The style clicked into the selection is the one the Symbol Styler and the Symbol
// Sprayer's User Defined Style apply (the two share it).
if sel.contains(&name) {
app.run("tool.setOption", json!({"tool": "symbolStyler", "values": {"style": name}})).ok();
}
@@ -1709,6 +1711,8 @@ mod tests {
assert_eq!(styler(&app).as_ref(), Some(&n[3]));
assert_eq!(click(&mut app, 2, egui::Modifiers::COMMAND), [n[0].clone(), n[1].clone(), n[3].clone(), n[2].clone()]);
assert_eq!(styler(&app).as_ref(), Some(&n[2]));
// The Symbol Sprayer's User Defined Style applies the same style.
assert_eq!(app.session.tool_options_of("symbolSprayer")["style"].as_str(), Some(n[2].as_str()));
// Shift-click extends from the style Cmd/Ctrl-clicked last.
click(&mut app, 0, egui::Modifiers::NONE);
click(&mut app, 2, egui::Modifiers::COMMAND);
+2 -2
View File
@@ -3787,8 +3787,8 @@ already walks Image Trace. Short agent entry points:
samples of a stroke add up (two samples at the center at intensity 5 apply it in full). With `alt`, `userDefined`
and `random` remove all of an instance's appearance items under the brush at once, whatever the brush's strength.
A `style` name the document
has no graphic style for counts as none (the document's first style after the default one). The Symbol Styler sends
the style last clicked into the Graphic Styles panel's selection. `tool.setOption` on a symbolism tool refuses a `method` or
has no graphic style for counts as none (the document's first style after the default one). The Symbol Styler and the
Symbol Sprayer (its User Defined Style) send the style last clicked into the Graphic Styles panel's selection. `tool.setOption` on a symbolism tool refuses a `method` or
Symbol Sprayer option that is not one of its names, a non-number `diameter`, `intensity` or `density`, a
`diameter` outside 2..2000 or an `intensity` or `density` outside 1..10, a non-boolean switch, and a `symbol` or
`style` that is neither a name nor null, and sets none of the values. The options dialog's OK checks the same way