mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 11:05:03 +00:00
Swatch libraries: check the color names a pattern copy gives
When a library tint waits for a color that a pattern's art brings, swatch.library.add learns the color's name by importing the pattern into a copy of the document. The import into the document now confirms those names: when it gives a color another name, or none, the tints linked from the copy are linked again. - library.use and Add to Swatches report an error from the import that merges a pattern's colors instead of falling back to adding them. - The params text, docs/mcp.md and docs/target-app-parity.md say that a tint or gradient links to the numbered copy its global or spot color comes in under or already has, and name a gradient test. - The new code uses the HashMap import, and one helper relinks the added tints and gradients at both places that did it.
This commit is contained in:
@@ -194,9 +194,8 @@ pub(crate) fn probe_import(d: &Document, lib: &Document, name: &str, gathered: &
|
||||
let added = gathered.import_into(&mut with_add, &SwatchChoices::add_all(), false)?;
|
||||
if !reused(&added) && added.renamed.iter().any(|r| r["kind"] == "swatch") && has_candidate(d, lib, name) {
|
||||
let mut merged = d.clone();
|
||||
if let Ok(found) = gathered.import_into(&mut merged, &SwatchChoices::default(), false)
|
||||
&& reused(&found)
|
||||
{
|
||||
let found = gathered.import_into(&mut merged, &SwatchChoices::default(), false)?;
|
||||
if reused(&found) {
|
||||
return Ok((SwatchChoices::default(), merged, found));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user