Merge main into fix/rotate-reference-point-drag

This commit is contained in:
dotCooCoo committed 2026-12-05 20:06:03 -08:00
commit 8e5b6f86f0
41 files changed
+1615 -232

No files matched your search

Generated
+181 -92
View File
@@ -1256,7 +1256,7 @@ dependencies = [
[[package]]
name = "craft"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-automation",
"craft-behavior",
@@ -1298,7 +1298,7 @@ dependencies = [
[[package]]
name = "craft-affinity"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"crc32fast",
"flate2",
@@ -1319,7 +1319,7 @@ dependencies = [
[[package]]
name = "craft-appkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"block2 0.6.2",
"objc2 0.6.5",
@@ -1331,7 +1331,7 @@ dependencies = [
[[package]]
name = "craft-atomic"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"rustix 1.1.6",
]
@@ -1339,7 +1339,7 @@ dependencies = [
[[package]]
name = "craft-automation"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1364,7 +1364,7 @@ dependencies = [
[[package]]
name = "craft-behavior"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"accesskit",
"bitflags 2.13.2",
@@ -1383,7 +1383,7 @@ dependencies = [
[[package]]
name = "craft-browse"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-docpath",
@@ -1401,8 +1401,9 @@ dependencies = [
[[package]]
name = "craft-cdr"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-codepage",
"crc32fast",
"flate2",
]
@@ -1410,7 +1411,7 @@ dependencies = [
[[package]]
name = "craft-cloud-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"egui",
]
@@ -1418,7 +1419,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"md-5",
"rayon",
@@ -1427,12 +1428,12 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
[[package]]
name = "craft-color-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-cms",
@@ -1452,7 +1453,7 @@ dependencies = [
[[package]]
name = "craft-control"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-ai-agents",
"craft-atomic",
@@ -1468,7 +1469,7 @@ dependencies = [
[[package]]
name = "craft-control-protocol"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"getrandom 0.3.4",
"serde_json",
@@ -1478,7 +1479,7 @@ dependencies = [
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"rayon",
]
@@ -1486,7 +1487,7 @@ dependencies = [
[[package]]
name = "craft-dialogs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"block2 0.6.2",
"craft-appkit",
@@ -1512,7 +1513,7 @@ dependencies = [
[[package]]
name = "craft-doc"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"blake3",
"craft-ecproj-format",
@@ -1528,7 +1529,7 @@ dependencies = [
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"serde",
]
@@ -1536,7 +1537,7 @@ dependencies = [
[[package]]
name = "craft-draw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1555,7 +1556,7 @@ dependencies = [
[[package]]
name = "craft-dwg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"acadrust",
"craft-dxf",
@@ -1565,7 +1566,7 @@ dependencies = [
[[package]]
name = "craft-dxf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-codepage",
"encoding_rs",
@@ -1577,7 +1578,7 @@ dependencies = [
[[package]]
name = "craft-ecproj-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"serde",
"serde_json",
@@ -1587,12 +1588,12 @@ dependencies = [
[[package]]
name = "craft-eps"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
[[package]]
name = "craft-flags"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-atomic",
"dirs",
@@ -1602,7 +1603,7 @@ dependencies = [
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"fontique",
"harfrust 0.13.3",
@@ -1617,7 +1618,7 @@ dependencies = [
[[package]]
name = "craft-font-manager"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -1636,7 +1637,7 @@ dependencies = [
[[package]]
name = "craft-font-os-windows"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"windows-registry",
"windows-sys 0.61.2",
@@ -1645,7 +1646,7 @@ dependencies = [
[[package]]
name = "craft-font-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"cap-primitives",
"craft-atomic",
@@ -1668,12 +1669,12 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
[[package]]
name = "craft-gif"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"gif",
]
@@ -1681,7 +1682,7 @@ dependencies = [
[[package]]
name = "craft-gzip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"flate2",
]
@@ -1689,7 +1690,7 @@ dependencies = [
[[package]]
name = "craft-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"bitflags 2.13.2",
"craft-i18n",
@@ -1702,7 +1703,7 @@ dependencies = [
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"brotli 9.1.3",
"brotli-decompressor 6.3.2",
@@ -1732,7 +1733,7 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-dds",
"craft-jpeg",
@@ -1759,7 +1760,7 @@ dependencies = [
[[package]]
name = "craft-imaging"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1777,7 +1778,7 @@ dependencies = [
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"thiserror 2.0.21",
]
@@ -1785,7 +1786,7 @@ dependencies = [
[[package]]
name = "craft-jxl"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"brotli-decompressor 5.0.3",
"jixel",
@@ -1796,7 +1797,7 @@ dependencies = [
[[package]]
name = "craft-keymap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-host",
"craft-i18n",
@@ -1811,7 +1812,7 @@ dependencies = [
[[package]]
name = "craft-layers"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -1825,7 +1826,7 @@ dependencies = [
[[package]]
name = "craft-menu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1843,7 +1844,7 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"brotli-decompressor 6.3.2",
"chrono",
@@ -1855,7 +1856,7 @@ dependencies = [
[[package]]
name = "craft-metafile"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"encoding_rs",
"image",
@@ -1866,7 +1867,7 @@ dependencies = [
[[package]]
name = "craft-mime"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"chrono",
"craft-codepage",
@@ -1876,7 +1877,7 @@ dependencies = [
[[package]]
name = "craft-nightly"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"uds_windows",
"winsafe",
@@ -1885,7 +1886,7 @@ dependencies = [
[[package]]
name = "craft-pages"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -1901,7 +1902,7 @@ dependencies = [
[[package]]
name = "craft-pbr"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-texture",
"thiserror 2.0.21",
@@ -1910,7 +1911,7 @@ dependencies = [
[[package]]
name = "craft-pcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"flate2",
"serde",
@@ -1921,7 +1922,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"hayro-interpret",
"hayro-syntax",
@@ -1933,7 +1934,7 @@ dependencies = [
[[package]]
name = "craft-platform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"async-channel",
"async-io",
@@ -1947,6 +1948,7 @@ dependencies = [
"futures-lite",
"js-sys",
"log",
"notify",
"objc2-app-kit 0.3.2",
"objc2-core-foundation",
"objc2-core-graphics",
@@ -1966,7 +1968,7 @@ dependencies = [
[[package]]
name = "craft-plotter"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"kurbo 0.13.1",
"thiserror 2.0.21",
@@ -1975,7 +1977,7 @@ dependencies = [
[[package]]
name = "craft-print"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1999,7 +2001,7 @@ dependencies = [
[[package]]
name = "craft-proof"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"log",
"miniz_oxide 0.9.1",
@@ -2010,7 +2012,7 @@ dependencies = [
[[package]]
name = "craft-ps"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-eps",
"flate2",
@@ -2024,7 +2026,7 @@ dependencies = [
[[package]]
name = "craft-psd"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"encoding_rs",
"flate2",
@@ -2035,7 +2037,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"dispatch2",
"egui",
@@ -2048,7 +2050,7 @@ dependencies = [
[[package]]
name = "craft-raster3d"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"rayon",
"thiserror 2.0.21",
@@ -2057,7 +2059,7 @@ dependencies = [
[[package]]
name = "craft-review"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -2076,7 +2078,7 @@ dependencies = [
[[package]]
name = "craft-settings"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-atomic",
"craft-host",
@@ -2093,7 +2095,7 @@ dependencies = [
[[package]]
name = "craft-stream-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"fax",
"hayro-ccitt",
@@ -2104,7 +2106,7 @@ dependencies = [
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-image-codecs",
"craft-xml",
@@ -2125,7 +2127,7 @@ dependencies = [
[[package]]
name = "craft-table"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2137,7 +2139,7 @@ dependencies = [
[[package]]
name = "craft-text"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-font-manager",
@@ -2162,7 +2164,7 @@ dependencies = [
[[package]]
name = "craft-texture"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"thiserror 2.0.21",
]
@@ -2170,7 +2172,7 @@ dependencies = [
[[package]]
name = "craft-theme"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"bitflags 2.13.2",
"craft-tracked",
@@ -2185,7 +2187,7 @@ dependencies = [
[[package]]
name = "craft-theme-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-atomic",
"craft-behavior",
@@ -2200,7 +2202,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2210,7 +2212,7 @@ dependencies = [
[[package]]
name = "craft-time"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2219,7 +2221,7 @@ dependencies = [
[[package]]
name = "craft-timeline"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2234,12 +2236,12 @@ dependencies = [
[[package]]
name = "craft-tracked"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-cloud-ui",
"craft-ui-canvas",
@@ -2253,7 +2255,7 @@ dependencies = [
[[package]]
name = "craft-ui-canvas"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -2270,7 +2272,7 @@ dependencies = [
[[package]]
name = "craft-ui-contract"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"accesskit",
"craft-behavior",
@@ -2308,7 +2310,7 @@ dependencies = [
[[package]]
name = "craft-ui-macros"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -2319,7 +2321,7 @@ dependencies = [
[[package]]
name = "craft-ui-panels"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2337,7 +2339,7 @@ dependencies = [
[[package]]
name = "craft-ui-patterns"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2358,7 +2360,7 @@ dependencies = [
[[package]]
name = "craft-ui-shell"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2379,7 +2381,7 @@ dependencies = [
[[package]]
name = "craft-ui-widgets"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2393,12 +2395,13 @@ dependencies = [
"log",
"serde",
"smallvec",
"unicode-segmentation",
]
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -2430,7 +2433,7 @@ dependencies = [
[[package]]
name = "craft-vectorcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"flate2",
"serde",
@@ -2441,7 +2444,7 @@ dependencies = [
[[package]]
name = "craft-wayland"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"raw-window-handle",
"wayland-backend",
@@ -2451,7 +2454,7 @@ dependencies = [
[[package]]
name = "craft-web-api"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"js-sys",
"serde_json",
@@ -2462,7 +2465,7 @@ dependencies = [
[[package]]
name = "craft-win32"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"winsafe",
]
@@ -2470,7 +2473,7 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"craft-appkit",
"craft-atomic",
@@ -2502,7 +2505,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -3861,7 +3864,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
[[package]]
name = "hayro-cmap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"brotli 8.0.4",
"hayro-postscript",
@@ -3870,7 +3873,7 @@ dependencies = [
[[package]]
name = "hayro-interpret"
version = "0.7.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@ -3888,7 +3891,7 @@ dependencies = [
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@ -3906,12 +3909,12 @@ dependencies = [
[[package]]
name = "hayro-postscript"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"flate2",
"hayro-ccitt",
@@ -4473,6 +4476,26 @@ dependencies = [
"hashbrown 0.17.1",
]
[[package]]
name = "inotify"
version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cc00ea907cab49550b7da656f80ebb97be1b997d931fbcd28d39734e17ce592"
dependencies = [
"bitflags 2.13.2",
"inotify-sys",
"libc",
]
[[package]]
name = "inotify-sys"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d"
dependencies = [
"libc",
]
[[package]]
name = "inout"
version = "0.1.4"
@@ -4891,10 +4914,30 @@ dependencies = [
"accesskit_consumer",
]
[[package]]
name = "kqueue"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d763e5b24120b4ddf50de6c92308156765aabfbbccebf401da7cff2d70a41ea"
dependencies = [
"kqueue-sys",
"libc",
]
[[package]]
name = "kqueue-sys"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087"
dependencies = [
"bitflags 2.13.2",
"libc",
]
[[package]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"base64 0.22.1",
"bumpalo",
@@ -5051,7 +5094,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]]
name = "linesweeper"
version = "0.5.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"arrayvec",
"kurbo 0.13.1",
@@ -5193,6 +5236,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"
dependencies = [
"libc",
"log",
"wasi",
"windows-sys 0.61.2",
]
@@ -5358,6 +5402,35 @@ dependencies = [
"memchr",
]
[[package]]
name = "notify"
version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5482d5bd11b91a337521980e5d52fe115bdccfb4c217099daaf0abd69159dc4e"
dependencies = [
"bitflags 2.13.2",
"inotify",
"kqueue",
"libc",
"log",
"mio",
"notify-types",
"objc2-core-foundation",
"objc2-core-services",
"walkdir",
"windows-sys 0.61.2",
"xxhash-rust",
]
[[package]]
name = "notify-types"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd044e85df3d939d8e32a1c35a3b737c7d0a4eeb7acd737bd207644e00f4e5f"
dependencies = [
"bitflags 2.13.2",
]
[[package]]
name = "num"
version = "0.4.3"
@@ -5712,6 +5785,16 @@ dependencies = [
"objc2-core-video",
]
[[package]]
name = "objc2-core-services"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "583300ad934cba24ff5292aee751ecc070f7ca6b39a574cc21b7b5e588e06a0b"
dependencies = [
"libc",
"objc2-core-foundation",
]
[[package]]
name = "objc2-core-text"
version = "0.3.2"
@@ -7617,7 +7700,7 @@ dependencies = [
[[package]]
name = "skrifa"
version = "0.44.0"
source = "git+https://github.com/storytold/craft-libs?rev=f9e5cecc9cf1b701b22f6f24a88719b14456323e#f9e5cecc9cf1b701b22f6f24a88719b14456323e"
source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97"
dependencies = [
"bytemuck",
"read-fonts 0.41.0",
@@ -10577,6 +10660,12 @@ dependencies = [
"tempfile",
]
[[package]]
name = "xxhash-rust"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40de123dbb523ebcc00d61ec01840ad192578afc378d859f3429caa38308fad5"
[[package]]
name = "yeslogic-fontconfig-sys"
version = "6.0.1"
+43 -43
View File
@@ -10,62 +10,62 @@ license = "MIT OR Apache-2.0"
rust-version = "1.95"
[workspace.dependencies]
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e", default-features = false, features = ["interpret", "write"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", default-features = false, features = ["interpret", "write"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# Language packs: the Craft apps' shared font store installs them (#4936).
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON.
craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile.
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e", features = ["pcraft-pixels"] }
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", features = ["pcraft-pixels"] }
# Native Affinity documents (craft-libs#914).
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778).
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# SVG parsing, limits, SVGZ and writer (craft-libs#778).
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e", features = ["tree"] }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", features = ["tree"] }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# Digits typed in any script in numeric fields (`vectorcraft_doc::units`).
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# EPS container, previews, ASCII85 and DSC comments (craft-libs#778).
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# DXF tags, reader and writer (craft-libs#778, #926, #927).
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# DWG to DXF bytes, in a child process on desktop builds (acadrust 0.6.6, MPL-2.0, unmodified).
craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# The DWG reader and writer craft-dwg uses, at the rev craft-libs pins (its Cargo.toml). Tests only: it writes the
# R12, R13 and R14 DWG files that craft-dwg's writer, 2000 and later, does not.
acadrust = { git = "https://github.com/storytold/acadrust.git", rev = "468b9d8e317755209020d5d3f2f1c8a76210c47f" }
# WMF, EMF and EMF+ reader (craft-libs#778).
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e", default-features = false, features = ["read", "write"] }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", default-features = false, features = ["read", "write"] }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# The metallic-roughness BRDF and environment light the 3D effects' Roughness and Metallic shade with.
craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# The CPU rasterizer that draws a 3D effect's Render Settings › Rendered image: depth-buffered triangles, shadow maps.
craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names
# the members it imports.
craft = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui
# without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes.
craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# Nightly profile isolation, launch protocol, and security fence.
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# internal
vectorcraft-geom = { path = "crates/geom" }
vectorcraft-color = { path = "crates/color" }
@@ -205,15 +205,15 @@ lto = "thin"
codegen-units = 1
[patch.crates-io]
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
# skrifa 0.44 (epaint, glifo, usvg) with the automatic hinter's long blue-zone exit (craft-libs vendor/skrifa).
skrifa = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
skrifa = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
emath = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
+1 -1
View File
@@ -28,7 +28,7 @@ egui_extras = { workspace = true }
# `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback.
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] }
# The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft.
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e", version = "0.1.0" }
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", version = "0.1.0" }
wasm-bindgen = "0.2"
serde_json = { workspace = true }
+1
View File
@@ -597,6 +597,7 @@ impl<'a> Scene<'a> {
linetypes: self.linetypes,
styles: self.styles,
images: self.images,
blocks: Vec::new(),
entities: self.e.into_string(),
extents: self.extents.unwrap_or(limits),
limits,
+3 -3
View File
@@ -717,7 +717,6 @@ impl PixelFx {
PixelFx::Charcoal { thickness, detail, .. } => Some(sketch_ink::charcoal_reach(thickness, detail)),
PixelFx::Photocopy { detail, .. } => Some(sketch_ink::copy_reach(detail)),
PixelFx::Stamp { smoothness, .. } => Some(sketch_ink::stamp_reach(smoothness)),
PixelFx::GlowingEdges { width, smoothness, .. } => Some(width.max(smoothness * 3.0)),
// The cells around the pixel's, and the cells around theirs.
// (Without a usable grid there are no dots: see `pixelate::color_halftone`.)
PixelFx::ColorHalftone { max_radius, .. } => {
@@ -740,8 +739,9 @@ impl PixelFx {
PixelFx::WaterPaper { fiber_length, .. } => {
Some(sketch::water_paper_shift(fiber_length) + 3.0 * (0.06 * fiber_length.clamp(3.0, 50.0)).max(0.35))
}
// Cutout's palette and Torn Edges' peak-normalised edges come from the whole object.
PixelFx::Cutout { .. } | PixelFx::TornEdges { .. } => None,
// Cutout's palette and the peak-normalized edges of Torn Edges and Glowing Edges come
// from the whole object.
PixelFx::Cutout { .. } | PixelFx::TornEdges { .. } | PixelFx::GlowingEdges { .. } => None,
// The softened tones around the pixel.
PixelFx::NeonGlow { size, .. } => Some(3.0 * artistic::glow_spread(size)),
PixelFx::PlasticWrap { smoothness, .. } => Some(artistic::plastic_reach(smoothness)),
+2
View File
@@ -835,6 +835,7 @@ fn undo(s: &mut Session, _: &Value) -> Result<Value> {
let doc = std::mem::replace(&mut st.doc, e.doc);
keep_unrecorded(&doc, &e.unrecorded, &mut st.doc);
let selection = std::mem::replace(&mut st.selection, Arc::unwrap_or_clone(e.selection));
st.selections = st.selections.wrapping_add(1);
let selection = shared_selection(selection, st.history.redo.last());
let mut turned = crate::HistoryEntry::turned(e.label, doc, selection, &st.doc, costs);
turned.named = e.named;
@@ -873,6 +874,7 @@ fn redo(s: &mut Session, _: &Value) -> Result<Value> {
let doc = std::mem::replace(&mut st.doc, e.doc);
keep_unrecorded(&doc, &e.unrecorded, &mut st.doc);
let selection = std::mem::replace(&mut st.selection, Arc::unwrap_or_clone(e.selection));
st.selections = st.selections.wrapping_add(1);
let selection = shared_selection(selection, st.history.undo.last());
let mut turned = crate::HistoryEntry::turned(e.label, doc, selection, &st.doc, costs);
turned.named = e.named;
+2 -2
View File
@@ -425,8 +425,8 @@ fn copy_cost(objects: &[cd::Object]) -> usize {
match o {
cd::Object::Group { objects: kids, .. } => stack.extend(kids),
cd::Object::Shape(s) => n = n.saturating_add(shape_cost(s)),
// A bitmap is not placed, so it takes nothing past the object itself.
cd::Object::Image(_) => {}
// A bitmap or text is not placed, so it takes nothing past the object itself.
cd::Object::Image(_) | cd::Object::Text(_) => {}
cd::Object::Clip { container, objects } => {
// A container whose outline is behind its fill is built twice, as that outline
// and as the clipping path, inside a group of their own.
+11 -4
View File
@@ -74,8 +74,8 @@ impl Builder {
self.learn_spot(c);
}
}
// Bitmaps are not placed, so their colors add no swatch.
cd::Object::Image(_) => {}
// Bitmaps and text are not placed, so their colors add no swatch.
cd::Object::Image(_) | cd::Object::Text(_) => {}
cd::Object::Group { objects: kids, .. } => stack.extend(kids),
cd::Object::Clip { container, objects } => {
for c in container.fill.iter().chain(container.outline.iter().map(|o| &o.color)) {
@@ -125,8 +125,8 @@ impl Builder {
for o in objects.iter().rev() {
match o {
cd::Object::Shape(s) => out.extend(self.shape(s, to_doc, false).map(|n| with_flags(n, s.flags))),
// Bitmaps are left out, and the warnings name them with the other objects not read.
cd::Object::Image(_) => self.note(Warning::UnsupportedObjects),
// Bitmaps and text are left out, and the warnings name them with the other objects not read.
cd::Object::Image(_) | cd::Object::Text(_) => self.note(Warning::UnsupportedObjects),
cd::Object::Group { objects: kids, flags } => {
let children = self.objects_at(kids, to_doc, depth + 1);
if !children.is_empty() {
@@ -456,6 +456,7 @@ mod tests {
master: vec![],
guides: vec![],
warnings: vec![],
left_out: Default::default(),
};
let doc = Builder::new().document(&d);
let swatch = doc.swatches.iter().find(|s| s.name == "Red ink").unwrap();
@@ -498,6 +499,7 @@ mod tests {
master: vec![],
guides: vec![],
warnings: vec![],
left_out: Default::default(),
};
assert!(Document::new(612.0, 792.0).swatches.iter().any(|s| s.name == "Black" && !s.spot));
let doc = Builder::new().document(&d);
@@ -539,6 +541,7 @@ mod tests {
master: vec![master],
guides: vec![],
warnings: vec![],
left_out: Default::default(),
};
let mut b = Builder::new();
b.copies_left = 1000;
@@ -575,6 +578,7 @@ mod tests {
master: vec![master],
guides: vec![],
warnings: vec![],
left_out: Default::default(),
};
let mut b = Builder::new();
b.copies_left = 1000;
@@ -648,6 +652,7 @@ mod tests {
master: vec![],
guides: vec![cd::Guideline { at: cd::Pt { x: 0.0, y: 0.0 }, angle: 90.0, hidden }],
warnings: vec![],
left_out: Default::default(),
};
let doc = Builder::new().document(&d);
doc.layers
@@ -675,6 +680,7 @@ mod tests {
master: vec![],
guides: vec![cd::Guideline { at: cd::Pt { x: 0.0, y: 0.0 }, angle: 45.0, hidden: false }],
warnings: vec![],
left_out: Default::default(),
};
let mut b = Builder::new();
let doc = b.document(&d);
@@ -748,6 +754,7 @@ mod tests {
master: vec![],
guides: vec![],
warnings: vec![],
left_out: Default::default(),
};
let doc = Builder::new().document(&drawing(vec![vec![layer(cd::Flags::default(), objects)]]));
let kids = doc.layers[0].children().unwrap();
+9 -1
View File
@@ -103,7 +103,15 @@ pub(super) fn encode(doc: &Document, f: &super::Format, p: &Value, use_artboards
.collect();
pages.push(cd::Page { size: Some((r.width().abs(), r.height().abs())), layers });
}
let drawing = cd::Drawing { version: 0, page_size: None, pages, master: Vec::new(), guides: Vec::new(), warnings: Vec::new() };
let drawing = cd::Drawing {
version: 0,
page_size: None,
pages,
master: Vec::new(),
guides: Vec::new(),
warnings: Vec::new(),
left_out: Default::default(),
};
// The limits `document.open` reads `.cmx` files with, so the file opens whole again.
let written = craft_cdr::write_cmx(&drawing, Limits::default()).map_err(|e| bad(C, e.to_string()))?;
for (set, w) in [
+2
View File
@@ -461,6 +461,7 @@ pub(super) fn exit_isolation(s: &mut Session, p: &Value) -> Result<Value> {
crate::cmd::distortcmds::finish_edit_text(st, inner);
st.isolation = Some(layer);
st.selection.set([left]);
st.selections = st.selections.wrapping_add(1);
st.revision += 1;
return ok();
}
@@ -498,6 +499,7 @@ pub(super) fn exit_isolation(s: &mut Session, p: &Value) -> Result<Value> {
crate::cmd::distortcmds::finish_edit_text(st, i);
let target = st.doc.parent_of(left).filter(|p| st.doc.node(*p).is_some_and(|n| n.extras().shaper.is_some())).unwrap_or(left);
st.selection.set([target]);
st.selections = st.selections.wrapping_add(1);
// A guide path isolated while Lock Guides is on isn't selected (#1534).
crate::deselect_hidden(&menu, &st.doc, &mut st.selection);
// The art on a locked artboard can't be selected.
+4
View File
@@ -51,6 +51,9 @@ pub struct DocState {
/// Increments on every change (also selection and view-only changes); UIs re-render when it
/// moves. Not a dirty flag: see [`DocState::is_dirty`].
pub revision: u64,
/// Increments each time the selection is set through [`crate::Session::select`] and the other
/// selection entries, even when it ends as it was. Not saved, not undoable.
pub selections: u64,
/// The document as last saved (or opened). Structural sharing makes "unchanged" a pointer
/// comparison, and undoing back to the saved state counts as clean.
pub(crate) saved_doc: Arc<Document>,
@@ -544,6 +547,7 @@ impl DocState {
history: History { limit: 500, ..Default::default() },
path,
revision: 1,
selections: 0,
active_layer,
layer_rows: vec![],
layers_reveal: None,
+2
View File
@@ -108,6 +108,8 @@ pub struct Session {
/// ([`Session::painting_tool`]); None for a stop of the selection's paint. A pick armed for
/// such a stop samples only into a stop selected on that gradient, and otherwise ends.
pub(crate) stop_pick: Option<cmd::gradient::StopOwner>,
/// The point and document revision the Eyedropper was armed for.
freeform_point_pick: Option<tooling::FreeformPointPick>,
/// Pointer and key input that came while the tool computed an edit on another thread, each with
/// its number and view, made in order once the edit is applied.
held_input: std::collections::VecDeque<(u64, tooling::HeldInput, ViewInfo)>,
+1
View File
@@ -64,6 +64,7 @@ impl Session {
lender: None,
back_to_painter: None,
stop_pick: None,
freeform_point_pick: None,
held_input: Default::default(),
input_count: 0,
edit_started_by: None,
+58 -1
View File
@@ -252,8 +252,64 @@ impl Session {
fn select_unwatched(&mut self, f: impl FnOnce(&Document, &mut Selection)) -> Result<()> {
self.active_appearance_item = None;
let uid = self.doc()?.uid;
self.select_document_unwatched(uid, f)
}
/// Change the selection in an open document without switching the active document.
pub fn select_in_document(&mut self, uid: u64, f: impl FnOnce(&Document, &mut Selection)) -> Result<()> {
if self.active().is_some_and(|st| st.uid == uid) {
return self.select(f);
}
self.select_document_unwatched(uid, f)
}
/// Give document `uid` back a selection it had, new art included, through the selection
/// filters as they are now: guides locked since, hidden or locked slices and art on a locked
/// artboard that is not new art are left out. In the active document, outside a command and an
/// interaction, the journal records the selection that comes back, with the current layer kept,
/// in the open undo groups too, and the paints for new art load from it as `select.set` loads
/// them (with New Art Has Basic Appearance on, a symbol part or an Objects on Path member does
/// not load its paints, as `symbol.instance.selectPart` and
/// `object.objectsOnPath.selectMember` do not), so a recorded action replays as it ran.
pub fn restore_selection(&mut self, uid: u64, selection: Selection) -> Result<()> {
let active = self.active().is_some_and(|st| st.uid == uid && st.interaction.is_none()) && self.depth == 0;
let st = self.document_mut(uid).ok_or(EngineError::NoDocument)?;
let (made, layer) = (st.selection.clone(), st.active_layer);
st.selection_record = None;
st.selection = selection;
self.select_in_document(uid, |_, _| {})?;
if !active {
return Ok(());
}
let Some(st) = self.document_mut(uid) else { return Ok(()) };
if st.selection == made {
return Ok(());
}
let steps = selection_steps(&st.selection, &made, &st.doc, layer, &st.highlighted_rows());
// Only the selection commands load paints on replay: a symbol part comes back through
// `symbol.instance.selectPart` and an Objects on Path member through
// `object.objectsOnPath.selectMember`, which load none.
let loads = steps.iter().any(|(id, _)| id.starts_with("select.") || id == "layer.target");
let (from, grouped) = (self.journal.len(), self.undo_group_docs());
for step in steps {
self.journal.push(step);
}
self.journal_in_undo_groups(Some(uid), &grouped, from);
// As `Session::execute` does after a selection command, which starts without the marker
// of a defaults-only paint that ran before it.
self.defaults_only_ran = None;
self.inherit_new_art();
if loads {
self.load_selection_paints();
}
Ok(())
}
/// Apply the selection filters and update the editing state of document `uid`.
fn select_document_unwatched(&mut self, uid: u64, f: impl FnOnce(&Document, &mut Selection)) -> Result<()> {
let menu = self.menu.clone();
let st = self.doc_mut()?;
let st = self.document_mut(uid).ok_or(EngineError::NoDocument)?;
let before = st.selection.objects.clone();
let new_art = st.selection.new_art.clone();
let record = if st.selection_record().is_some() { st.selection_record.take() } else { None };
@@ -294,6 +350,7 @@ impl Session {
st.layer_rows.clear();
}
st.revision += 1;
st.selections = st.selections.wrapping_add(1);
// Puppet Warp pins belong to the art they were placed on: another selection starts afresh.
if st.doc.puppet.as_ref().is_some_and(|p| p.ids != st.selection.objects) {
cmd::distortcmds::drop_puppet_pins(st);
+26 -3
View File
@@ -24,6 +24,16 @@ fn with_settled_warnings(mut r: Value, settled: &[String]) -> Value {
r
}
/// What [`Session::execute`] compares to tell that a command changed the selection: the counts of
/// what is selected and the first and last object, guide and slice, read in constant time.
type SelectionSummary = ([usize; 5], [Option<NodeId>; 6], bool);
fn selection_summary(s: &Selection) -> SelectionSummary {
let counts = [s.objects.len(), s.anchors.len(), s.segments.len(), s.guides.len(), s.slices.len()];
let ends = [s.objects.first(), s.objects.last(), s.guides.first(), s.guides.last(), s.slices.first(), s.slices.last()].map(|id| id.copied());
(counts, ends, s.symbol_part.is_some())
}
impl Session {
/// Run a command callback and keep warnings from every preview it settles or restores.
pub(crate) fn command_with_settled_warnings(&mut self, f: impl FnOnce(&mut Self) -> Result<Value>) -> Result<Value> {
@@ -72,7 +82,19 @@ impl Session {
if self.plugins_loading() && crate::waits_for_plugin_loads(id) {
self.finish_plugin_loads();
}
self.revealing(|s| s.execute_unwatched(id, params))
// A command, a step of a batch included, that leaves the active document with another
// selection counts as a selection change ([`crate::DocState::selections`]), whichever way
// it wrote the selection. The selections are compared by a summary that takes constant time.
let before = self.active().map(|st| (st.uid, st.selections, selection_summary(&st.selection)));
let r = self.revealing(|s| s.execute_unwatched(id, params));
if let Some((uid, selections, summary)) = before
&& let Some(st) = self.document_mut(uid)
&& st.selections == selections
&& selection_summary(&st.selection) != summary
{
st.selections = st.selections.wrapping_add(1);
}
r
}
/// Run `f`, a top-level entry that changes the active document's rows, current layer or
@@ -230,7 +252,7 @@ impl Session {
params.get("ids").filter(|v| !v.is_null()).cloned().or_else(|| given.map(|ids| ids.iter().map(|i| i.0).collect::<Vec<_>>().into()))
})
.flatten();
let selected_before = select_first.as_ref().and(self.active()).map(|d| (d.uid, d.selection.clone(), d.active_layer));
let selected_before = select_first.as_ref().and(self.active()).map(|d| (d.uid, d.selection.clone(), d.active_layer, d.selections));
// Only a selection command that changes the selection loads its paints for new art: other
// commands, and clicking what is already selected, keep a sampled paint in the proxies.
let selection_was = (id.starts_with("select.") || id == "layer.target").then(|| self.active().map(|d| d.selection.clone())).flatten();
@@ -240,11 +262,12 @@ impl Session {
}
let r = cmd::run_spec(s, spec, run_params);
if r.is_err()
&& let Some((uid, selection, layer)) = selected_before
&& let Some((uid, selection, layer, selections)) = selected_before
&& let Some(st) = s.docs.iter_mut().find(|d| d.uid == uid)
{
st.selection = selection;
st.active_layer = layer;
st.selections = selections;
st.revision += 1;
}
r
+2
View File
@@ -118,6 +118,7 @@ impl Session {
}
let undone = std::mem::replace(&mut st.doc, e.doc);
st.selection = Arc::unwrap_or_clone(e.selection);
st.selections = st.selections.wrapping_add(1);
deselect_hidden(&self.menu, &st.doc, &mut st.selection);
st.restore_isolation(g.isolation, &undone);
st.sync_new_art();
@@ -276,6 +277,7 @@ impl Session {
}
let undone = std::mem::replace(&mut st.doc, doc);
st.selection = selection;
st.selections = st.selections.wrapping_add(1);
st.restore_isolation(scope.isolation, &undone);
cmd::globaledit::follow_history(st);
st.drop_stale_variables_highlight();
@@ -875,3 +875,30 @@ fn objects_moved_out_together_in_the_layers_panel_all_leave_the_path() {
let (layer, at) = place_of(&s, g);
assert_eq!((place_of(&s, left), place_of(&s, middle)), ((layer, at + 1), (layer, at + 2)), "above the group, in their order");
}
/// A restored Objects on Path member keeps the paints for new art as they are, as the journal
/// entry that records it (`object.objectsOnPath.selectMember`) does when it is replayed.
#[test]
fn a_restored_member_leaves_the_same_paints_live_and_on_replay() {
let mut s = session();
let (g, [a, b, c], _) = three_on_a_line(&mut s);
s.execute("paint.setFill", &json!({"ids": [a.0, b.0, c.0, g.0], "color": "#ff0000"})).unwrap();
s.execute("object.objectsOnPath.selectMember", &json!({"member": b.0})).unwrap();
let saved = s.doc().unwrap().selection.clone();
let blue = rect(&mut s, 400.0, 0.0, 10.0, 10.0);
s.execute("paint.setFill", &json!({"ids": [blue.0], "color": "#0000ff"})).unwrap();
select(&mut s, &[blue]);
let before = s.paint.clone();
let (uid, from) = (s.doc().unwrap().uid, s.journal.len());
s.restore_selection(uid, saved.clone()).unwrap();
assert_eq!(s.doc().unwrap().selection, saved);
assert_eq!(s.paint, before, "selecting a member keeps the paints for new art");
let steps = s.journal.since(from).to_vec();
assert_eq!(steps.iter().map(|(c, _)| c.as_str()).collect::<Vec<_>>(), ["object.objectsOnPath.selectMember"]);
select(&mut s, &[blue]);
for (cmd, p) in steps {
s.execute(&cmd, &p).unwrap();
}
assert_eq!(s.doc().unwrap().selection, saved);
assert_eq!(s.paint, before, "the replay leaves the same paints");
}
+35 -3
View File
@@ -10,6 +10,11 @@ use vectorcraft_tools::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind
use crate::{EngineError, Prefs, Result, Session};
pub(crate) struct FreeformPointPick {
document: (u64, u64, u64),
index: usize,
}
/// What a hover's lend decision holds for ([`Session::hover_tool_at`]).
#[derive(Clone, Copy, PartialEq)]
pub(crate) struct HoverKey {
@@ -229,6 +234,7 @@ impl Session {
self.tool = self.make_tool(id);
// A pick is armed for a stop after its tool is chosen (`note_stop_pick`).
self.stop_pick = None;
self.freeform_point_pick = None;
if let Some(selection) = text_selection {
self.tool.set_option("textSelection", &selection);
}
@@ -633,7 +639,7 @@ impl Session {
appearance_item: self.appearance_item(),
constrain_angle: self.prefs.constrain_angle,
keyboard_increment: self.prefs.keyboard_increment,
freeform_point: self.selected_freeform_point(),
freeform_point: if self.tool.id() == "eyedropper" { self.pick_freeform_point() } else { self.selected_freeform_point() },
raster_sample: self.prefs.eyedropper.sample_size,
preview_bounds: self.prefs.use_preview_bounds,
scale_strokes: self.prefs.scale_strokes,
@@ -1637,6 +1643,9 @@ impl Session {
let sets_pressed = self.press_taken_by(self.tool.id());
self.tool.set_option(key, v);
self.note_stop_pick(key, self.tool.id() == "eyedropper");
if key == "freeformPoint" && self.tool.id() == "eyedropper" {
self.note_freeform_point_pick(v);
}
self.tool_set_since_reset = true;
self.keep_tool_settings();
self.keep_press_set(before_press, |k| sets_pressed && k == key, sets_pressed);
@@ -1733,9 +1742,14 @@ impl Session {
};
self.keep_press_set(before_press, |k| values.contains_key(k) && (sets_pressed || shared.contains(&k)), sets_pressed);
// The Eyedropper waiting for a Cmd-drag it lent a selection tool to is armed as the active one.
if (active || lender) && values.contains_key("stop") {
if active || lender {
let eyedropper = id.unwrap_or(self.tool.id()) == "eyedropper";
self.note_stop_pick("stop", eyedropper);
if values.contains_key("stop") {
self.note_stop_pick("stop", eyedropper);
}
if eyedropper && let Some(v) = values.get("freeformPoint") {
self.note_freeform_point_pick(v);
}
}
out
}
@@ -1761,6 +1775,24 @@ impl Session {
}
}
fn note_freeform_point_pick(&mut self, option: &Value) {
self.freeform_point_pick = None;
if option.is_string()
&& let Some(doc) = self.active()
&& let Some(index) = self.selected_freeform_point()
&& self.proxy_freeform(!self.fill_active).is_some_and(|(f, _)| index < f.points.len())
{
self.freeform_point_pick = Some(FreeformPointPick { document: (doc.uid, doc.revision, doc.reverts), index });
}
}
/// An index can outlive its point after a deletion or another paint is applied.
fn pick_freeform_point(&self) -> Option<usize> {
let pick = self.freeform_point_pick.as_ref()?;
let doc = self.active()?;
self.selected_freeform_point().filter(|&index| index == pick.index && pick.document == (doc.uid, doc.revision, doc.reverts))
}
/// The tool that took the press under way: the active tool, or the tool that lent a selection
/// tool for it (a Cmd-drag), which the dropped press gives its options back to.
fn pressed_tool(&self) -> Option<&dyn Tool> {
+2 -2
View File
@@ -181,7 +181,7 @@
//! (gradients that dither are written without dither's noise, Perceptual gradients and gradients
//! mixed around the hue wheel as the stops on their curve in process colors, at most 256, and
//! gradient stops linked to global process colors as their colors), pattern fills whose tiles aren't a grid, whose art reaches past
//! the tile or is painted with patterns, and pattern fills in symbols, as their tiles cut
//! the tile or is painted with patterns, and pattern fills in large-canvas symbols, as their tiles cut
//! to the shape, clipping groups and clipping layers whose clipping object isn't a path,
//! and the clipping groups inside them, as their art cut to that object (its fill cut too, its
//! stroke not; an image in a clipping group of the region it is cut to), images that can't be
@@ -225,7 +225,7 @@ use vectorcraft_pdf::PrivateData;
use crate::ps;
mod writer;
pub(crate) use writer::{DYNAMIC_KEY, OVERRIDES_KEY, hex_decode};
pub(crate) use writer::{DYNAMIC_KEY, OVERRIDES_KEY, PATTERN_SPACE_KEY, hex_decode};
use writer::Writer;
+171 -6
View File
@@ -6682,12 +6682,12 @@ fn instances_the_data_cant_hold_are_written_as_their_art() {
}
/// Symbols whose art paints with a pattern, directly, through a nested symbol, in an opacity mask
/// and through an inline graphic: their definitions hold the pattern fills as tiles cut to the shape (the reader keeps no
/// symbol whose art paints with a pattern), and their instances are written as their art, whose
/// and through an inline graphic: their definitions retain native pattern resources, and their
/// instances are written as their art, whose
/// pattern fills keep the document's placement as the canvas draws them, each with a warning. An
/// instance of a symbol without pattern paint stays an instance.
#[test]
fn symbols_with_pattern_fills_are_defined_with_tiles_and_placed_as_art() {
fn symbols_with_pattern_fills_keep_resources_and_place_as_art() {
let mut doc = Document::new(200.0, 100.0);
// Tiles that cover the shape, so its tiles cut to it draw its box.
let dot = Arc::new(square(&mut doc, Rect::new(0.0, 0.0, 8.0, 8.0), Color::BLACK));
@@ -6722,12 +6722,17 @@ fn symbols_with_pattern_fills_are_defined_with_tiles_and_placed_as_art() {
let filled = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(150.0, 10.0, 182.0, 42.0)), fill());
doc.insert(Some(layer), usize::MAX, filled).unwrap();
let out = export_ai_editing(&doc, &opts()).unwrap();
assert!(out.warnings.iter().any(|w| w == writer::SYMBOL_ART) && out.warnings.iter().any(|w| w == writer::PATTERNS), "{:?}", out.warnings);
assert!(out.warnings.iter().any(|w| w == writer::SYMBOL_ART), "{:?}", out.warnings);
assert!(!out.warnings.iter().any(|w| w == writer::PATTERNS), "grid resources must not become tiles: {:?}", out.warnings);
let back = read_back(&doc);
let names: Vec<&str> = back.symbols.iter().map(|s| s.name.as_str()).collect();
assert_eq!(names, ["Patch", "Outer", "Masked", "Plain", "Typed"]);
let patch = &back.symbols[0].art;
assert!(matches!(patch.kind, NodeKind::Group { .. }), "the symbol's art is its tiles: {:?}", patch.kind);
assert!(
matches!(patch.kind, NodeKind::Path { .. }) && vectorcraft_doc::pattern::uses_pattern(patch, Some("Dots")),
"the symbol must retain its original pattern-filled path: {:?}",
patch.kind
);
assert_eq!(instances(&back.symbols[1].art), 0, "the nested instance is its art");
let kids = back.layers[0].children().unwrap();
let kinds: Vec<bool> = kids.iter().map(|n| matches!(n.kind, NodeKind::SymbolInstance { .. })).collect();
@@ -6757,8 +6762,164 @@ fn symbols_with_pattern_fills_are_defined_with_tiles_and_placed_as_art() {
same_lines(&boxes(&back), &boxes(&doc));
}
/// Original ruled tile shared by symbol art and an ordinary canvas object. The symbol's pattern
/// and geometry are scaled together, as editing its art with Transform Pattern Tiles does.
fn ruled_pattern_symbol(strokes: bool, tile_type: vectorcraft_doc::TileType, extent: f64) -> Document {
let mut doc = Document::new(240.0, 140.0);
let line =
Node::path(doc.alloc_id(), shapes::line((1.0, 5.0).into(), (9.0, 5.0).into()), Appearance::basic(Paint::None, solid(Color::BLACK), 2.0));
let mut tile = vectorcraft_doc::PatternDef::new("Rules", vec![Arc::new(line)]);
tile.tile = Rect::new(0.0, 0.0, 10.0, 10.0);
tile.tile_type = tile_type;
doc.patterns.push(tile);
let fill = || Appearance::basic(Paint::Pattern { pattern: "Rules".into(), xf: Affine::IDENTITY }, Paint::None, 0.0);
let mut art = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(0.0, 0.0, extent, extent)), fill());
art.transform(Affine::scale(0.2), vectorcraft_doc::Scaling { strokes, patterns: true, ..Default::default() });
doc.symbols.push(Symbol { name: "Scaled".into(), art: Arc::new(art), dynamic: false });
let layer = doc.layers[0].id;
let one = instance(&mut doc, "Scaled", Affine::translate((20.0, 20.0)));
doc.insert(Some(layer), usize::MAX, one).unwrap();
let shared = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(125.0, 5.0, 225.0, 105.0)), fill());
doc.insert(Some(layer), usize::MAX, shared).unwrap();
doc
}
#[test]
fn scaled_pattern_symbol_keeps_native_pattern_resources_in_editing_data() {
let small = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 100.0);
let large = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 200.0);
let (a, b) = (program(&small), program(&large));
eprintln!("pattern symbol editing bytes: {} -> {} for four times the tile area", a.len(), b.len());
let back = read_back(&small);
let art = &back.symbols.iter().find(|s| s.name == "Scaled").unwrap().art;
assert!(vectorcraft_doc::pattern::uses_pattern(art, Some("Rules")), "the symbol must retain pattern paint rather than one object per tile");
assert_eq!(a.matches("%AI3_BeginPattern: (Rules)").count(), 1);
assert!(b.len() < a.len() * 2, "editing data must not grow with every covered tile: {} -> {}", a.len(), b.len());
let tile = back.pattern("Rules").unwrap();
assert_eq!(tile.tile, small.patterns[0].tile);
assert_eq!(tile.art[0].geometric_bounds().unwrap().width(), 8.0);
let strokes: Vec<_> =
tile.art[0].appearance.items.iter().filter_map(|i| if let AppearanceItem::Stroke(stroke) = i { Some(stroke.width) } else { None }).collect();
assert_eq!(strokes, [2.0], "the shared tile keeps its original stroke");
}
// Four editing-stream round trips and native raster probes cover the flag and fallback cases.
#[test]
fn scaled_pattern_symbol_new_instances_match_native_tile_stroke_weight() {
for strokes in [true, false] {
for tile_type in [vectorcraft_doc::TileType::Grid, vectorcraft_doc::TileType::BrickByRow { offset: 0.5 }] {
let doc = ruled_pattern_symbol(strokes, tile_type, 100.0);
// Native rendering scales a 2pt pattern stroke to 0.4pt with its pattern affine,
// under either flag. The flag controls the selected object's own stroke separately.
let native = vectorcraft_testkit::raster::render_region(&doc, Rect::new(20.0, 20.0, 22.0, 22.0), 20.0);
let native_weight = (0..native.height).filter(|y| native.pixel(20, *y)[0] < 64).count();
assert!((6..=10).contains(&native_weight), "native weight={native_weight}, strokes={strokes}, {tile_type:?}");
let mut back = read_back(&doc);
// Place afresh from the editing stream's symbol definition, rather than measuring
// the already-expanded canvas instance or the file's native payload.
back.layers.clear();
let layer = back.add_layer(Some("New instance"));
let one = instance(&mut back, "Scaled", Affine::translate((20.0, 20.0)));
back.insert(Some(layer), usize::MAX, one).unwrap();
let placed = vectorcraft_testkit::raster::render_region(&back, Rect::new(20.0, 20.0, 22.0, 22.0), 20.0);
let weight = (0..placed.height).filter(|y| placed.pixel(20, *y)[0] < 64).count();
assert!((6..=10).contains(&weight), "editing symbol weight={weight}, native={native_weight}, strokes={strokes}, {tile_type:?}");
}
}
}
// Each case goes through the real editing stream and renderer: the mask stroke has to be
// transformed as geometry even when writing its dictionary temporarily clears the tile clip.
#[test]
fn pattern_tile_fallback_preserves_affine_mask_stroke_weight() {
for matrix in
[Affine::scale(0.2), Affine::scale_non_uniform(0.2, 0.4), Affine::new([0.2, 0.0, 0.1, 0.2, 0.0, 0.0]), Affine::scale_non_uniform(-0.2, 0.2)]
{
let mut doc = ruled_pattern_symbol(true, vectorcraft_doc::TileType::BrickByRow { offset: 0.5 }, 100.0);
let white_line =
Node::path(doc.alloc_id(), shapes::line((1.0, 5.0).into(), (9.0, 5.0).into()), Appearance::basic(Paint::None, solid(Color::WHITE), 2.0));
let mut tile = square(&mut doc, Rect::new(0.0, 0.0, 10.0, 10.0), Color::BLACK);
tile.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(white_line), clip: true, invert: false, disabled: false, linked: true }));
doc.patterns[0].art = vec![Arc::new(tile)];
Arc::make_mut(&mut doc.symbols[0].art)
.transform(matrix * Affine::scale(5.0), vectorcraft_doc::Scaling { patterns: true, ..Default::default() });
// This fallback bakes the unsupported brick phase. Place on whole super-tile periods
// so the probe isolates stroke geometry, rather than that existing placement limitation.
doc.layers.clear();
let native_layer = doc.add_layer(Some("Native instance"));
let native_one = instance(&mut doc, "Scaled", Affine::translate((60.0, 40.0)));
doc.insert(Some(native_layer), usize::MAX, native_one).unwrap();
let bounds = doc.symbols[0].art.geometric_bounds().unwrap() + vectorcraft_geom::Vec2::new(60.0, 40.0);
let period_y = 10.0 * matrix.as_coeffs()[3].abs();
let region = Rect::new(bounds.x0, bounds.y0, bounds.x0 + 2.0, bounds.y0 + period_y);
let native = vectorcraft_testkit::raster::render_region(&doc, region, 20.0);
// Brick rows shift the line horizontally; select a visible native column and compare
// that same column after the editing-stream round trip.
let (column, native_weight) = (0..native.width)
.map(|x| (x, (0..native.height).filter(|y| native.pixel(x, *y)[0] < 64).count()))
.max_by_key(|(_, weight)| *weight)
.unwrap();
assert!(native_weight > 0 && native_weight < native.height as usize, "native mask stroke: {matrix:?}, {native_weight}");
let mut back = read_back(&doc);
back.layers.clear();
let layer = back.add_layer(Some("New instance"));
let one = instance(&mut back, "Scaled", Affine::translate((60.0, 40.0)));
back.insert(Some(layer), usize::MAX, one).unwrap();
let placed = vectorcraft_testkit::raster::render_region(&back, region, 20.0);
let weight = (0..placed.height).filter(|y| placed.pixel(column, *y)[0] < 64).count();
assert!(weight.abs_diff(native_weight) <= 2, "mask stroke {matrix:?}: editing={weight}, native={native_weight}");
}
}
#[test]
fn pattern_definition_dictionary_is_scoped_away_from_its_symbol() {
let mut doc = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 100.0);
// Definitions can hold freshly generated id-less art. Its dictionary must not consume the
// surrounding symbol's root entries just because these independent art scopes share id 0.
Arc::make_mut(&mut doc.patterns[0].art[0]).id = vectorcraft_doc::NodeId(0);
let art = (*doc.symbols[0].art).clone();
let other = square(&mut doc, Rect::new(25.0, 0.0, 30.0, 5.0), Color::BLACK);
let mut root = group(&mut doc, vec![art, other], false);
root.id = vectorcraft_doc::NodeId(0);
doc.symbols[0].art = Arc::new(root);
let back = read_back(&doc);
let symbol = back.symbols.iter().find(|s| s.name == "Scaled").expect("pattern art must not steal its symbol's declaration");
let mut uses = false;
vectorcraft_doc::swatches::walk_with_masks(&symbol.art, &mut |n| uses |= vectorcraft_doc::pattern::uses_pattern(n, Some("Rules")));
assert!(uses);
}
#[test]
fn symbol_pattern_matrices_stay_readable_or_use_the_bounded_fallback() {
for scale in [0.00001, 0.0, 1e-9] {
let mut doc = ruled_pattern_symbol(true, vectorcraft_doc::TileType::Grid, 100.0);
let art = Arc::make_mut(&mut doc.symbols[0].art);
for item in art.appearance.items.iter_mut() {
if let Paint::Pattern { xf, .. } = item.paint_mut() {
*xf = Affine::scale(scale);
}
}
let out = export_ai_editing(&doc, &opts()).unwrap();
let back = read_back(&doc);
let symbol = back.symbols.iter().find(|s| s.name == "Scaled").expect("a bad paint matrix must not discard its symbol");
let mut paints = vec![];
vectorcraft_doc::swatches::walk_with_masks(&symbol.art, &mut |n| {
for item in &n.appearance.items {
if let Paint::Pattern { xf, .. } = item.paint() {
paints.push(*xf);
}
}
});
if scale == 0.00001 {
assert_eq!(paints, [Affine::scale(scale)], "a small invertible affine must survive serialization");
} else {
assert!(paints.is_empty() && out.warnings.iter().any(|w| w == writer::PATTERN_PLACEMENT), "{:?}", out.warnings);
}
}
}
/// A symbol whose art paints with a pattern only through a brushed stroke, whose brush's art is
/// filled with a pattern: the definition holds the tiles, and its instance is written as its art.
/// filled with a pattern: the definition keeps that resource, and its instance is written as art.
#[test]
fn symbols_painting_patterns_through_brush_art_are_placed_as_art() {
let mut doc = Document::new(200.0, 100.0);
@@ -6786,9 +6947,13 @@ fn symbols_painting_patterns_through_brush_art_are_placed_as_art() {
doc.insert(Some(layer), usize::MAX, one).unwrap();
let out = export_ai_editing(&doc, &opts()).unwrap();
assert!(out.warnings.iter().any(|w| w == writer::SYMBOL_ART), "{:?}", out.warnings);
assert!(!out.warnings.iter().any(|w| w == writer::PATTERNS), "{:?}", out.warnings);
let back = read_back(&doc);
assert_eq!(back.symbols.iter().map(|s| s.name.as_str()).collect::<Vec<_>>(), ["Brushed"]);
assert_eq!(instances(&back.layers[0]), 0, "the instance is its art");
let mut pattern = false;
vectorcraft_doc::swatches::walk_with_masks(&back.symbols[0].art, &mut |n| pattern |= vectorcraft_doc::pattern::uses_pattern(n, Some("Dots")));
assert!(pattern, "indirect brush paint retains its pattern resource in the definition");
}
/// A symbol first defined from the drawn look of a group with a style, through a member's scatter
+34 -6
View File
@@ -48,7 +48,7 @@ pub(super) use paints::{
GRADIENT_COMPARISONS, GRADIENT_DITHER, GRADIENT_HUE, GRADIENT_PERCEPTUAL, GRADIENT_SHAPES, GRADIENTS, SCANNED_DEFINITIONS, STOP_LINKS,
SWATCH_PLACEMENT, free_gradient_name,
};
pub(crate) use symbols::{DYNAMIC_KEY, OVERRIDES_KEY, hex_decode};
pub(crate) use symbols::{DYNAMIC_KEY, OVERRIDES_KEY, PATTERN_SPACE_KEY, hex_decode};
#[cfg(test)]
pub(super) use symbols::{MISSING_SYMBOL, OVERRIDE_SERIALIZATIONS, SYMBOL_ART, SYMBOL_CHANGES, SYMBOL_COUNT, SYMBOL_OPTIONS};
#[cfg(test)]
@@ -62,8 +62,10 @@ pub(super) use variables::{ACTIVE, BINDINGS, LIMITS, VALUES};
pub(super) const MAX_NEST: u32 = 8;
pub(super) const TYPE: &str = "type in opacity masks, pattern tiles, symbols and art cut to a clipping object, mirrored type, area type and type on a path that is turned or unevenly scaled or whose frame or path has several parts, area type in an open frame, type on an open path whose ends meet, area type whose text wrap cannot be preserved from the saved objects, type of only white space, threads of type on a path, threads whose frames differ in orientation or hold a frame written as outlines, type of sizes past what the reader reads, stories past what the reader reads (1,048,576 bytes a story, 16,777,216 bytes in all, and the size of text document it reads), and type with inline graphics, ruby, gradient or pattern paint, or fills, strokes, effects or an opacity mask of the object's own, is written as its outlines in the editing data for other apps";
pub(super) const PATTERNS: &str = "pattern fills whose tiles aren't a grid or whose art reaches past the tile, pattern fills in another pattern's tile or in a symbol, and pattern fills nested more than 8 deep are written as their tiles cut to the shape in the editing data for other apps";
pub(super) const PATTERNS: &str = "pattern fills whose tiles aren't a grid or whose art reaches past the tile, pattern fills in another pattern's tile or in a large canvas's symbol, and pattern fills nested more than 8 deep are written as their tiles cut to the shape in the editing data for other apps";
pub(super) const PATTERN_TILES: &str = "pattern fills with more tiles than a fill places are written filled gray in the editing data for other apps";
pub(super) const PATTERN_PLACEMENT: &str =
"pattern fills and strokes whose placement cannot be read are written gray in the editing data for other apps";
pub(super) const CLIPPING: &str = "clipping groups and clipping layers whose clipping object isn't a path, and the clipping groups inside them, are written as their art cut to that object in the editing data for other apps";
pub(super) const CLIP_PAINT: &str = "the fills and strokes of clipping paths that a plain fill and line can't draw are written as paths of their own inside the clipping (fills under the clipped art, strokes over it) in the editing data for other apps";
pub(super) const CLIP_PAINT_MASKS: &str = "the opacity masks of clipping paths whose fills and strokes are written as paths of their own stay on the clipping path, not on those paths, in the editing data for other apps";
@@ -270,10 +272,10 @@ pub(super) struct Writer<'a> {
/// ([`Self::symbol_paints_pattern`]).
patterned_symbols: HashMap<String, bool>,
symbol_omissions: HashMap<*const Node, symbols::OmissionFacts>,
/// Pattern tiles were written in the art being written ([`Self::define_symbol`] starts it over
/// Pattern references or tiles were written in the art ([`Self::define_symbol`] starts it over
/// for each symbol's art).
wrote_pattern: bool,
/// The symbols whose definitions hold pattern tiles: a brushed stroke's brush art or a live
/// The symbols whose definitions write pattern paint: a brushed stroke's brush art or a live
/// object's art can paint with a pattern that the symbol's own objects don't name.
pattern_written: HashSet<String>,
/// Art that draws as it should only where it is was written in the art being written
@@ -1034,6 +1036,7 @@ impl<'a> Writer<'a> {
mask = None;
mask_written = false;
}
let symbol_root = self.root_entries.as_ref().is_some_and(|(id, _)| *id == n.id);
let entries = match &self.root_entries {
Some((id, _)) if *id == n.id => self.root_entries.take().map(|(_, e)| e),
_ => None,
@@ -1084,6 +1087,10 @@ impl<'a> Writer<'a> {
}
mask_written = false;
}
// A pattern may first be written by the root's mask, so declare its space afterwards.
if symbol_root && self.in_symbol && self.symbols_live && self.wrote_pattern {
let _ = writeln!(self.body, "%_1 /Int ({PATTERN_SPACE_KEY}) ,");
}
self.body.push_str("%_;\n%_\n");
mask_written
}
@@ -1483,7 +1490,8 @@ impl<'a> Writer<'a> {
let flat = FillLayer { paint: Paint::solid(Color::gray(0.5)), ..f.clone() };
return self.path_object(path, rule, Some(&flat), None, xy);
};
let tiles = def.instances_in(*xf, path.to_bezpath().bounding_box());
let inverse = xf.inverse();
let tiles = def.instances_in(Affine::IDENTITY, inverse.transform_rect_bbox(path.to_bezpath().bounding_box()));
// More tiles than a fill places come back as none: the shape is filled gray, as a
// pattern that isn't found is.
if tiles.is_empty() && !def.art.is_empty() {
@@ -1497,8 +1505,26 @@ impl<'a> Writer<'a> {
}
self.wrote_pattern = true;
let outer = self.clip.clone();
let region = self.cut(path, rule);
let mut region = self.cut(path, rule);
region.transform(inverse);
self.clip = Some(region);
let shown = std::mem::take(&mut self.shown);
self.shown = shown
.iter()
.map(|p| {
let mut p = p.clone();
p.apply_affine(inverse);
p
})
.collect();
// Outline and clip strokes in pattern space before applying its affine. Moving
// just their centerlines first kept 2pt strokes at 2pt under a 20% pattern scale;
// scaling by one mean factor would still distort nonuniform/sheared patterns.
let spaces = (self.to_art, self.grad_space, self.canvas, self.instance_space);
self.to_art *= *xf;
self.grad_space *= *xf;
self.canvas *= *xf;
self.instance_space *= *xf;
self.nest += 1;
self.drawn += 1;
for t in &tiles {
@@ -1511,6 +1537,8 @@ impl<'a> Writer<'a> {
self.end_group("U", xy);
self.nest -= 1;
self.clip = outer;
self.shown = shown;
(self.to_art, self.grad_space, self.canvas, self.instance_space) = spaces;
}
Paint::None => {}
}
+1 -1
View File
@@ -430,7 +430,7 @@ impl Writer<'_> {
}
/// `[a b c d tx ty]`, each number to ten decimals ([`ps::num`] writes four).
fn matrix(m: Affine) -> String {
pub(super) fn matrix(m: Affine) -> String {
let n: Vec<String> = m.as_coeffs().iter().map(|v| precise(*v)).collect();
format!("[{}]", n.join(" "))
}
+31 -6
View File
@@ -366,7 +366,12 @@ impl Writer<'_> {
/// Does a plain line of `s`'s paint draw it ([`Self::direct`], and the line style operators can
/// write it)?
pub(super) fn direct_stroke(&self, s: &StrokeLayer) -> bool {
self.direct(&s.paint) && crate::ai_ops::plain_stroke(s)
let [a, b, c, d, ..] = self.to_art.as_coeffs();
// Operators receive transformed path coordinates, but their width is in art units.
// A non-isometric map needs the stroke's outline transformed too (including in masks,
// whose dictionary temporarily clears the clipping region of a pattern fallback).
let isometry = (a * a + b * b - 1.0).abs() < 1e-9 && (c * c + d * d - 1.0).abs() < 1e-9 && (a * c + b * d).abs() < 1e-9;
isometry && self.direct(&s.paint) && crate::ai_ops::plain_stroke(s)
}
/// `n`'s paint `items` as one path object paints: no paint, a fill, a plain line, or both, the
@@ -575,10 +580,10 @@ impl Writer<'_> {
/// Can pattern `name` be written as a definition and painted with from here: the document has
/// it, its tiles make a grid, its art is within its tile and holds something, and it isn't used
/// in another pattern's tile or a symbol's art (the reader keeps no symbol whose art paints with
/// a pattern) or nested more than [`MAX_NEST`] deep?
/// in another pattern's tile or nested more than [`MAX_NEST`] deep? A large canvas's symbol
/// art uses the original document, whose same-name tiles can differ from the reduced page's.
pub(super) fn pattern_writable(&self, name: &str) -> bool {
if !self.defining.is_empty() || self.nest >= MAX_NEST || self.in_symbol {
if !self.defining.is_empty() || self.nest >= MAX_NEST || (self.in_symbol && !self.symbols_live) {
return false;
}
if self.patterns.find(name).is_some() {
@@ -604,7 +609,14 @@ impl Writer<'_> {
let doc = self.doc;
// The tile's box is an object of the definition ([`Self::take_objects`]).
let (before, bound) = (self.charges(), self.bound.len());
let Some(def) = doc.pattern(name).filter(|_| self.take_objects(1)) else { return false };
let Some(def) = doc.pattern(name) else { return false };
// A pattern is a separate global resource, even when first discovered in symbol art.
// Charge its objects outside the symbol-art budget and isolate parent dictionaries.
let in_symbol = std::mem::take(&mut self.in_symbol);
if !self.take_objects(1) {
self.in_symbol = in_symbol;
return false;
}
self.defining.push(name.to_string());
// The art is written in the pattern's space, y up, from the state a definition starts in.
let saved = (
@@ -616,6 +628,7 @@ impl Writer<'_> {
self.block_end,
// The tile's masks' objects are written with their art styles, those of no other art.
(std::mem::replace(&mut self.styled, self.pattern_styled.get(name).cloned().unwrap_or_default()), self.mask_level.take()),
(in_symbol, self.root_entries.take(), self.instance_entries.take(), self.block_start),
);
// `Bg` places a gradient in a pattern's tile as on the canvas, mirrored top to bottom: its
// placement is worked out in the tile's space turned y up.
@@ -646,6 +659,7 @@ impl Writer<'_> {
(self.clip, self.shown),
self.block_end,
(self.styled, self.mask_level),
(self.in_symbol, self.root_entries, self.instance_entries, self.block_start),
) = saved;
let art = std::mem::replace(&mut self.body, art);
self.defining.pop();
@@ -678,7 +692,18 @@ impl Writer<'_> {
return self.plain_color(Color::gray(0.5), stroke);
};
let m = self.to_art * xf * Affine::translate((0.0, h)) * Affine::FLIP_Y;
let _ = writeln!(self.body, "{} 0 0 1 1 0 0 0 0 0 {} {}", ps::bytes(name.as_bytes()), ps::matrix(m), if stroke { 'P' } else { 'p' });
let written = Affine::new(m.as_coeffs().map(|v| (v * 1e10).round() / 1e10));
// Keep a definition's reference readable after serialization; a singular or rounded-flat
// paint must not make the reader discard the entire symbol that contains it.
if !written.as_coeffs().iter().all(|v| v.is_finite()) || !written.determinant().is_finite() || written.determinant().abs() < 1e-12 {
self.warn(super::PATTERN_PLACEMENT);
return self.plain_color(Color::gray(0.5), stroke);
}
// Indirect pattern paint (for example in brush art) also prevents a live symbol
// instance: the canvas keeps its pattern phase fixed when placing that instance.
self.wrote_pattern = true;
let _ =
writeln!(self.body, "{} 0 0 1 1 0 0 0 0 0 {} {}", ps::bytes(name.as_bytes()), super::images::matrix(m), if stroke { 'P' } else { 'p' });
}
/// The definitions, in the setup before the palette: the gradients the art uses (`n Bn`, then
@@ -19,6 +19,9 @@ pub(in crate::ai_editing) const SYMBOL_CHANGES: &str =
"the changes of dynamic symbol instances are kept in dictionary entries of their own, which other apps leave out";
pub(crate) const DYNAMIC_KEY: &str = "VectorCraftDynamicSymbol";
pub(crate) const OVERRIDES_KEY: &str = "VectorCraftSymbolOverrides";
/// Version 1 declares that pattern matrices in this definition use its art coordinates.
/// Foreign definitions without that declaration retain the reader's conservative fallback.
pub(crate) const PATTERN_SPACE_KEY: &str = "VectorCraftSymbolPatternSpace";
const MAX_OVERRIDES_BYTES: usize = 1 << 20;
#[cfg(test)]
@@ -385,6 +388,9 @@ impl Writer<'_> {
if wrap {
self.line("u");
self.node(root);
if self.symbols_live && self.wrote_pattern {
let _ = writeln!(entries, "%_1 /Int ({PATTERN_SPACE_KEY}) ,");
}
let _ = write!(self.body, "U\n%_/ArtDictionary :\n{entries}%_;\n%_\n9 () XW\n");
} else {
// A group always writes its dictionary ([`Self::dictionary`]), which takes the entries.
+6 -2
View File
@@ -631,8 +631,12 @@ impl<'a> Reader<'a> {
let measured = read.is_ok() && !open && sub.unsupported.is_empty() && sub.unknown.is_empty() && sub.frames.len() == 1;
let Some(frame) = sub.frames.pop().filter(|_| measured) else { return };
let mut kids = frame.children;
// Where a symbol's art puts a pattern's tiles isn't known.
let whole = !head.left_out && sub.unread.is_empty() && sub.hidden_unread.is_empty() && !kids.iter().any(|n| paints_pattern(n, 0));
// Unmarked foreign symbols do not declare the coordinate convention of their patterns.
// Our writer explicitly declares symbol-art space, so those definitions can retain paint.
let whole = !head.left_out
&& sub.unread.is_empty()
&& sub.hidden_unread.is_empty()
&& (head.pattern_space || !kids.iter().any(|n| paints_pattern(n, 0)));
if !whole {
let boxes = self.doc.symbol_boxes();
let bounds = kids.iter().fold(None, |acc, n| vectorcraft_geom::union_opt(acc, n.visual_bounds_with(&boxes)));
@@ -805,6 +805,12 @@ impl<'a> Reader<'a> {
{
head.dynamic = true;
}
if self.frames.len() == 1
&& let Some(head) = self.symbol.as_mut()
&& o.nums(crate::ai_editing::PATTERN_SPACE_KEY).first().copied() == Some(1.0)
{
head.pattern_space = true;
}
if let Some(text) = o.text(crate::ai_editing::OVERRIDES_KEY)
&& let Some(bytes) = crate::ai_editing::hex_decode(&text)
&& let Ok(list) = serde_json::from_slice::<Vec<vectorcraft_doc::SymbolOverride>>(&bytes)
+2
View File
@@ -245,6 +245,8 @@ pub(super) struct SymbolHead {
/// `AI13PatternRegistrationType` in the dictionary after the art.
pub(super) registration: Option<f64>,
pub(super) dynamic: bool,
/// The writer declares its pattern matrices to be in symbol-art coordinates (version 1).
pub(super) pattern_space: bool,
/// Art the reader left out (type, a placed file, non-native art, an image it can't read or
/// place, a gradient it can't read): the symbol isn't kept, and its instances come in as the
/// page draws them, within the box of the rest.
+50
View File
@@ -3016,6 +3016,56 @@ fn photoshop_filters_on_content_larger_than_the_budget() {
}
}
/// Glowing Edges scales every edge by the strongest one in the object, so a zoomed-in frame draws
/// a point's glow as the whole object draws it. The object is a white 4 × 80 pt bar beside
/// stripes 0.5 pt wide and 1 pt apart, whose edges lie close together and glow strongest, on
/// black. At 400 % the whole object fits the pixel budget; at 6400 % a 200 × 200 view shows only
/// the bar's left edge, and the stripes lie beyond what the effect reads around the view. The pans
/// move the view 10 and 20 pixels, the second within the margin a raster made again at the same
/// zoom keeps, which reaches the stripes.
#[test]
fn glowing_edges_zoomed_in_glow_as_bright_as_in_the_whole_object() {
use vectorcraft_geom::{PathData, SubPath};
let rect = |x0: f64, y0: f64, x1: f64, y1: f64| {
SubPath::polyline(&[Point::new(x0, y0), Point::new(x1, y0), Point::new(x1, y1), Point::new(x0, y1)], true)
};
let mut subpaths = vec![rect(10.0, 10.0, 14.0, 90.0)];
subpaths.extend((0..30).map(|i| rect(16.0 + f64::from(i), 10.0, 16.5 + f64::from(i), 90.0)));
let mut d = Document::new(100.0, 100.0);
let mut ap = Appearance::basic(Paint::solid(Color::rgb(1.0, 1.0, 1.0)), Paint::None, 0.0);
ap.effects =
vec![Effect { id: "stylize.glowingEdges".into(), params: json!({"edgeWidth": 1, "edgeBrightness": 6, "smoothness": 1}), visible: true }];
let n = Node::path(d.alloc_id(), PathData::new(subpaths), ap);
let l = d.layers[0].id;
d.insert(Some(l), 0, n).unwrap();
let opts = RenderOptions { background: Some([0, 0, 0, 255]), ..Default::default() };
// Just inside the bar's left edge.
let at = Point::new(10.125, 50.0);
let glow = |img: &Rendered, view: Affine| {
let p = view * at;
img.pixel(p.x.floor() as u32, p.y.floor() as u32)[0]
};
let whole_view = Affine::scale(4.0);
let mut whole = Renderer::new();
let whole_img = whole.render(&d, 400, 400, whole_view, &opts);
assert_eq!(whole.stats.view_sized, 0, "at 400 % the whole object is one raster");
let whole = glow(&whole_img, whole_view);
let zoomed = |dx: f64| Affine::translate((100.0 - dx, 100.0)) * Affine::scale(64.0) * Affine::translate((-at.x, -at.y));
let mut r = Renderer::new();
let mut seen = vec![];
for dx in [0.0, 10.0, 20.0] {
let view = zoomed(dx);
let panned = glow(&r.render(&d, 200, 200, view, &opts), view);
let fresh = glow(&Renderer::new().render(&d, 200, 200, view, &opts), view);
seen.push((dx, panned, fresh));
assert!(panned.abs_diff(fresh) <= 2, "panned {dx} px, the frame draws the glow a fresh renderer draws: {seen:?}");
}
assert!(r.stats.view_sized > 0, "at 6400 % the object is over the pixel budget");
for (dx, panned, _) in &seen {
assert!(panned.abs_diff(whole) <= 24, "panned {dx} px, the glow is as bright as the whole object's {whole}: {seen:?}");
}
}
/// #5308: an image's Inner Glow follows its visible pixels, not its frame. A 40 × 40 image whose
/// left half is transparent and right half opaque black, on a black page, with a white glow from
/// the edges: the transparent half stays black, and the glow lights the opaque half's left edge
+43 -8
View File
@@ -56,6 +56,8 @@ use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, Tool
pub struct EyedropperTool {
/// Sampling for the selected gradient stop: the tool to switch back to afterwards.
stop: Option<String>,
/// Sampling for the selected freeform point: the tool to switch back to afterwards.
point: Option<String>,
/// The Type tool's highlighted range while sampling, including its selection overlay.
text_selection: crate::text::TypeTool,
/// Brush Options › Key Color (Hue Shift): sample into the dialog, then [`Self::stop`].
@@ -567,8 +569,14 @@ impl Tool for EyedropperTool {
}
Click::Back(back) => {
self.stop = None;
self.point = None;
vec![Action::SwitchTool(back)]
}
Click::SamplePoint(color, _, index, back) => {
self.point = None;
let params = json!({ "index": index, "stroke": !cx.fill_active, "color": color_json(&color), "keepModel": true });
vec![Action::Exec("paint.freeform.setPoint".into(), params), Action::SwitchTool(back)]
}
Click::MeshPoints(id, points, color) => {
let params = json!({ "id": id.0, "points": points, "color": color_json(&color), "keepModel": true });
vec![Action::Exec("object.mesh.setPointColor".into(), params)]
@@ -605,6 +613,9 @@ impl Tool for EyedropperTool {
let mut options = if selected.get("editing").is_some_and(|v| !v.is_null()) { selected } else { json!({}) };
if let Some(o) = options.as_object_mut() {
o.insert("stop".into(), json!(self.stop));
if let Some(back) = &self.point {
o.insert("freeformPoint".into(), json!(back));
}
o.insert("brushKeyColor".into(), json!(self.brush_key_color));
if let Some(binding) = &self.image_trace_ignore_color {
o.insert("imageTraceIgnoreColor".into(), binding.clone());
@@ -621,7 +632,18 @@ impl Tool for EyedropperTool {
/// Type tool or a tool that picks mesh points.
fn set_option(&mut self, key: &str, value: &Value) {
match key {
"stop" => self.stop = value.as_str().map(str::to_string),
"stop" => {
self.stop = value.as_str().map(str::to_string);
if self.stop.is_some() {
self.point = None;
}
}
"freeformPoint" => {
self.point = value.as_str().map(str::to_string);
if self.point.is_some() {
self.stop = None;
}
}
"brushKeyColor" => self.brush_key_color = value.as_bool().unwrap_or(false),
"imageTraceIgnoreColor" => self.image_trace_ignore_color = (!value.is_null()).then(|| value.clone()),
"meshPoints" => self.mesh_points = crate::meshedit::points_of(value),
@@ -633,7 +655,7 @@ impl Tool for EyedropperTool {
fn check_option(&self, key: &str, value: &Value) -> Result<(), String> {
use crate::option_check as c;
match key {
"stop" => c::string_or_null(key, value),
"stop" | "freeformPoint" => c::string_or_null(key, value),
"brushKeyColor" => c::boolean(key, value),
"textSelection" => self.text_selection.check_option(key, value),
_ => Err(c::unknown(key)),
@@ -663,6 +685,9 @@ impl Tool for EyedropperTool {
if key != ToolKey::Escape || !self.picking() {
return vec![];
}
if let Some(back) = self.point.take() {
return vec![Action::SwitchTool(back)];
}
if let Some(binding) = self.image_trace_ignore_color.take() {
let back = self.stop.take().unwrap_or_else(|| "selection".to_string());
return vec![Action::Dialog("imageTraceIgnoreColor".into(), json!({ "binding": binding, "cancel": true })), Action::SwitchTool(back)];
@@ -678,7 +703,7 @@ impl Tool for EyedropperTool {
}
fn returns_to(&self) -> Option<&str> {
self.stop.as_deref().filter(|_| !self.brush_key_color && self.image_trace_ignore_color.is_none())
self.point.as_deref().or_else(|| self.stop.as_deref().filter(|_| !self.brush_key_color && self.image_trace_ignore_color.is_none()))
}
/// Escape is the tool's while a pick is armed, so it switches back and ends nothing else.
@@ -697,9 +722,10 @@ enum Click {
ImageTrace(Value),
/// Brush Options › Key Color: this color, sampled from this object.
BrushKeyColor(Color, NodeId),
/// A pick for a stop of the gradient a tool paints with (the Live Paint Bucket's, the Shape
/// Builder's fill) that is no longer selected switches back to that tool unsampled.
/// The pick's target is no longer valid. Return to the previous tool without sampling.
Back(String),
/// This color, sampled from this object, goes to the armed freeform point.
SamplePoint(Color, NodeId, usize, String),
/// The fill color goes to these points of this selected gradient mesh.
MeshPoints(NodeId, Vec<usize>, Color),
/// `appearance.copyFrom` this source, with `reverse` or `append` or neither.
@@ -715,19 +741,28 @@ impl Click {
fn object(&self) -> Option<NodeId> {
match self {
Click::ImageTrace(_) | Click::Back(_) => None,
Click::BrushKeyColor(_, id) | Click::MeshPoints(id, ..) | Click::CopyFrom(id, _) | Click::Sample { source: id, .. } => Some(*id),
Click::BrushKeyColor(_, id)
| Click::SamplePoint(_, id, ..)
| Click::MeshPoints(id, ..)
| Click::CopyFrom(id, _)
| Click::Sample { source: id, .. } => Some(*id),
}
}
}
impl EyedropperTool {
/// Is a gradient stop, Brush Key Color or Image Trace Ignore Color pick armed?
/// Is a gradient stop, freeform point, Brush Key Color or Image Trace Ignore Color pick armed?
fn picking(&self) -> bool {
self.stop.is_some() || self.brush_key_color || self.image_trace_ignore_color.is_some()
self.stop.is_some() || self.point.is_some() || self.brush_key_color || self.image_trace_ignore_color.is_some()
}
/// What a click at `p` with `mods` does, or None when it does nothing.
fn click(&self, cx: &ToolContext, p: Point, mods: Mods) -> Option<Click> {
if let Some(back) = &self.point {
let Some(index) = cx.freeform_point else { return Some(Click::Back(back.clone())) };
let (color, source) = sample_at(cx, p)?;
return Some(Click::SamplePoint(color, source, index, back.clone()));
}
if let Some(binding) = &self.image_trace_ignore_color {
return Some(Click::ImageTrace(binding.clone()));
}
+74 -1
View File
@@ -512,14 +512,26 @@ fn confirm(app: &mut VectorcraftApp, source: &Source, choices: &DxfChoices) -> R
// Where new art goes now is taken before Replace selects the object it swaps again.
let current = placement.and_then(|_| crate::placing::Insertion::of(app));
// A drawing converted off the UI thread replaces the object selected when Place
// started, selected again, unless it changed meanwhile.
// started, selected again, unless it changed meanwhile. When the drawing is not placed,
// the user's selection comes back.
let mut user_selection = None;
if let Some((old, node)) = placement.and_then(|pl| pl.replaced.as_ref()) {
let st = app.session.doc().map_err(|e| e.to_string())?;
if st.doc.node(*old) != Some(node) {
return Err("replace: the object to replace was changed or deleted".into());
}
if st.selection.objects != [*old] || st.selection.symbol_part.is_some() {
let user = st.selection.clone();
app.session.execute("select.set", &json!({ "ids": [old.0] })).map_err(|e| e.to_string())?;
let st = app.session.doc().map_err(|e| e.to_string())?;
user_selection = Some(crate::placing::Reselect {
doc: st.uid,
swapped: st.selection.clone(),
selections: st.selections,
art: st.doc.clone(),
isolation: st.isolation,
user,
});
}
}
// It goes where new art went when Place started, and what the user changed since is
@@ -537,12 +549,19 @@ fn confirm(app: &mut VectorcraftApp, source: &Source, choices: &DxfChoices) -> R
if let Some(path) = &source.path {
app.placing.bytes_next = Some((path.clone(), source.file.clone()));
}
app.placing.select_on_failure = user_selection.clone();
let r = crate::place::run_for_user(app, &p).map(|_| ());
app.placing.keep_next = None;
app.placing.bytes_next = None;
app.placing.select_on_failure = None;
if let (Some(current), Some(insertion)) = (current, restore) {
current.restore_changed(&insertion, app);
}
if r.is_err()
&& let Some(back) = &user_selection
{
crate::placing::reselect(app, back);
}
r
}
None => {
@@ -1107,6 +1126,60 @@ mod tests {
crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap();
assert!(app.opening.converting.is_empty());
assert!(app.ui.status.contains("select the one object to replace"), "{}", app.ui.status);
// A Replace that fails keeps the selection the user made since Place started.
let replaced = rect(&mut app, 90.0);
crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap();
let selected_since = rect(&mut app, 130.0);
finish_conversions(&mut app);
set(&app, "layout", json!("No such layout"));
let undo = undo_steps(&app, first);
let _ = host::confirm(&mut app, KIND);
placed(&mut app);
assert!(app.ui.status.contains("no layout"), "{}", app.ui.status);
let st = app.session.doc().unwrap();
assert!(st.doc.node(replaced).is_some(), "the object is not replaced");
assert_eq!(st.selection.objects, vec![selected_since], "the selection made since Place started is kept");
assert_eq!(undo_steps(&app, first), undo);
host::cancel(&app, KIND);
// A selection made while the drawing is read is kept too.
crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap();
rect(&mut app, 170.0);
finish_conversions(&mut app);
set(&app, "layout", json!("No such layout"));
let _ = host::confirm(&mut app, KIND);
app.run("select.set", json!({ "ids": [selected_since.0] })).unwrap();
placed(&mut app);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![selected_since], "the selection made since OK is kept");
host::cancel(&app, KIND);
// Selecting the replacement target again after OK keeps that selection on failure.
crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap();
rect(&mut app, 210.0);
finish_conversions(&mut app);
set(&app, "layout", json!("No such layout"));
let _ = host::confirm(&mut app, KIND);
app.run("select.set", json!({ "ids": [replaced.0] })).unwrap();
placed(&mut app);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![replaced], "the target selected again since OK is kept");
host::cancel(&app, KIND);
// Cancel restores the source document's selection while another document stays active.
crate::place::run_for_user(&mut app, &json!({ "path": plan, "replace": true })).unwrap();
let selected_since = rect(&mut app, 250.0);
finish_conversions(&mut app);
set(&app, "layout", json!("No such layout"));
let _ = host::confirm(&mut app, KIND);
let other_index = app.session.documents().iter().position(|st| st.uid == other).unwrap();
let undo = undo_steps(&app, first);
app.session.set_active(other_index);
let other_selection = app.session.doc().unwrap().selection.clone();
assert_eq!(crate::placing::cancel_all(&mut app)["cancelled"], 1);
assert_eq!(app.session.doc().unwrap().uid, other);
assert_eq!(app.session.doc().unwrap().selection, other_selection);
let st = app.session.documents().iter().find(|st| st.uid == first).unwrap();
assert_eq!(st.selection.objects, vec![selected_since], "Cancel restores the background document's selection");
assert_eq!(st.history.undo.len(), undo);
host::cancel(&app, KIND);
let first_index = app.session.documents().iter().position(|st| st.uid == first).unwrap();
app.session.set_active(first_index);
// Closed meanwhile.
crate::place::run_for_user(&mut app, &json!({ "path": plan })).unwrap();
app.session.execute("file.close", &json!({})).unwrap();
+95 -6
View File
@@ -510,11 +510,12 @@ fn body(ui: &mut Ui, feed: &Feed, tab: &mut Tab, panel: &mut ColorPanelState, fi
Entry::new(Tab::Swatches, tl!("Swatches").to_owned()).icon(IconId::new("swatch-book")),
];
Segmented::new("View", Bind::bound(&mut *tab), &tabs).show(ui);
// A stop's colour can come from the art, as from the Gradient panel's eyedropper.
if !feed.point {
let tip = tl!("Eyedropper: click the art to sample the stop's colour").to_owned();
filed.eyedropper |= DropperButton::new(tip, Bind::given(false)).show(ui).edit.value() == Some(&true);
}
let tip = if feed.point {
tl!("Eyedropper: click the art to sample the point's colour")
} else {
tl!("Eyedropper: click the art to sample the stop's colour")
};
filed.eyedropper |= DropperButton::new(tip.to_owned(), Bind::given(false)).show(ui).edit.value() == Some(&true);
if *tab == Tab::Color {
let (closed, picked) = mode_menu(ui, &feed.shown, panel.mode);
outside |= closed;
@@ -834,7 +835,10 @@ pub(crate) fn pump(app: &mut VectorcraftApp, ctx: &egui::Context) {
}
if filed.eyedropper {
dialogs.with(|host| host.cancel_by_id(ctx, id));
crate::panels::gradient::stop_eyedropper(app);
match target {
Target::Stop(..) => crate::panels::gradient::stop_eyedropper(app),
Target::Point(..) => crate::panels::gradient::point_eyedropper(app),
}
return;
}
let updated = selected(app).filter(|target| owner.key.matches(app, target)).zip(app.session.gradient_edit_paints(!owner.key.fill).ok());
@@ -1722,6 +1726,91 @@ mod tests {
assert!(!is_open(&app));
}
fn point_sampling_panel() -> (crate::tests::panel_harness::Panel, NodeId, NodeId, usize) {
let mut app = app();
let target = app.session.active().unwrap().selection.objects[0];
app.run("file.documentColorMode", json!({"mode": "cmyk"})).unwrap();
app.run("paint.editGradient", json!({"kind": "freeform"})).unwrap();
app.run("paint.freeform.addPoint", json!({"at": [150, 150], "color": "#0000ff"})).unwrap();
let index = app.session.selected_freeform_point().unwrap();
let source = app.run("shape.rectangle", json!({"x": 230, "y": 80, "width": 60, "height": 80})).unwrap()["id"].as_u64().unwrap();
app.run("paint.setFill", json!({"color": "#00aa5a", "keepModel": true})).unwrap();
app.run("select.set", json!({"ids": [target.0]})).unwrap();
app.run("paint.freeform.selectPoint", json!({"index": index})).unwrap();
let panel = crate::tests::panel_harness::Panel::new(app, |app, ui| {
app.dialogs().unwrap().with(|host| host.run(ui));
host::pump(app, ui.ctx());
});
(panel, target, NodeId(source), index)
}
fn arm_point_sample(panel: &mut crate::tests::panel_harness::Panel, index: usize) {
open_at(&mut panel.app(), index, Anchor::Screen(egui::pos2(200.0, 200.0)));
panel.frame();
panel.click("Eyedropper: click the art to sample the point's colour");
assert!(!is_open(&panel.app()));
assert_eq!(panel.app().session.tool_id(), "eyedropper");
}
fn click_sample_source(app: &mut VectorcraftApp) {
use vectorcraft_tools::{PointerEvent, PointerKind};
let view = app.view_info();
for kind in [PointerKind::Down, PointerKind::Up] {
let requests = app.session.pointer(&PointerEvent::new(kind, 250.0, 115.0), view).unwrap();
crate::canvas::apply_requests(app, Ok(requests));
}
}
fn node_fill(app: &VectorcraftApp, id: NodeId) -> Paint {
app.session.active().unwrap().doc.node(id).unwrap().appearance.fill_paint()
}
#[test]
fn freeform_point_eyedropper_preserves_the_sample_model_and_undoes_once() {
let (mut panel, target, source, index) = point_sampling_panel();
let initial = node_fill(&panel.app(), target);
let source_fill = node_fill(&panel.app(), source);
let color = source_fill.color().unwrap();
assert!(matches!(color, Color::Rgb { .. }), "the source stores RGB in a CMYK document");
let points = |app: &VectorcraftApp| app.session.proxy_freeform(false).unwrap().0.points;
let mut expected = points(&panel.app());
assert_ne!(expected[index].color, color);
arm_point_sample(&mut panel, index);
click_sample_source(&mut panel.app());
assert_eq!(panel.app().session.tool_id(), "gradient");
expected[index].color = color;
assert_eq!(points(&panel.app()), expected, "only the point's color changes");
assert_eq!(node_fill(&panel.app(), source), source_fill);
panel.app().run("edit.undo", json!({})).unwrap();
assert_eq!(node_fill(&panel.app(), target), initial);
}
#[test]
fn freeform_point_eyedropper_cancels_and_skips_a_replaced_point() {
let (mut panel, target, source, index) = point_sampling_panel();
let initial = node_fill(&panel.app(), target);
let source_fill = node_fill(&panel.app(), source);
arm_point_sample(&mut panel, index);
let escape = egui::Event::Key { key: Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE };
let ctx = ctx(&panel.app());
crate::tests::synthetic::key_frame(&mut panel.app(), &ctx, vec![escape]);
assert_eq!(panel.app().session.tool_id(), "gradient");
assert_eq!(node_fill(&panel.app(), target), initial);
arm_point_sample(&mut panel, index);
panel.app().run("paint.freeform.deletePoint", json!({"index": index})).unwrap();
let replacement = panel.app().run("paint.freeform.addPoint", json!({"at": [155, 150], "color": "#ffa000"})).unwrap();
assert_eq!(replacement["index"].as_u64(), Some(index as u64), "the replacement uses the old index");
let before_pick = node_fill(&panel.app(), target);
assert_eq!(panel.app().session.tool_id(), "eyedropper");
click_sample_source(&mut panel.app());
assert_eq!(panel.app().session.tool_id(), "gradient");
assert_eq!(node_fill(&panel.app(), target), before_pick);
assert_eq!(node_fill(&panel.app(), source), source_fill);
}
#[test]
fn the_popover_closes_when_its_stop_goes_away() {
let mut app = app();
+18 -22
View File
@@ -109,36 +109,38 @@ fn percent_slider(app: &mut VectorcraftApp, ui: &mut Ui, target: &EditTarget, sl
});
}
/// The Steps, Distance, Ramp and Shift draft key: the document uid, its File › Revert count, and
/// each selected object id paired with its nearest blend id, or None when it resolves to no blend.
/// Symbol-part selections resolve to no blend, as the Blend commands require. A field drops an
/// unfinished value when this key changes, even when the new target shows the same value.
/// [`settings`] reuses this key until the document or selection changes and shares it with its fields.
pub(super) type EditTarget = Option<(u64, u64, Arc<Vec<(NodeId, Option<NodeId>)>>)>;
/// The Steps, Distance, Ramp and Shift draft key: the document uid, how many times File › Revert,
/// Undo or Redo and other rollbacks replaced its content (after which a node id can name another
/// object), as [`crate::panels::SelectionTarget`] counts them, and each selected object id paired
/// with its nearest blend id, or None when it resolves to no blend. Symbol-part selections resolve
/// to no blend, as the Blend commands require. A field drops an unfinished value when this key
/// changes, even when the new target shows the same value. [`settings`] reuses this key until the
/// document or selection changes and shares it with its fields.
pub(super) type EditTarget = Option<((u64, u64, u64, u64), Arc<Vec<(NodeId, Option<NodeId>)>>)>;
/// The resolved objects also hold the selection's ids, so checking the cache copies no selection.
struct TargetCache {
uid: u64,
document: (u64, u64, u64, u64),
revision: u64,
reverts: u64,
symbol_part: Option<SymbolPart>,
objects: Arc<Vec<(NodeId, Option<NodeId>)>>,
}
/// The active document's uid and revert count, with each selected id and its resolved blend id.
/// Resolution uses the same nearest-node finder and symbol-part guard as the Blend commands.
/// Unchanged document revisions and selections reuse the resolved objects between passes.
/// The active document's uid with its revert, history restore and rollback counts, and each
/// selected id with its resolved blend id. Resolution uses the same nearest-node finder and
/// symbol-part guard as the Blend commands. Unchanged document revisions and selections reuse the
/// resolved objects between passes.
pub(super) fn edit_target(app: &VectorcraftApp, ctx: &egui::Context) -> EditTarget {
let st = app.session.active()?;
let document = (st.uid, st.reverts, st.history_restores, st.rollbacks);
let key = egui::Id::unique("blend-edit-target");
if let Some(held) = ctx.data(|d| d.get_temp::<Arc<TargetCache>>(key))
&& held.uid == st.uid
&& held.document == document
&& held.revision == st.revision
&& held.reverts == st.reverts
&& held.symbol_part == st.selection.symbol_part
&& held.objects.iter().map(|(id, _)| id).eq(st.selection.objects.iter())
{
return Some((st.uid, st.reverts, held.objects.clone()));
return Some((document, held.objects.clone()));
}
let mut find = st.doc.nearest_finder();
let objects: Vec<(NodeId, Option<NodeId>)> = st
@@ -155,16 +157,10 @@ pub(super) fn edit_target(app: &VectorcraftApp, ctx: &egui::Context) -> EditTarg
ctx.data_mut(|d| {
d.insert_temp(
key,
Arc::new(TargetCache {
uid: st.uid,
revision: st.revision,
reverts: st.reverts,
symbol_part: st.selection.symbol_part.clone(),
objects: objects.clone(),
}),
Arc::new(TargetCache { document, revision: st.revision, symbol_part: st.selection.symbol_part.clone(), objects: objects.clone() }),
);
});
Some((st.uid, st.reverts, objects))
Some((document, objects))
}
/// Spacing and Orientation, as `object.blend.info` reports them; a change runs
+9 -1
View File
@@ -895,10 +895,18 @@ fn stops_editor(app: &mut VectorcraftApp, ui: &mut Ui, g: &GradientPaint, is_gra
/// selected stop, then hands back to the current tool (or, while a pick is already armed, to the
/// tool that armed it).
pub(crate) fn stop_eyedropper(app: &mut VectorcraftApp) {
gradient_eyedropper(app, "stop");
}
pub(crate) fn point_eyedropper(app: &mut VectorcraftApp) {
gradient_eyedropper(app, "freeformPoint");
}
fn gradient_eyedropper(app: &mut VectorcraftApp, option: &str) {
let tool = app.session.tool_id();
let back = (tool == "eyedropper").then(|| app.session.tool_returns_to()).flatten().unwrap_or_else(|| tool.to_string());
app.select_tool("eyedropper");
app.session.set_tool_option("stop", &json!(back));
app.session.set_tool_option(option, &json!(back));
}
/// Open the stop popover for stop `i` at screen position `at`, the stop selected first.
+111 -9
View File
@@ -4,11 +4,14 @@
//! across in one line; in a dock column or a narrow floating window they wrap down the column, and scroll when they
//! do not fit.
//!
//! A click on a chip sets the fill (`paint.setFill`); a right-click or an Alt-click sets the stroke
//! (`paint.setStroke`). Neither changes which of the Fill and Stroke proxies is active.
//! A click on a chip, or Space or Enter on the focused chip, sets the fill (`paint.setFill`); a right-click, an
//! Alt-click, Shift+F10 (or the Menu key off macOS) on the focused chip, or a screen reader's context menu action
//! sets the stroke (`paint.setStroke`).
//! Neither changes which of the Fill and Stroke proxies is active.
use craft::theme::Srgba;
use craft::ui::choice::Swatch;
use craft::ui::contract::overlay::offer_context_menu;
use craft::ui::contract::{Props as _, Scroll, Show as _, ShowContainer as _};
use craft::ui::layout_components::{Row, Stack};
use egui::{Event, PointerButton, Rect, Ui};
@@ -56,33 +59,54 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
return;
}
let chips = chips(app);
// Each chip is keyed by its document and the paint it sends, so a swatch that moves in the list between a press
// and its release keeps its control, and a release in another document reaches none of this one's chips. Chips
// that send the same paint (two swatches with one name, which an opened file can hold) are numbered in list order,
// so each keeps a control of its own.
let uid = app.session.active().map_or(0, |st| st.uid);
let mut seen = std::collections::HashMap::<String, usize>::new();
let keys: Vec<String> = chips
.iter()
.map(|c| {
let paint = c.params.to_string();
let n = seen.entry(paint.clone()).or_default();
let key = format!("{uid}:{paint}:{n}");
*n += 1;
key
})
.collect();
let mut picked = None;
// A secondary-button release in this frame: the chips' context requests then come from the pointer, which the
// press tracking below handles, rather than from Shift+F10, the Menu key or a screen reader.
let secondary_release =
ui.input(|i| i.events.iter().any(|e| matches!(e, Event::PointerButton { button: PointerButton::Secondary, pressed: false, .. })));
// Where each chip shows (clipped to the scroll area), for placing the frame's right-button events.
// A sizing pass draws the chips first; the drawing pass after it writes over its rects.
let mut hits: Vec<Option<Rect>> = vec![None; chips.len()];
Stack::new().id_salt(ID).fill().scroll(Scroll::vertical()).show(ui, |ui, _| {
Row::new().fill_width().wrap(true).show(ui, |ui, _| {
for (at, chip) in chips.iter().enumerate() {
for (at, (chip, key)) in chips.iter().zip(&keys).enumerate() {
let swatch = match chip.color {
Some(color) => Swatch::new(chip.name.clone(), color),
None => Swatch::optional(chip.name.clone(), None::<Srgba>),
};
let out = swatch.id_salt(at).tooltip(chip.name.clone()).show(ui);
let out = swatch.id_salt(key).tooltip(chip.name.clone()).show(ui);
// A screen reader's context menu action on the chip sets the stroke, as a right-click does.
offer_context_menu(ui.ctx(), out.response.id);
if let Some(hit) = hits.get_mut(at) {
*hit = Some(out.response.rect.intersect(ui.clip_rect()));
}
if out.clicked {
picked = Some((at, out.activation.is_some_and(|a| a.mods.alt)));
} else if out.context && !secondary_release {
picked = Some((at, true));
}
}
});
});
// A right-click sets the stroke when its press and its release both land on the same chip.
// A right-click sets the stroke when its press and its release both land on the same chip. The swatch's context
// request counts any secondary release over it, wherever the press began, so the strip tracks the press itself.
let press_id = ui.scope_id().with((ID, "secondary-press"));
// The chip is kept by its document and the paint it sends, so a swatch that moves in the list between press and
// release still counts, and a release in another document does not.
let uid = app.session.active().map_or(0, |st| st.uid);
let keys: Vec<String> = chips.iter().map(|c| format!("{uid}:{}", c.params)).collect();
let laid_out: Vec<(Rect, String)> = hits.iter().zip(&keys).filter_map(|(r, k)| r.map(|r| (r, k.clone()))).collect();
// A container's measuring run shows the strip in an invisible sizing pass with the same id and input before the
// frame's real run; it leaves the remembered press alone, so the real run's release still finds it.
@@ -174,6 +198,32 @@ mod tests {
assert_eq!(panel.app().session.fill_active, fill_active, "the active proxy stays as it was");
}
#[test]
fn shift_f10_on_the_focused_chip_sets_the_stroke() {
let mut panel = Panel::new(app(), show);
let before = paints(&panel);
panel.focus("Strip Red");
assert!(panel.focused("Strip Red"), "the chip takes the focus");
assert_eq!(paints(&panel), before, "focus alone sets nothing");
panel.key(egui::Key::F10, Modifiers::SHIFT);
panel.frame();
let (fill, stroke) = paints(&panel);
assert_eq!(swatch_of(&stroke).as_deref(), Some("Strip Red"), "Shift+F10 sets the stroke");
assert_eq!(fill, before.0, "Shift+F10 leaves the fill");
}
#[test]
fn a_screen_readers_context_menu_action_sets_the_stroke() {
let mut panel = Panel::new(app(), show);
assert!(panel.offers_context_menu("Strip Green"), "the chip offers the context menu action");
let before = paints(&panel).0;
panel.show_context_menu("Strip Green");
let (fill, stroke) = paints(&panel);
assert_eq!(swatch_of(&stroke).as_deref(), Some("Strip Green"), "the action sets the stroke");
assert_eq!(fill, before, "the action leaves the fill");
}
#[test]
fn a_right_drag_from_outside_onto_a_chip_leaves_the_stroke() {
let mut panel = Panel::new(app(), show);
@@ -219,6 +269,40 @@ mod tests {
assert_eq!(swatch_of(&paints(&panel).1).as_deref(), Some("Strip Red"), "the release on the same swatch sets the stroke");
}
#[test]
fn a_click_counts_for_the_swatch_pressed_when_another_moves_in_under_it() {
let mut panel = Panel::new(app(), show);
let from = panel.rect("Strip Red").center();
let button = |pressed| egui::Event::PointerButton { pos: from, button: egui::PointerButton::Primary, pressed, modifiers: Modifiers::NONE };
panel.frame_with(vec![egui::Event::PointerMoved(from)]);
panel.frame_with(vec![button(true)]);
panel.app().run("swatch.move", json!({"names": ["Strip Blue"], "to": 0})).unwrap();
panel.frame();
assert!(!panel.rect("Strip Red").contains(from), "the move takes the pressed chip from under the pointer");
panel.frame_with(vec![button(false)]);
panel.frame();
assert_eq!(swatch_of(&paints(&panel).0).as_deref(), Some("Strip Red"), "the click sets the pressed swatch, not the one that moved in");
}
#[test]
fn a_click_released_in_another_document_leaves_its_fill() {
let mut app = app();
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
app.run("swatch.new", json!({"name": "Strip Green", "color": "#22aa44", "global": true})).unwrap();
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap();
let mut panel = Panel::new(app, show);
let at = panel.rect("Strip Green").center();
let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Modifiers::NONE };
panel.frame_with(vec![egui::Event::PointerMoved(at)]);
panel.frame_with(vec![button(true)]);
assert!(panel.app().session.set_active(0), "the first document becomes active");
panel.frame();
let before = paints(&panel).0;
panel.frame_with(vec![button(false)]);
panel.frame();
assert_eq!(paints(&panel).0, before, "a press in one document and a release in another set nothing");
}
#[test]
fn a_right_click_in_the_frame_the_strip_remeasures_still_sets_the_stroke() {
let mut panel = Panel::new(app(), show);
@@ -274,6 +358,14 @@ mod tests {
panel.frame_with(vec![button(false)]);
panel.frame();
assert_eq!(swatch_of(&paints(&panel).1).as_deref(), Some("Strip Green"), "the shown strip's right-click sets the stroke");
let steps = |panel: &Panel| panel.app().session.active().map_or(0, |st| st.history.undo.len());
let before = steps(&panel);
panel.focus("Strip Blue");
panel.key(egui::Key::F10, Modifiers::SHIFT);
panel.frame();
assert_eq!(swatch_of(&paints(&panel).1).as_deref(), Some("Strip Blue"), "Shift+F10 on the shown strip sets the stroke");
assert_eq!(steps(&panel), before + 1, "the sizing pass and the shown strip set it once between them");
}
thread_local! {
@@ -334,6 +426,16 @@ mod tests {
assert!(!panel.shows("Strip Ramp"), "a gradient swatch has none");
}
#[test]
fn two_swatches_with_one_name_keep_a_chip_each() {
let mut app = app();
let st = app.session.doc_mut().expect("a document");
let green = std::sync::Arc::make_mut(&mut st.doc).swatch_mut("Strip Green").expect("the green swatch");
green.name = "Strip Red".to_owned();
let panel = Panel::new(app, show);
assert_eq!(panel.count_named("Strip Red"), 2, "each of the two swatches named Strip Red has a control of its own");
}
#[test]
fn the_chips_run_along_a_wide_strip_and_wrap_down_a_narrow_one() {
let mut panel = Panel::new(app(), show);
+111 -3
View File
@@ -92,7 +92,7 @@ fn the_edit_target_is_reused_until_the_document_or_selection_changes() {
app.run("select.set", json!({"ids": [ids[0].0, blend.0, ids[1].0]})).unwrap();
(ids, blend)
};
let resolved = |app: &VectorcraftApp| edit_target(app, &ctx).unwrap().2;
let resolved = |app: &VectorcraftApp| edit_target(app, &ctx).unwrap().1;
let (ids, blend) = art(&mut app);
let first = resolved(&app);
assert_eq!(*first, vec![(ids[0], Some(blend)), (blend, Some(blend)), (ids[1], Some(blend))]);
@@ -149,14 +149,17 @@ fn the_edit_target_is_reused_until_the_document_or_selection_changes() {
assert!(!Arc::ptr_eq(&whole, &reverted), "the key is resolved for the new document state after reverting");
assert!(Arc::ptr_eq(&reverted, &resolved(&app)));
// Another document uses the same ids, revision, revert count and selection.
// Another document uses the same ids, revision, revert, history restore and rollback counts and selection.
let st = app.session.active().unwrap();
let (revision, reverts, selection) = (st.revision, st.reverts, st.selection.objects.clone());
let (revision, reverts, restores, rollbacks, selection) =
(st.revision, st.reverts, st.history_restores, st.rollbacks, st.selection.objects.clone());
let (other_ids, other_blend) = art(&mut app);
assert_eq!((other_ids, other_blend), (ids, blend));
let st = app.session.active_mut().unwrap();
st.revision = revision;
st.reverts = reverts;
st.history_restores = restores;
st.rollbacks = rollbacks;
st.selection.objects = selection;
let other_document = resolved(&app);
assert!(!Arc::ptr_eq(&reverted, &other_document), "the key is resolved for the new document state in another document");
@@ -806,3 +809,108 @@ fn an_unfinished_steps_value_is_dropped_by_file_revert() {
p.key(Key::Enter, Modifiers::NONE);
assert_eq!(spec(&p.app(), id).spacing, BlendSpacing::Steps(1), "Revert drops the unfinished value");
}
#[test]
fn an_unfinished_steps_value_does_not_reach_a_blend_that_takes_a_canceled_groups_blend_id() {
use craft::ui::contract::Role;
use egui::{Key, Modifiers};
let blend = |app: &mut VectorcraftApp| {
let ids: Vec<Value> =
[0, 200].map(|x| app.run("shape.rectangle", json!({"x": x, "y": 0, "width": 20, "height": 20})).unwrap()["id"].clone()).into();
app.run("select.set", json!({"ids": ids})).unwrap();
let id = app.run("object.blend.make", json!({"spacing": "steps", "steps": 5})).unwrap()["id"].clone();
app.run("select.set", json!({"ids": [id]})).unwrap();
NodeId(id.as_u64().unwrap())
};
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
app.run("edit.undoGroup.begin", json!({})).unwrap();
let first = blend(&mut app);
let mut p = Panel::new(app, show);
p.click_role("Steps:", Role::SPIN_BUTTON);
p.key(Key::A, Modifiers::COMMAND);
p.type_text("3+");
// Canceling the group removes the blend; the same art made again gives a blend with its id and steps.
p.app().run("edit.undoGroup.end", json!({"cancel": true})).unwrap();
let second = blend(&mut p.app());
assert_eq!(second, first, "the new blend takes the canceled group's blend's node ID");
p.frame();
p.type_text("1");
p.key(Key::Enter, Modifiers::NONE);
assert_eq!(spec(&p.app(), second).spacing, BlendSpacing::Steps(1), "the new blend takes 1 step, not 3+1");
}
#[test]
fn an_unfinished_steps_value_does_not_reach_a_blend_that_takes_a_canceled_previews_blend_id() {
use craft::ui::contract::Role;
use egui::{Key, Modifiers};
let mut app = app();
let params = json!({"spacing": "steps", "steps": 5});
app.session.begin_interaction("Blend").unwrap();
let first = NodeId(app.session.preview("object.blend.make", &params).unwrap()["id"].as_u64().unwrap());
let mut p = Panel::new(app, show);
p.click_role("Steps:", Role::SPIN_BUTTON);
p.key(Key::A, Modifiers::COMMAND);
p.type_text("3+");
// Canceling the preview restores the selected rectangles and frees the blend's node ID without a history restore.
{
let mut app = p.app();
let st = app.session.active().unwrap();
let (rollbacks, restores) = (st.rollbacks, st.history_restores);
app.session.cancel_interaction().unwrap();
let st = app.session.active().unwrap();
assert!(st.rollbacks > rollbacks, "canceling the preview advances the rollback count");
assert_eq!(st.history_restores, restores, "canceling the preview leaves the history restore count unchanged");
}
let second = NodeId(p.app().run("object.blend.make", params).unwrap()["id"].as_u64().unwrap());
assert_eq!(second, first, "the new blend takes the canceled preview's blend's node ID");
p.app().run("select.set", json!({"ids": [second.0]})).unwrap();
p.frame();
p.type_text("1");
p.key(Key::Enter, Modifiers::NONE);
assert_eq!(spec(&p.app(), second).spacing, BlendSpacing::Steps(1), "the new blend takes 1 step, not 3+1");
}
#[test]
fn an_unfinished_steps_ramp_or_shift_value_is_dropped_by_undo_and_redo() {
use craft::ui::contract::Role;
use egui::{Key, Modifiers};
let (mut app, id) = pathed();
let reset = json!({"spacing": "steps", "steps": 5, "ramp": 30, "colorShift": 30});
app.run("object.blend.options", reset.clone()).unwrap();
let mut p = Panel::new(app, show);
for name in ["Steps:", "Ramp:", "Shift:"] {
let value = |s: &BlendSpec| match name {
"Steps:" => match s.spacing {
BlendSpacing::Steps(n) => f64::from(n),
_ => f64::NAN,
},
"Ramp:" => s.ease.ramp * 100.0,
_ => s.color_shift,
};
for cmd in ["edit.undo", "edit.redo"] {
// A change elsewhere for Undo or Redo to replace, leaving the blend as it is.
p.app().run("shape.rectangle", json!({"x": 100, "y": 200, "width": 20, "height": 20})).unwrap();
if cmd == "edit.redo" {
p.app().run("edit.undo", json!({})).unwrap();
}
p.app().run("select.set", json!({"ids": [id.0]})).unwrap();
p.frame();
p.click_role(name, Role::SPIN_BUTTON);
p.key(Key::A, Modifiers::COMMAND);
p.type_text("3+");
// The restored document has the same blend and, selected again, the same selection.
p.app().run(cmd, json!({})).unwrap();
p.app().run("select.set", json!({"ids": [id.0]})).unwrap();
p.frame();
p.type_text("1");
p.key(Key::Enter, Modifiers::NONE);
let at = value(&spec(&p.app(), id));
assert!((at - 1.0).abs() < 1e-9, "{name}: {cmd} drops the unfinished value, so the blend takes 1, not 3+1: {at}");
p.app().run("object.blend.options", reset.clone()).unwrap();
}
}
}
+63
View File
@@ -184,6 +184,27 @@ pub struct Pending {
pub(crate) started: f64,
/// What stays alive until this entry is removed ([`Placing::keep_next`]).
_keep: Option<Box<dyn std::any::Any + Send>>,
/// The selection its document gets back when the file is not placed ([`Placing::select_on_failure`]).
select_on_failure: Option<Reselect>,
}
/// The user's selection, which a Replace swapped for the object it replaces ([`Placing::select_on_failure`]).
#[derive(Clone)]
pub(crate) struct Reselect {
/// The document whose selection Replace changed.
pub(crate) doc: u64,
/// The selection Replace made: the object it swaps.
pub(crate) swapped: vectorcraft_doc::Selection,
/// The document's selection count ([`vectorcraft_engine::DocState::selections`]) after it.
/// The user's selection comes back only while neither changed, whatever else was edited.
pub(crate) selections: u64,
/// The art then: the user's selection comes back only while each object it holds is as it
/// was, so that its selected anchors and segments still name the same points.
pub(crate) art: std::sync::Arc<vectorcraft_doc::Document>,
/// The group or layer isolated then: the user's selection comes back only in the same isolation.
pub(crate) isolation: Option<vectorcraft_doc::NodeId>,
/// The user's selection before it.
pub(crate) user: vectorcraft_doc::Selection,
}
#[cfg(test)]
@@ -202,6 +223,10 @@ pub struct Placing {
/// dropped: the conversion of a DWG drawing placed through its import options, which the read
/// then finds without converting the drawing again.
pub(crate) keep_next: Option<Box<dyn std::any::Any + Send>>,
/// The selection the next read started ([`spawn_labeled`]) gives its document back when its
/// file is not placed: the user's selection before a DWG drawing's Replace selected the object
/// it swaps again.
pub(crate) select_on_failure: Option<Reselect>,
/// The path and the bytes of a drawing placed through its import options: the next place of
/// that path ([`crate::place::run_for_user`]) places these bytes, the ones the dialog showed,
/// instead of reading the file again.
@@ -447,6 +472,7 @@ fn spawn_labeled(
app.placing.lane.push(&*jobs, "vectorcraft-place", job);
let started = crate::export_progress::now(app);
let keep = app.placing.keep_next.take();
let select_on_failure = app.placing.select_on_failure.take();
app.placing.pending.push(Pending {
name,
label: label.clone(),
@@ -461,6 +487,7 @@ fn spawn_labeled(
hidden: false,
started,
_keep: keep,
select_on_failure,
});
let status = format!("{label}…");
app.status(status.clone());
@@ -574,6 +601,11 @@ fn finish(app: &mut VectorcraftApp, p: &Pending, r: Result<Read, String>) {
Ok(Read::Paste(paste)) => return finish_paste(app, *paste),
Err(e) => Err(e),
};
if r.is_err()
&& let Some(back) = &p.select_on_failure
{
reselect(app, back);
}
app.sync_views();
let name = &p.name;
match r {
@@ -583,6 +615,32 @@ fn finish(app: &mut VectorcraftApp, p: &Pending, r: Result<Read, String>) {
}
}
/// Restore the user's selection while the selection Replace made is unchanged and the user's objects
/// are still there as they were. The whole selection, guides, slices and new art included, goes through the selection filters as
/// they are now, and the current layer and active document stay current.
pub(crate) fn reselect(app: &mut VectorcraftApp, back: &Reselect) {
let Some(st) = app.session.documents().iter().find(|st| st.uid == back.doc) else { return };
let kept = |id: &vectorcraft_doc::NodeId| st.doc.node(*id).is_some_and(|n| back.art.node(*id) == Some(n));
// A symbol part names a child of the symbol's art, which an edit to the symbol can change.
let part_kept = back.user.symbol_part.is_none() || std::sync::Arc::ptr_eq(&st.doc, &back.art);
if st.selections != back.selections
|| st.selection != back.swapped
|| st.isolation != back.isolation
|| !part_kept
|| !back.user.objects.iter().all(kept)
{
return;
}
let layer = st.active_layer;
if let Err(e) = app.session.restore_selection(back.doc, back.user.clone()) {
app.status(e.to_string());
return;
}
if let Some(st) = app.session.document_mut(back.doc) {
st.active_layer = layer;
}
}
/// Run a paste whose bitmap was decoded off the UI thread, in its document, which is the active one:
/// the image replaces the internal clipboard, the objects selected when the paste started are
/// selected again, and the paste command runs as it runs at once ([`VectorcraftApp::run`]), into
@@ -861,6 +919,11 @@ pub fn cancel_all(app: &mut VectorcraftApp) -> Value {
if !app.placing.pending[i].paste {
let p = app.placing.pending.remove(i);
p.token.cancel();
if let Some(back) = &p.select_on_failure
&& app.session.documents().iter().any(|st| st.uid == p.doc && st.reverts == p.reverts)
{
reselect(app, back);
}
if app.ui.status == format!("{}…", p.label) {
app.ui.status.clear();
}
+333
View File
@@ -2060,3 +2060,336 @@ fn cancelling_a_place_places_nothing() {
assert_eq!(names(&app), initial_names, "no document nodes mutated or added");
assert_eq!(app.session.doc().unwrap().history.undo.len(), 0, "no undo step added");
}
/// The selection a failed Replace gives back, after the object it swaps was selected in its place.
fn swapped_out(app: &mut VectorcraftApp, other: NodeId) -> Reselect {
let user = app.session.doc().unwrap().selection.clone();
app.run("select.set", json!({"ids": [other.0]})).unwrap();
let st = app.session.doc().unwrap();
Reselect { doc: st.uid, swapped: st.selection.clone(), selections: st.selections, art: st.doc.clone(), isolation: st.isolation, user }
}
/// Restore `back`, then check that the journal entries the restore added select the same again
/// when they are run after the swapped object is selected.
fn reselect_and_replay(app: &mut VectorcraftApp, back: &Reselect, other: NodeId) {
let from = app.session.journal.len();
reselect(app, back);
let restored = app.session.doc().unwrap().selection.clone();
let steps: Vec<(String, serde_json::Value)> = app.session.journal.since(from).to_vec();
assert!(!steps.is_empty(), "the journal records the restored selection");
app.run("select.set", json!({"ids": [other.0]})).unwrap();
for (id, p) in steps {
app.run(&id, p).unwrap();
}
assert_eq!(app.session.doc().unwrap().selection, restored, "the journal replays the restored selection");
}
#[test]
fn a_restored_segment_selection_replays_as_segments() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
app.run("select.segments", json!({"id": mine.0, "segments": [[0, 1]]})).unwrap();
assert!(!app.session.doc().unwrap().selection.segments.is_empty());
let back = swapped_out(&mut app, other);
reselect_and_replay(&mut app, &back, other);
assert!(app.session.doc().unwrap().selection.segments.contains_key(&mine), "the segment is selected again");
}
#[test]
fn a_restore_inside_a_canceled_undo_group_leaves_the_journal() {
let mut app = app(false);
let (_, other) = two_rectangles(&mut app);
let before = app.session.journal.len();
app.run("edit.undoGroup.begin", json!({})).unwrap();
let made = NodeId(app.run("shape.rectangle", json!({"x": 120, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap());
app.run("select.set", json!({"ids": [made.0]})).unwrap();
let back = swapped_out(&mut app, other);
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![made]);
let last = app.session.journal.last().cloned().unwrap();
assert_eq!(last, ("select.set".to_string(), json!({"ids": [made.0]})), "the restore is journaled");
app.run("edit.undoGroup.end", json!({"cancel": true})).unwrap();
let left: Vec<&str> = app.session.journal.since(before).iter().map(|(id, _)| id.as_str()).collect();
assert!(!left.iter().any(|id| *id == "select.set" || *id == "shape.rectangle"), "{left:?}");
}
#[test]
fn a_restored_selection_is_journaled_and_brings_its_paints_back() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
app.run("paint.setFill", json!({"ids": [mine.0], "color": "#ff0000"})).unwrap();
app.run("paint.setFill", json!({"ids": [other.0], "color": "#0000ff"})).unwrap();
// Selecting the red rectangle loads its paints for new art.
app.run("select.none", json!({})).unwrap();
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
let red = app.session.paint.clone();
let back = swapped_out(&mut app, other);
assert_ne!(app.session.paint, red, "selecting the swapped object loads its paints");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![mine]);
assert_eq!(app.session.paint, red, "the restored selection's paints are the paints for new art");
let last = app.session.journal.last().cloned().unwrap();
assert_eq!(last, ("select.set".to_string(), json!({"ids": [mine.0]})), "the journal records the restored selection");
// Replayed, the journal leaves the same paints for new art.
app.run("select.set", json!({"ids": [other.0]})).unwrap();
app.run(&last.0, last.1).unwrap();
assert_eq!(app.session.paint, red, "the replay loads the same paints");
}
#[test]
fn a_restored_selection_gives_new_art_its_appearance_with_basic_appearance_off() {
let mut app = app(false);
app.session.prefs.new_art_basic = false;
let (mine, other) = two_rectangles(&mut app);
app.run("paint.setFill", json!({"ids": [mine.0], "color": "#ff0000"})).unwrap();
app.run("paint.setFill", json!({"ids": [other.0], "color": "#0000ff"})).unwrap();
app.run("select.none", json!({})).unwrap();
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
let red = app.session.paint.clone();
let back = swapped_out(&mut app, other);
assert_ne!(app.session.paint, red, "new art takes the swapped object's appearance");
reselect(&mut app, &back);
assert_eq!(app.session.paint, red, "new art takes the restored object's appearance again");
}
#[test]
fn a_restore_after_a_defaults_only_paint_gives_new_art_the_restored_appearance() {
let mut app = app(false);
app.session.prefs.new_art_basic = false;
let (mine, other) = two_rectangles(&mut app);
app.run("paint.setFill", json!({"ids": [mine.0], "color": "#ff0000"})).unwrap();
app.run("paint.setFill", json!({"ids": [other.0], "color": "#0000ff"})).unwrap();
app.run("select.set", json!({"ids": [mine.0, other.0]})).unwrap();
let back = swapped_out(&mut app, mine);
let red = app.session.paint.clone();
app.run("paint.setFill", json!({"color": "#00ff00", "defaultsOnly": true})).unwrap();
assert_ne!(app.session.paint, red, "the defaults-only paint changes the defaults");
let from = app.session.journal.len();
reselect(&mut app, &back);
assert_eq!(app.session.paint, red, "new art takes the restored selection's appearance");
// Replayed after the same defaults-only paint, the journal leaves the same defaults.
let steps: Vec<(String, serde_json::Value)> = app.session.journal.since(from).to_vec();
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
app.run("paint.setFill", json!({"color": "#00ff00", "defaultsOnly": true})).unwrap();
for (id, p) in steps {
app.run(&id, p).unwrap();
}
assert_eq!(app.session.paint, red, "the replay gives new art the same appearance");
}
#[test]
fn a_restored_symbol_part_leaves_the_paints_as_its_replay_does() {
let mut app = app(false);
let rect = |app: &mut VectorcraftApp, x: i32, color: &str| {
let id = app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap();
app.run("paint.setFill", json!({"ids": [id], "color": color})).unwrap();
id
};
let (left, right) = (rect(&mut app, 10, "#ff0000"), rect(&mut app, 40, "#00ff00"));
let other = NodeId(rect(&mut app, 120, "#0000ff"));
let instance = app.run("symbol.new", json!({"type": "dynamic", "ids": [left, right]})).unwrap()["id"].as_u64().unwrap();
app.run("symbol.instance.selectPart", json!({"id": instance, "path": [0]})).unwrap();
let back = swapped_out(&mut app, other);
let blue = app.session.paint.clone();
let from = app.session.journal.len();
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.symbol_part.as_ref().map(|p| p.path.clone()), Some(vec![0]));
// `symbol.instance.selectPart` keeps the paints for new art, and so does the restore.
assert_eq!(app.session.paint, blue, "the restored part keeps the paints for new art");
let steps: Vec<(String, serde_json::Value)> = app.session.journal.since(from).to_vec();
assert!(steps.iter().any(|(id, _)| id == "symbol.instance.selectPart"), "{steps:?}");
app.run("select.set", json!({"ids": [other.0]})).unwrap();
for (id, p) in steps {
app.run(&id, p).unwrap();
}
assert_eq!(app.session.paint, blue, "the replay leaves the same paints");
}
/// The objects selected before the swap, with two rectangles drawn: the user's and the swapped one.
fn two_rectangles(app: &mut VectorcraftApp) -> (NodeId, NodeId) {
let mut rect = |x| NodeId(app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap());
let (mine, other) = (rect(10.0), rect(60.0));
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
(mine, other)
}
#[test]
fn a_raised_revision_alone_does_not_block_the_restore() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
let back = swapped_out(&mut app, other);
// The rollback of a failed Replace puts the document back as it was and raises its revision
// (`Session::place_read`), which this does alone.
let uid = app.session.doc().unwrap().uid;
app.session.document_mut(uid).unwrap().revision += 1;
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![mine], "the user's selection comes back");
}
#[test]
fn a_selection_undo_and_redo_gave_back_is_kept() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
app.run("select.set", json!({"ids": [other.0]})).unwrap();
app.run("artboard.setProps", json!({"index": 0, "name": "Front"})).unwrap();
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
let back = swapped_out(&mut app, other);
app.run("edit.undo", json!({})).unwrap();
app.run("edit.redo", json!({})).unwrap();
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "Redo selects the object again");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the selection Redo gave back is kept");
}
#[test]
fn a_selection_isolation_gave_back_is_kept() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap());
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
let back = swapped_out(&mut app, group);
app.run("object.isolate", json!({"id": group.0})).unwrap();
app.run("object.exitIsolation", json!({})).unwrap();
assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "leaving isolation selects the group again");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "the selection leaving isolation made is kept");
}
#[test]
fn a_selection_a_batch_step_gave_back_is_kept() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap());
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
let back = swapped_out(&mut app, group);
let steps = json!([{"command": "object.isolate", "params": {"id": group.0}}, {"command": "object.exitIsolation"}]);
app.run("command.batch", json!({"commands": steps})).unwrap();
assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "leaving isolation selects the group again");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "the selection the batch made is kept");
}
#[test]
fn leaving_isolation_onto_the_swapped_group_keeps_it_selected() {
let mut app = app(false);
let (_, other) = two_rectangles(&mut app);
let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap());
app.run("object.isolate", json!({"id": group.0})).unwrap();
app.run("select.set", json!({"ids": [other.0]})).unwrap();
let back = swapped_out(&mut app, group);
app.run("object.exitIsolation", json!({})).unwrap();
assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "leaving isolation selects the group");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![group], "the selection leaving isolation made is kept");
}
#[test]
fn a_selection_a_lock_and_unlock_batch_gave_back_is_kept() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
app.run("select.set", json!({"ids": [mine.0]})).unwrap();
let back = swapped_out(&mut app, other);
let steps = json!([{"command": "object.lock"}, {"command": "object.unlockAll"}]);
app.run("command.batch", json!({"commands": steps})).unwrap();
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "Unlock All selects what it unlocks");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the selection the batch made is kept");
}
#[test]
fn a_selection_is_not_restored_into_another_isolation() {
let mut app = app(false);
let (_, other) = two_rectangles(&mut app);
let group = NodeId(app.run("object.group", json!({ "ids": [other.0] })).unwrap()["id"].as_u64().unwrap());
app.run("select.set", json!({"ids": []})).unwrap();
let mut back = swapped_out(&mut app, group);
app.run("object.isolate", json!({"id": group.0})).unwrap();
app.run("select.set", json!({"ids": [group.0]})).unwrap();
let st = app.session.doc().unwrap();
(back.swapped, back.selections) = (st.selection.clone(), st.selections);
let selected = st.selection.objects.clone();
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, selected, "the selection made in isolation is kept");
}
#[test]
fn a_command_that_fails_and_puts_the_selection_back_does_not_block_the_restore() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
let back = swapped_out(&mut app, other);
let far = NodeId(app.run("shape.rectangle", json!({"x": 300, "y": 300, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap());
app.run("select.set", json!({"ids": [other.0]})).unwrap();
let mut back = back;
let st = app.session.doc().unwrap();
(back.swapped, back.selections, back.art) = (st.selection.clone(), st.selections, st.doc.clone());
assert!(app.run("object.pathfinder.intersect", json!({"ids": [other.0, far.0]})).is_err(), "disjoint shapes have no intersection");
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the failed command puts the selection back");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![mine], "the user's selection comes back");
}
#[test]
fn a_symbol_part_is_not_restored_after_an_edit() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
let mut back = swapped_out(&mut app, other);
back.user.symbol_part = Some(vectorcraft_doc::SymbolPart { instance: mine, path: vec![0] });
app.run("artboard.setProps", json!({"index": 0, "name": "Front"})).unwrap();
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "a part of art that may have changed is not restored");
}
#[test]
fn selected_anchors_of_a_reversed_path_are_not_restored() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
app.run("select.anchors", json!({"id": mine.0, "anchors": [[0, 0]], "mode": "set"})).unwrap();
let back = swapped_out(&mut app, other);
app.run("path.reverse", json!({"ids": [mine.0], "reversed": true})).unwrap();
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the edit keeps the selection");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "anchor numbers of the edited path are not restored");
}
#[test]
fn an_edit_that_keeps_the_selection_still_restores_it() {
let mut app = app(false);
let (mine, other) = two_rectangles(&mut app);
let back = swapped_out(&mut app, other);
let revision = app.session.doc().unwrap().revision;
app.run("artboard.setProps", json!({"index": 0, "name": "Front"})).unwrap();
assert_ne!(app.session.doc().unwrap().revision, revision, "the edit changes the document");
assert_eq!(app.session.doc().unwrap().selection.objects, vec![other], "the edit keeps the selection");
reselect(&mut app, &back);
assert_eq!(app.session.doc().unwrap().selection.objects, vec![mine], "the user's selection comes back");
}
#[test]
fn a_restored_selection_leaves_out_guides_locked_since() {
let mut app = app(false);
let other = NodeId(app.run("shape.rectangle", json!({"x": 60, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap());
app.run("guide.add", json!({"vertical": true, "pos": 40})).unwrap();
app.run("select.set", json!({"ids": []})).unwrap();
app.run("guide.select", json!({"indexes": [0]})).unwrap();
assert_eq!(app.session.doc().unwrap().selection.guides.len(), 1, "the ruler guide is selected");
let mut back = swapped_out(&mut app, other);
app.run("view.guides.lock", json!({"locked": true})).unwrap();
let st = app.session.doc().unwrap();
(back.swapped, back.selections) = (st.selection.clone(), st.selections);
reselect(&mut app, &back);
assert!(app.session.doc().unwrap().selection.guides.is_empty(), "the locked guide is not selected again");
}
#[test]
fn a_restored_selection_keeps_new_art_on_a_locked_artboard() {
let mut app = app(false);
app.run("artboard.setProps", json!({"index": 0, "locked": true})).unwrap();
let mut rect = |x| NodeId(app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap());
let (other, drawn) = (rect(60.0), rect(10.0));
assert_eq!(app.session.doc().unwrap().selection.objects, vec![drawn], "new art is selected");
let back = swapped_out(&mut app, other);
reselect(&mut app, &back);
let st = app.session.doc().unwrap();
assert_eq!(st.selection.objects, vec![drawn], "the new art is selected again");
assert!(st.selection.new_art.contains(&drawn), "it is still new art");
}
+26
View File
@@ -307,6 +307,27 @@ impl Panel {
self.after();
}
/// Whether the control named `name` offers a screen reader its context menu (AccessKit `ShowContextMenu`).
pub(crate) fn offers_context_menu(&mut self, name: &str) -> bool {
let target = self.find(name);
let id = egui::accesskit::NodeId(target.node.raw());
let tree = self.fixture.tree();
tree.update().nodes.iter().any(|(node, n)| *node == id && n.supports_action(egui::accesskit::Action::ShowContextMenu))
}
/// A screen reader's `ShowContextMenu` on the control named `name`.
pub(crate) fn show_context_menu(&mut self, name: &str) {
let target = self.find(name);
let request = egui::accesskit::ActionRequest {
action: egui::accesskit::Action::ShowContextMenu,
target_tree: egui::accesskit::TreeId::ROOT,
target_node: egui::accesskit::NodeId(target.node.raw()),
data: None,
};
self.frame_with(vec![Event::AccessKitActionRequest(request)]);
self.after();
}
/// Turns the wheel by `dy` points over `at`.
pub(crate) fn scroll_at(&mut self, at: Pos2, dy: f32) {
self.frame_with(vec![Event::PointerMoved(at)]);
@@ -385,6 +406,11 @@ impl Panel {
self.fixture.advance(seconds);
}
/// How many nodes the latest frame shows named `name`.
pub(crate) fn count_named(&self, name: &str) -> usize {
self.names().iter().filter(|n| *n == name).count()
}
/// Whether the latest frame shows a control named `name`.
pub(crate) fn shows(&self, name: &str) -> bool {
self.fixture.by_label(name).is_some()
+6 -3
View File
@@ -199,7 +199,9 @@ or point selected, it paints the inactive Fill or Stroke.
Freeform gradients: double-clicking a point with the Gradient tool opens the same `gradientStop` popover on the selected
point (`paint.freeform.selectPoint`); its fields are `color` (hex), `opacity` and `spread` (percentages), applied by
`ui.dialog.confirm` through `paint.freeform.setPoint`. `ui.key` Escape ends the line Lines mode is drawing.
`ui.dialog.confirm` through `paint.freeform.setPoint`. Its eyedropper chooses the Eyedropper tool and sets the
`freeformPoint` option to the tool to return to. The next click on art samples its color into the same point if it
is still current. Escape cancels a pick and switches back. When drawing a line, `ui.key` Escape ends that line.
Tool options: double-clicking a tool button runs `tool.options {tool}`. For `gradient` it opens the Gradient panel;
for `eyedropper` it opens Eyedropper Options, an `eyedropperOptions` dialog (fields `sampleSize` 1/3/5, `pickUp` and
@@ -293,8 +295,9 @@ Swatch Strip panel (`window.panel {panel: "swatchStrip"}`): a None chip, then th
swatches outside any color group, then each group's; gradient and pattern swatches are left out), in a row of chips
that wraps to the panel's room and scrolls when they do not fit. `window.panel.dock {panel: "swatchStrip", anchor:
"canvas", placement: {"Edge": "Bottom"}}` docks it along the window's bottom edge, where the chips run across in one
line. A click on a chip runs `paint.setFill {swatch}` (`{none: true}` for None) and a right-click or an Alt-click
runs `paint.setStroke`, both with `focus: false`, so the active proxy stays as it was.
line. A click on a chip runs `paint.setFill {swatch}` (`{none: true}` for None) and a right-click, an Alt-click,
Shift+F10 (or the Menu key off macOS) on the focused chip, or a screen reader's context menu action runs `paint.setStroke`, both
with `focus: false`, so the active proxy stays as it was.
Color Themes panel (`window.panel {panel: "colorThemes"}`): its Create tab makes a theme on a harmony wheel and its
My Themes tab lists the saved themes; every action runs a command (`colorTheme.save`, `colorTheme.delete`,
+6 -2
View File
@@ -141,8 +141,12 @@ private editing data. VectorCraft:
shape of their own, instances of symbols with 9-slice guides or pattern paint, instances in pattern tiles or in art cut to a clipping object,
instances scaled almost flat, instances that turn, mirror or scale symbols holding type, live objects,
instances written as their art, shapes with rounded live corners or strokes written as outlines or brush art,
instances that scale their symbol more than 100 times and instances on the layers of a large canvas are written as their art, pattern fills in a
symbol's art are written as their tiles cut to the shape, symbols past 4,096 are written only as their
instances that scale their symbol more than 100 times and instances on the layers of a large canvas are written as their art. Pattern fills in
large-canvas symbol art are written as their tiles cut to the shape. On normal canvases, supported pattern
fills in symbol definitions retain the shared pattern resource and their affine; VectorCraft declares that
coordinate convention in its own dictionary entry, while unmarked foreign symbol patterns keep the reader's
conservative fallback. Tile fallback transforms stroke outlines with the full pattern affine, including
strokes in opacity masks. Symbols past 4,096 are written only as their
instances' art, and symbols' 9-slice guides and export types are left out, each with a
warning. A dynamic symbol instance whose only changes of its own are its parts' changes is not written as its
art when it otherwise qualifies: it stays a live instance. The symbol's dynamic type and the instance's changes
+1 -1
View File
@@ -5,7 +5,7 @@ use std::process::Command;
use serde_json::Value;
const REV: &str = "f9e5cecc9cf1b701b22f6f24a88719b14456323e";
const REV: &str = "138ce9929ea48d055c797f61c042a3c407427d97";
const PACKAGES: &[(&str, &str, &str)] = &[
("craft-pdf", "0.1.0", REV),
("krilla", "0.8.2", REV),