mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 21:12:57 -05:00
Merge main into feat/scripts-show-color-picker
This commit is contained in:
commit
aedd5ce1cb
84 files changed
+2984
-463
No files matched your search
Generated
+110
-99
@@ -1134,7 +1134,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-automation",
|
||||
"craft-behavior",
|
||||
@@ -1175,7 +1175,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-affinity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
@@ -1186,7 +1186,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-appkit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"objc2-app-kit 0.3.2",
|
||||
@@ -1196,7 +1196,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-atomic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"rustix 1.1.6",
|
||||
]
|
||||
@@ -1204,7 +1204,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-automation"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"craft-behavior",
|
||||
@@ -1229,7 +1229,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-behavior"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"bitflags 2.13.2",
|
||||
@@ -1247,7 +1247,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-browse"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-docpath",
|
||||
@@ -1265,7 +1265,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cdr"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
@@ -1274,7 +1274,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cloud-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"egui",
|
||||
]
|
||||
@@ -1282,7 +1282,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cms"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"md-5",
|
||||
"rayon",
|
||||
@@ -1291,12 +1291,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-codepage"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
|
||||
[[package]]
|
||||
name = "craft-color-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-cms",
|
||||
@@ -1316,7 +1316,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-control"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
"serde",
|
||||
@@ -1326,7 +1326,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dds"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"rayon",
|
||||
]
|
||||
@@ -1334,7 +1334,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dialogs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"craft-atomic",
|
||||
@@ -1359,7 +1359,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-docpath"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1367,7 +1367,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-draw"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-color-ui",
|
||||
@@ -1386,7 +1386,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dxf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-codepage",
|
||||
"encoding_rs",
|
||||
@@ -1398,12 +1398,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-eps"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
|
||||
[[package]]
|
||||
name = "craft-font-catalog"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"fontique",
|
||||
"harfrust 0.13.3",
|
||||
@@ -1418,7 +1418,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-manager"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-font-catalog",
|
||||
@@ -1431,13 +1431,13 @@ dependencies = [
|
||||
"egui",
|
||||
"log",
|
||||
"serde",
|
||||
"skrifa 0.44.0",
|
||||
"skrifa 0.47.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-font-store"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"cap-primitives",
|
||||
"craft-atomic",
|
||||
@@ -1453,17 +1453,18 @@ dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
"toml",
|
||||
"ureq",
|
||||
"wuff",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-fonts-build"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
|
||||
[[package]]
|
||||
name = "craft-gif"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"gif",
|
||||
]
|
||||
@@ -1471,7 +1472,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-gzip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
]
|
||||
@@ -1479,7 +1480,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-host"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"craft-i18n",
|
||||
@@ -1492,7 +1493,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-i18n"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"fixed_decimal",
|
||||
@@ -1520,7 +1521,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-image-codecs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-dds",
|
||||
"craft-jpeg",
|
||||
@@ -1547,7 +1548,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-imaging"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-color-ui",
|
||||
@@ -1565,7 +1566,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-jpeg"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
@@ -1573,7 +1574,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-jxl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"brotli-decompressor 5.0.3",
|
||||
"jixel",
|
||||
@@ -1584,7 +1585,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-keymap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-host",
|
||||
"craft-i18n",
|
||||
@@ -1599,7 +1600,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-layers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-i18n",
|
||||
@@ -1613,7 +1614,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-menu"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -1631,7 +1632,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-metadata"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"brotli-decompressor 6.3.2",
|
||||
"chrono",
|
||||
@@ -1643,7 +1644,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-metafile"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"image",
|
||||
@@ -1654,7 +1655,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-mime"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"craft-codepage",
|
||||
@@ -1664,7 +1665,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pages"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -1680,7 +1681,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pdf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"hayro-interpret",
|
||||
"hayro-syntax",
|
||||
@@ -1692,7 +1693,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-platform"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-io",
|
||||
@@ -1723,7 +1724,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-plotter"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"kurbo 0.13.1",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1732,7 +1733,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-print"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -1756,7 +1757,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-proof"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"log",
|
||||
"miniz_oxide 0.9.1",
|
||||
@@ -1767,7 +1768,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ps"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-eps",
|
||||
"flate2",
|
||||
@@ -1781,7 +1782,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-psd"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"flate2",
|
||||
@@ -1792,7 +1793,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-quit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"dispatch2",
|
||||
"egui",
|
||||
@@ -1805,7 +1806,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-review"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"craft-behavior",
|
||||
@@ -1824,7 +1825,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-settings"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"craft-host",
|
||||
@@ -1841,7 +1842,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-stream-codecs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"fax",
|
||||
"hayro-ccitt",
|
||||
@@ -1852,7 +1853,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-svg"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-image-codecs",
|
||||
"craft-xml",
|
||||
@@ -1873,7 +1874,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-table"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -1885,7 +1886,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-text"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-font-manager",
|
||||
@@ -1910,7 +1911,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-theme"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"craft-tracked",
|
||||
@@ -1925,7 +1926,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-theme-store"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"craft-behavior",
|
||||
@@ -1940,7 +1941,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-tiff"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1950,7 +1951,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-time"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1959,7 +1960,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-timeline"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -1974,12 +1975,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-tracked"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
|
||||
[[package]]
|
||||
name = "craft-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-cloud-ui",
|
||||
"craft-ui-canvas",
|
||||
@@ -1993,7 +1994,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-canvas"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-i18n",
|
||||
@@ -2009,7 +2010,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-contract"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"craft-behavior",
|
||||
@@ -2047,7 +2048,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-macros"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
@@ -2058,7 +2059,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-panels"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2076,7 +2077,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-patterns"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2097,7 +2098,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-shell"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2118,7 +2119,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-widgets"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2137,7 +2138,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-update"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"craft-host",
|
||||
@@ -2166,7 +2167,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-vectorcraft-format"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"serde",
|
||||
@@ -2177,7 +2178,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-wayland"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"raw-window-handle",
|
||||
"wayland-backend",
|
||||
@@ -2187,7 +2188,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-web-api"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"serde_json",
|
||||
@@ -2198,7 +2199,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-win32"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"winsafe",
|
||||
]
|
||||
@@ -2206,7 +2207,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-window"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"craft-appkit",
|
||||
"craft-atomic",
|
||||
@@ -2238,7 +2239,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
"serde",
|
||||
@@ -2400,7 +2401,7 @@ dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2526,7 +2527,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
|
||||
[[package]]
|
||||
name = "ecolor"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"emath",
|
||||
@@ -2535,7 +2536,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "eframe"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -2570,7 +2571,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"ahash",
|
||||
@@ -2589,7 +2590,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui-wgpu"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -2608,7 +2609,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui-winit"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"accesskit_winit",
|
||||
"arboard",
|
||||
@@ -2633,7 +2634,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_extras"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"egui",
|
||||
@@ -2647,7 +2648,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_glow"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"egui",
|
||||
@@ -2660,7 +2661,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_kittest"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"dify",
|
||||
"eframe",
|
||||
@@ -2686,7 +2687,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
||||
[[package]]
|
||||
name = "emath"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
@@ -2767,7 +2768,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "epaint"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -2793,7 +2794,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "epaint_default_fonts"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
@@ -3083,7 +3084,7 @@ checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a"
|
||||
dependencies = [
|
||||
"io-lifetimes 2.0.4",
|
||||
"rustix 1.1.6",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3506,7 +3507,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
|
||||
[[package]]
|
||||
name = "hayro-cmap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"hayro-postscript",
|
||||
@@ -3515,7 +3516,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-interpret"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"hayro-cmap",
|
||||
@@ -3533,7 +3534,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-jbig2"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"fearless_simd",
|
||||
"hayro-ccitt",
|
||||
@@ -3551,12 +3552,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-postscript"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
|
||||
[[package]]
|
||||
name = "hayro-syntax"
|
||||
version = "0.7.2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hayro-ccitt",
|
||||
@@ -4116,7 +4117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20fd6de4ccfcc187e38bc21cfa543cb5a302cb86a8b114eb7f0bf0dc9f8ac00f"
|
||||
dependencies = [
|
||||
"io-lifetimes 3.0.1",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4487,7 +4488,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "krilla"
|
||||
version = "0.8.2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bumpalo",
|
||||
@@ -4644,7 +4645,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
|
||||
[[package]]
|
||||
name = "linesweeper"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a4b6d3b6ca04a65d5972339b808d1049a14c7167#a4b6d3b6ca04a65d5972339b808d1049a14c7167"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"kurbo 0.13.1",
|
||||
@@ -9717,7 +9718,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9772,6 +9773,16 @@ dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wuff"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6a992b57b3d1ee972b2e3fd9225e44793104d49818836dd812d5459187712dd"
|
||||
dependencies = [
|
||||
"brotli-decompressor 6.3.2",
|
||||
"bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.21.0"
|
||||
@@ -10280,14 +10291,14 @@ dependencies = [
|
||||
[[patch.unused]]
|
||||
name = "egui_demo_lib"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
|
||||
[[patch.unused]]
|
||||
name = "egui_inspection"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
|
||||
[[patch.unused]]
|
||||
name = "egui_system_font_provider"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec"
|
||||
+48
-48
@@ -11,44 +11,44 @@ rust-version = "1.95"
|
||||
repository = "https://github.com/storytold/vectorcraft"
|
||||
|
||||
[workspace.dependencies]
|
||||
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167", default-features = false, features = ["interpret", "write"] }
|
||||
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043", default-features = false, features = ["interpret", "write"] }
|
||||
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# 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 = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# Native Affinity documents (craft-libs#914).
|
||||
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778).
|
||||
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# SVG parsing, limits, SVGZ and writer (craft-libs#778).
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167", features = ["tree"] }
|
||||
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043", features = ["tree"] }
|
||||
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# EPS container, previews, ASCII85 and DSC comments (craft-libs#778).
|
||||
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# DXF tags, reader and writer (craft-libs#778, #926, #927).
|
||||
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# WMF, EMF and EMF+ reader (craft-libs#778).
|
||||
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167", default-features = false, features = ["read", "write"] }
|
||||
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043", default-features = false, features = ["read", "write"] }
|
||||
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# 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 = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# 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 = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
# internal
|
||||
vectorcraft-geom = { path = "crates/geom" }
|
||||
vectorcraft-color = { path = "crates/color" }
|
||||
@@ -191,25 +191,25 @@ lto = "thin"
|
||||
codegen-units = 1
|
||||
|
||||
[patch.crates-io]
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
krilla = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "a4b6d3b6ca04a65d5972339b808d1049a14c7167" }
|
||||
ecolor = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
emath = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
epaint = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
eframe = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" }
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
krilla = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" }
|
||||
ecolor = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
emath = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
epaint = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
eframe = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" }
|
||||
winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" }
|
||||
@@ -27,7 +27,7 @@ log = { 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 = "a4b6d3b6ca04a65d5972339b808d1049a14c7167", version = "0.1.0" }
|
||||
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043", version = "0.1.0" }
|
||||
|
||||
wasm-bindgen = "0.2"
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -695,6 +695,7 @@ fn undo_group_end(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
/// goes to the running command's result or the tool's status messages, as the tool's own commit
|
||||
/// reports it ([`Session::note_settled_warning`]).
|
||||
pub(crate) fn settle_interaction(s: &mut Session) -> Result<()> {
|
||||
s.put_back_interaction();
|
||||
let typing = typing_in_progress(s);
|
||||
match s.unapplied_interaction_preview().filter(|_| !s.previewing) {
|
||||
Some((cmd, p)) => match s.preview(&cmd, &p) {
|
||||
@@ -894,8 +895,10 @@ fn clear_history(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
fn new_document_from_state(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
const C: &str = "edit.newDocumentFromState";
|
||||
let created = date_param(p, "created", C)?;
|
||||
// The row as the panel lists it now, with a drag in progress on show: keeping it below
|
||||
// changes the rows.
|
||||
s.put_back_interaction();
|
||||
let st = s.doc()?;
|
||||
// The row as the panel lists it now: keeping an edit in progress below changes the rows.
|
||||
let chosen = match super::index_opt(p, "index", C)? {
|
||||
None => None,
|
||||
Some(row) => {
|
||||
|
||||
@@ -140,7 +140,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Add Anchor Point",
|
||||
[],
|
||||
None,
|
||||
"{id, subpath?, segment, t: 0..1} add an anchor at t on the segment → {anchor}; the direct-selected anchors and selected segments keep the same points (a selected segment it splits stays selected as its two halves), and a path that isn't selected becomes the selection with the new anchor direct-selected",
|
||||
"{id, subpath?, segment, t: 0..1, selectAnchor?: bool (the path becomes the selection with only the new anchor direct-selected, also when it is selected)} add an anchor at t on the segment → {anchor}; the direct-selected anchors and selected segments keep the same points (a selected segment it splits stays selected as its two halves), and a path that isn't selected becomes the selection with the new anchor direct-selected",
|
||||
has_doc,
|
||||
insert_anchor
|
||||
),
|
||||
@@ -2155,6 +2155,7 @@ fn insert_anchor(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let si = usize_opt(p, "subpath", "path.insertAnchor")?.unwrap_or(0);
|
||||
let seg = index_opt(p, "segment", "path.insertAnchor")?.ok_or_else(|| bad("path.insertAnchor", "missing segment"))?;
|
||||
let t = number_or(p, "t", 0.5, "path.insertAnchor")?.clamp(0.0, 1.0);
|
||||
let select_anchor = switch_or(p, "selectAnchor", false, "path.insertAnchor")?;
|
||||
let idx = s.edit("Add Anchor Point", |d, sel| {
|
||||
let path = path_mut(d, id)?;
|
||||
let sp = path.subpaths.get_mut(si).ok_or_else(|| EngineError::Other("no such subpath".into()))?;
|
||||
@@ -2164,8 +2165,9 @@ fn insert_anchor(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let idx = sp.insert_anchor(seg, t);
|
||||
renumber_after_insert(sel, id, si, idx);
|
||||
// A path that wasn't selected becomes the selection, its new anchor direct-selected, so
|
||||
// the point added shows and can be edited at once (#4237).
|
||||
if !sel.contains(id) {
|
||||
// the point added shows and can be edited at once (#4237). `selectAnchor` does the same
|
||||
// for a path that is selected.
|
||||
if select_anchor || !sel.contains(id) {
|
||||
sel.clear();
|
||||
sel.add(id);
|
||||
sel.anchors.entry(id).or_default().insert((si, idx));
|
||||
|
||||
@@ -141,6 +141,7 @@ pub const PREF_SPECS: &[PrefSpec] = &[
|
||||
p!("disableAutoAddDelete", "General", "Options", "Disable Auto Add/Delete", bool),
|
||||
p!("interpolateControlPoints", "General", "Options", "Interpolate Control Points When Moving Anchors", bool),
|
||||
p!("deleteKeepsPathsJoined", "General", "Options", "Delete Removes Anchor Points and Keeps Paths Joined", bool),
|
||||
p!("doubleClickAddsAnchorPoints", "General", "Options", "Double-Click Adds Anchor Points", bool),
|
||||
p!("usePreciseCursors", "General", "Options", "Use Precise Cursors", bool),
|
||||
p!("showToolTips", "General", "Options", "Show Tool Tips", bool),
|
||||
p!("showToolCards", "General", "Options", "Show Tool Cards", bool),
|
||||
|
||||
@@ -1252,7 +1252,7 @@ fn swatch_rename_group(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
return Err(bad(C, format!("a swatch or color group named `{name}` already exists")));
|
||||
}
|
||||
// A drag still in progress is a step of its own, so canceling or undoing it leaves the rename.
|
||||
if !s.previewing && s.batch_stash.is_none() && s.in_interaction() {
|
||||
if !s.previewing && s.batch_stash.is_none() && (s.in_interaction() || s.holds_interaction()) {
|
||||
super::settle_interaction(s)?;
|
||||
}
|
||||
s.edit("Color Group Options", |d, _| {
|
||||
|
||||
@@ -340,11 +340,16 @@ pub struct ColorTable {
|
||||
type Shift = ([u8; 3], [u8; 3]);
|
||||
|
||||
/// The most colours a colour table list holds.
|
||||
const MAX_TABLE: usize = 256;
|
||||
pub const MAX_TABLE: usize = 256;
|
||||
|
||||
/// The error for a deletion that would leave the color table no color for the pixels.
|
||||
pub const KEEP_ONE: &str = "colorTable.deleted: at least one color has to stay in the color table";
|
||||
|
||||
/// The error for a colour table list `what` (`colorTable.<what>`) with more than [`MAX_TABLE`] colours.
|
||||
pub fn too_many(what: &str) -> String {
|
||||
format!("colorTable.{what}: at most {MAX_TABLE} colours")
|
||||
}
|
||||
|
||||
impl ColorTable {
|
||||
/// Whether the table is a Custom one: a color was deleted or the palette is fixed.
|
||||
pub fn is_custom(&self) -> bool {
|
||||
@@ -353,7 +358,7 @@ impl ColorTable {
|
||||
|
||||
fn colors(list: &[String], what: &str) -> std::result::Result<Vec<[u8; 3]>, String> {
|
||||
if list.len() > MAX_TABLE {
|
||||
return Err(format!("colorTable.{what}: at most {MAX_TABLE} colours"));
|
||||
return Err(too_many(what));
|
||||
}
|
||||
list.iter().map(|h| Self::rgb(h).ok_or_else(|| format!("colorTable.{what}: `{h}` is not a colour such as \"#ff8800\""))).collect()
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ pub struct Interaction {
|
||||
/// The selection the previews start from (shared, so a preview frame copies nothing).
|
||||
pub selection: Arc<Selection>,
|
||||
pub preview: Option<(String, Value)>,
|
||||
/// The active tool began it (a drag): a command from outside the tool runs as a step of its
|
||||
/// own under it ([`crate::Session::outside_interaction`]). A dialog or a panel that begins an
|
||||
/// interaction runs its commands inside it.
|
||||
pub(crate) tool: bool,
|
||||
/// A replaced or canceled preview restores these new-art paints from before the interaction.
|
||||
pub(crate) paint: vectorcraft_tools::PaintDefaults,
|
||||
/// A preview of the interaction gave `defaultsOnly: true`: every later preview and a cancel put
|
||||
@@ -41,6 +45,61 @@ pub struct Interaction {
|
||||
pub keep_on_switch: bool,
|
||||
}
|
||||
|
||||
/// An interaction that a command from outside the tool set aside while it runs
|
||||
/// ([`crate::Session::outside_interaction`]).
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct HeldInteraction {
|
||||
/// The [`crate::DocState::uid`] of the interaction's document.
|
||||
pub(crate) uid: u64,
|
||||
pub(crate) interaction: Interaction,
|
||||
/// The document and the selection on show when the command began, when a preview had changed
|
||||
/// them from the interaction's snapshot.
|
||||
pub(crate) shown: Option<(Arc<Document>, Selection)>,
|
||||
/// The document's current layer, highlighted Layers panel rows, highlighted variable and
|
||||
/// isolation when the command began; a cancel puts back the ones it changed as it left them.
|
||||
pub(crate) state: ViewState,
|
||||
/// The new-art paints when the command began: a change the command makes to them stays when
|
||||
/// the interaction's next preview or a cancel puts back the paints it began with.
|
||||
pub(crate) paint: vectorcraft_tools::PaintDefaults,
|
||||
}
|
||||
|
||||
/// The per-document state an interaction puts back when it is canceled, besides the document and
|
||||
/// the selection.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) struct ViewState {
|
||||
pub(crate) active_layer: Option<NodeId>,
|
||||
pub(crate) layer_rows: Vec<NodeId>,
|
||||
pub(crate) variables_highlight: Option<String>,
|
||||
pub(crate) isolation: Option<NodeId>,
|
||||
}
|
||||
|
||||
impl ViewState {
|
||||
pub(crate) fn of(st: &crate::DocState) -> Self {
|
||||
ViewState {
|
||||
active_layer: st.active_layer,
|
||||
layer_rows: st.layer_rows.clone(),
|
||||
variables_highlight: st.variables_highlight.clone(),
|
||||
isolation: st.isolation,
|
||||
}
|
||||
}
|
||||
|
||||
/// Give `it` the parts of `now` that differ from `self`, the state before a command.
|
||||
pub(crate) fn rebase(&self, now: ViewState, it: &mut Interaction) {
|
||||
if now.active_layer != self.active_layer {
|
||||
it.active_layer = now.active_layer;
|
||||
}
|
||||
if now.layer_rows != self.layer_rows {
|
||||
it.layer_rows = now.layer_rows;
|
||||
}
|
||||
if now.variables_highlight != self.variables_highlight {
|
||||
it.variables_highlight = now.variables_highlight;
|
||||
}
|
||||
if now.isolation != self.isolation {
|
||||
it.isolation = now.isolation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What Object → Transform → Transform Again (⌘D) repeats ([`SessionState::last_transform`]).
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum LastTransform {
|
||||
|
||||
@@ -338,6 +338,9 @@ pub struct Session {
|
||||
/// The warnings of the previews that settling an interaction applied, while a top-level command
|
||||
/// or the tool's actions collect them ([`Session::collect_settled_warnings`]).
|
||||
settled_warnings: Option<Vec<String>>,
|
||||
/// The interaction a command from outside the tool set aside while it runs
|
||||
/// ([`Session::outside_interaction`]).
|
||||
held_interaction: Option<HeldInteraction>,
|
||||
/// While [`Session::preview`] runs its command: its edits are the interaction's own.
|
||||
previewing: bool,
|
||||
/// The images Remove Background decoded during the interaction's preview steps, emptied when
|
||||
@@ -456,7 +459,7 @@ pub use error::{EngineError, READ_ONLY_LOCATION, Result, SCRIPT_BUSY};
|
||||
#[cfg(test)]
|
||||
use history::history_budget_for;
|
||||
pub use history::{History, HistoryEntry, NamedStep, default_history_budget};
|
||||
pub(crate) use interaction::PreviewCopies;
|
||||
pub(crate) use interaction::{HeldInteraction, PreviewCopies};
|
||||
pub use interaction::{Interaction, LastTransform, UndoGroup, UndoScope};
|
||||
pub use prefs::{DrawMode, KEY_HOLD_DELAY, KEY_HOLD_DELAY_RANGE, PluginBudget, Prefs};
|
||||
pub use sanity::TOO_DEEP;
|
||||
|
||||
@@ -61,6 +61,9 @@ pub struct Prefs {
|
||||
/// the curve around each one, instead of deleting them with their segments. Off (the default),
|
||||
/// Clear opens the path there.
|
||||
pub delete_keeps_paths_joined: bool,
|
||||
/// General › Double-Click Adds Anchor Points: on, a plain double-click on a path segment with
|
||||
/// Direct Selection adds an anchor there. Off (the default), the double-click adds nothing.
|
||||
pub double_click_adds_anchor_points: bool,
|
||||
pub use_precise_cursors: bool,
|
||||
pub show_tool_tips: bool,
|
||||
/// General › Show Tool Cards: with tool tips on, a tool button's tool tip is a card with what the
|
||||
@@ -486,6 +489,7 @@ impl Default for Prefs {
|
||||
disable_auto_add_delete: false,
|
||||
interpolate_control_points: false,
|
||||
delete_keeps_paths_joined: false,
|
||||
double_click_adds_anchor_points: false,
|
||||
use_precise_cursors: false,
|
||||
show_tool_tips: true,
|
||||
show_tool_cards: false,
|
||||
|
||||
@@ -141,6 +141,7 @@ impl Session {
|
||||
recovery: Default::default(),
|
||||
in_tool_actions: false,
|
||||
settled_warnings: None,
|
||||
held_interaction: None,
|
||||
previewing: false,
|
||||
decoded_images: Default::default(),
|
||||
envelope_defaults: None,
|
||||
|
||||
@@ -287,6 +287,190 @@ impl Session {
|
||||
(r, settled)
|
||||
}
|
||||
|
||||
/// Run `f`, the top-level command `id` with `params` from outside the tool (a panel, a menu
|
||||
/// item, an automation client), with the active document's tool drag set aside: the command
|
||||
/// runs on the document the drag started from and records its own undo step and journal entry.
|
||||
/// The drag then starts from what the command left, and its preview is applied again, so the
|
||||
/// next preview, the commit and a cancel keep the command's edit, and Undo takes back the drag's
|
||||
/// step before the command's. While the command runs, [`Session::in_interaction`] is false, so
|
||||
/// it updates Recent Colors and converts or remaps the new-art paints at once, as it does with
|
||||
/// no drag in progress.
|
||||
///
|
||||
/// The interaction stays as it is, and the command runs inside it, for an interaction a dialog
|
||||
/// or a panel began (it builds its preview from commands), for typing in progress
|
||||
/// ([`Session::edit`] keeps it as a step of its own), for the Quick Pen (an edit made outside
|
||||
/// it ends the path it draws), and for a copy made with `object.transform` during a drag that
|
||||
/// copies (it copies the document as the drag's move left it). A command that settles,
|
||||
/// commits or cancels the interaction, or that hands the active tool actions to apply, gets it
|
||||
/// back first ([`Session::put_back_interaction`]), as it found it.
|
||||
pub(crate) fn outside_interaction(&mut self, id: &str, params: &Value, f: impl FnOnce(&mut Self) -> Result<Value>) -> Result<Value> {
|
||||
if cmd::typing_in_progress(self) || self.tool_id() == vectorcraft_tools::quickpen::ID {
|
||||
return f(self);
|
||||
}
|
||||
let Some(st) = self.active_mut() else { return f(self) };
|
||||
let Some(it) = st.interaction.as_ref().filter(|it| it.tool) else { return f(self) };
|
||||
// A drag that copies: its latest preview, applied or held back by Real-time Drawing off, copies.
|
||||
let copying = it.preview.as_ref().is_some_and(|(c, p)| c == "object.transform" && p.get("copy").and_then(Value::as_bool) == Some(true));
|
||||
if copying && id == "object.transform" && params.get("copy").and_then(Value::as_bool) == Some(true) {
|
||||
return f(self);
|
||||
}
|
||||
let Some(interaction) = st.interaction.take() else { return f(self) };
|
||||
// The document and selection on show, when a preview changed them.
|
||||
let previewed = !Arc::ptr_eq(&st.doc, &interaction.doc) || st.selection != *interaction.selection;
|
||||
let shown = previewed.then(|| (st.doc.clone(), st.selection.clone()));
|
||||
if previewed {
|
||||
st.doc = interaction.doc.clone();
|
||||
st.selection.clone_from(&interaction.selection);
|
||||
st.revision += 1;
|
||||
cmd::globaledit::follow_history(st);
|
||||
}
|
||||
let (uid, state) = (st.uid, crate::interaction::ViewState::of(st));
|
||||
let paint = self.paint.clone();
|
||||
self.held_interaction = Some(crate::HeldInteraction { uid, interaction, shown, state, paint });
|
||||
if previewed {
|
||||
self.sync_front_profiles();
|
||||
}
|
||||
let r = f(self);
|
||||
self.put_back_interaction();
|
||||
r
|
||||
}
|
||||
|
||||
/// Put back the interaction [`Session::outside_interaction`] set aside. When the command left
|
||||
/// the document and the selection as it found them, the preview on show before it is on show
|
||||
/// again. Otherwise the interaction starts from the document the command left and from its
|
||||
/// own selection, without the objects the command removed, hid or locked, and the preview that Real-time
|
||||
/// Drawing showed is applied to it again. The warning or the error of that preview goes to
|
||||
/// the command's result ([`Session::note_settled_warning`]); a preview that fails leaves the
|
||||
/// interaction with nothing to commit. An interaction whose document the command closed ends,
|
||||
/// and so does one with anchors or segments selected on a path the command changed in more
|
||||
/// than a move. A document
|
||||
/// the command left an interaction of its own on keeps that one.
|
||||
pub(crate) fn put_back_interaction(&mut self) {
|
||||
let Some(crate::HeldInteraction { uid, interaction: mut it, shown, state, paint }) = self.held_interaction.take() else { return };
|
||||
// A selection command loaded the paints of the selection it made into the fill and stroke
|
||||
// proxies. The drag goes on with its own selection, so they show its paints again.
|
||||
if self.paint != paint
|
||||
&& let Some(st) = self.active_mut().filter(|d| d.uid == uid && d.interaction.is_none())
|
||||
{
|
||||
let own = drag_selection(&it.selection, &st.doc);
|
||||
if st.selection != own {
|
||||
let made = std::mem::replace(&mut st.selection, own);
|
||||
self.inherit_new_art();
|
||||
self.load_selection_paints();
|
||||
if let Some(st) = self.active_mut() {
|
||||
st.selection = made;
|
||||
}
|
||||
}
|
||||
}
|
||||
// A change the command made to the new-art paints stays when the next preview or a cancel
|
||||
// puts back the paints the interaction began with (the Live Paint Bucket's colors); the
|
||||
// parts it left alone keep the interaction's. The pattern lists every field, so a field
|
||||
// added to `PaintDefaults` does not compile until it is handled here.
|
||||
let vectorcraft_tools::PaintDefaults { fill, stroke, stroke_width, appearance, opacity, blend, style, inherited } = &self.paint;
|
||||
let start = &mut it.paint;
|
||||
if *fill != paint.fill {
|
||||
start.fill.clone_from(fill);
|
||||
}
|
||||
if *stroke != paint.stroke {
|
||||
start.stroke.clone_from(stroke);
|
||||
}
|
||||
if *stroke_width != paint.stroke_width {
|
||||
start.stroke_width = *stroke_width;
|
||||
}
|
||||
if *appearance != paint.appearance {
|
||||
start.appearance.clone_from(appearance);
|
||||
}
|
||||
if *opacity != paint.opacity {
|
||||
start.opacity = *opacity;
|
||||
}
|
||||
if *blend != paint.blend {
|
||||
start.blend = *blend;
|
||||
}
|
||||
if *style != paint.style {
|
||||
start.style.clone_from(style);
|
||||
}
|
||||
if *inherited != paint.inherited {
|
||||
start.inherited = *inherited;
|
||||
}
|
||||
let active = self.active().is_some_and(|d| d.uid == uid);
|
||||
let Some(st) = self.docs.iter_mut().find(|d| d.uid == uid) else { return };
|
||||
if st.interaction.is_some() {
|
||||
return;
|
||||
}
|
||||
// A change the command made to the current layer, the highlighted rows or variable, or
|
||||
// isolation stays when the interaction is canceled.
|
||||
state.rebase(crate::interaction::ViewState::of(st), &mut it);
|
||||
let previewed = shown.is_some();
|
||||
if Arc::ptr_eq(&st.doc, &it.doc) && st.selection == *it.selection {
|
||||
if let Some((doc, selection)) = shown {
|
||||
st.doc = doc;
|
||||
st.selection = selection;
|
||||
st.revision += 1;
|
||||
cmd::globaledit::follow_history(st);
|
||||
}
|
||||
st.interaction = Some(it);
|
||||
if previewed {
|
||||
self.sync_front_profiles();
|
||||
}
|
||||
return;
|
||||
}
|
||||
// The drag's anchors and segments are numbered in the paths it began on. When the command
|
||||
// changed one of those paths in more than a move, the numbers can name other points, and
|
||||
// the drag ends without a step.
|
||||
if renumbered(&it.selection, &it.doc, &st.doc) {
|
||||
self.clear_deferred_overlay_cache();
|
||||
return;
|
||||
}
|
||||
let began = std::mem::replace(&mut it.doc, st.doc.clone());
|
||||
// The drag acts on the objects it began with: a selection the command made (a paste, a
|
||||
// duplicate, Select All) does not change what the drag moves.
|
||||
it.selection = Arc::new(drag_selection(&it.selection, &st.doc));
|
||||
// The journal holds the selection the command left. The drag's own selection is journaled
|
||||
// after it, so the drag and the commands after it replay on the objects they act on.
|
||||
let reselect = (active && st.selection != *it.selection)
|
||||
.then(|| selection_steps(&it.selection, &st.selection, &st.doc, st.active_layer, &st.highlighted_rows()));
|
||||
// The objects the drag's preview names leave out those the command removed, hid or locked.
|
||||
// A preview left naming none has nothing to apply, and the drag records no step.
|
||||
if it.preview.as_mut().is_some_and(|(_, p)| !drag_targets(p, &began, &st.doc)) {
|
||||
it.preview = None;
|
||||
}
|
||||
it.copies = None;
|
||||
it.move_box = std::sync::OnceLock::new();
|
||||
// With Real-time Drawing off the preview waits for the commit, as it did before the command.
|
||||
let again = it.preview.clone().filter(|_| previewed && active);
|
||||
// Without a preview to apply, the drag's own selection is on show, as a preview would leave
|
||||
// it before it acts.
|
||||
if again.is_none() && st.selection != *it.selection {
|
||||
st.selection.clone_from(&it.selection);
|
||||
st.revision += 1;
|
||||
}
|
||||
st.interaction = Some(it);
|
||||
if let Some(steps) = reselect {
|
||||
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);
|
||||
}
|
||||
self.clear_deferred_overlay_cache();
|
||||
if let Some((cmd, p)) = again {
|
||||
match self.preview(&cmd, &p) {
|
||||
Ok(v) => {
|
||||
if let Some(w) = v.get("warning").and_then(Value::as_str) {
|
||||
self.note_settled_warning(w);
|
||||
}
|
||||
}
|
||||
Err(e) => self.note_settled_warning(&e.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// While a command from outside the tool runs: the interaction it set aside
|
||||
/// ([`Session::outside_interaction`]).
|
||||
pub(crate) fn holds_interaction(&self) -> bool {
|
||||
self.held_interaction.is_some()
|
||||
}
|
||||
|
||||
/// [`Session::begin_interaction`] for a dialog or a panel that starts a preview → the warnings
|
||||
/// of the preview that keeping typing in progress applied, for its status bar.
|
||||
pub fn begin_interaction_warned(&mut self, label: &str) -> Result<Vec<String>> {
|
||||
@@ -311,6 +495,8 @@ impl Session {
|
||||
if label != "Typing" && cmd::typing_in_progress(self) {
|
||||
cmd::settle_interaction(self)?;
|
||||
}
|
||||
// A command from outside the tool that begins an interaction during a drag joins the drag's.
|
||||
self.put_back_interaction();
|
||||
// An edit the tool computes on another thread (a Shape Builder merge) is applied first too,
|
||||
// so the snapshot the interaction previews from and goes back to holds it.
|
||||
if !self.in_interaction() {
|
||||
@@ -327,6 +513,7 @@ impl Session {
|
||||
doc: st.doc.clone(),
|
||||
selection: Arc::new(st.selection.clone()),
|
||||
preview: None,
|
||||
tool: false,
|
||||
paint,
|
||||
used_defaults_only: false,
|
||||
preview_paint: None,
|
||||
@@ -347,6 +534,7 @@ impl Session {
|
||||
|
||||
/// Re-apply `cmd` on top of the interaction snapshot (replacing the previous preview).
|
||||
pub fn preview(&mut self, cmd: &str, params: &Value) -> Result<Value> {
|
||||
self.put_back_interaction();
|
||||
if self.script_running() {
|
||||
return Err(EngineError::Busy);
|
||||
}
|
||||
@@ -438,6 +626,7 @@ impl Session {
|
||||
fn commit_interaction_unwatched(&mut self) -> Result<()> {
|
||||
self.clear_deferred_overlay_cache();
|
||||
self.decoded_images.empty();
|
||||
self.put_back_interaction();
|
||||
if let Some(paint) = self.active().and_then(|st| st.interaction.as_ref()).and_then(|it| it.preview_paint.clone()) {
|
||||
self.paint = paint;
|
||||
}
|
||||
@@ -527,6 +716,7 @@ impl Session {
|
||||
}
|
||||
|
||||
pub fn cancel_interaction(&mut self) -> Result<()> {
|
||||
self.put_back_interaction();
|
||||
self.clear_deferred_overlay_cache();
|
||||
self.decoded_images.empty();
|
||||
self.pending_paint = None;
|
||||
@@ -567,3 +757,163 @@ impl Session {
|
||||
self.active().is_some_and(|d| d.interaction.is_some())
|
||||
}
|
||||
}
|
||||
|
||||
/// The selection a drag began with, without the objects that a command run during it removed,
|
||||
/// hid or locked in `doc`.
|
||||
fn drag_selection(began: &Selection, doc: &Document) -> Selection {
|
||||
let mut selection = began.clone();
|
||||
selection.prune(doc);
|
||||
let editable = doc.editable();
|
||||
let held: Vec<_> = selection.objects.iter().copied().filter(|&id| !editable(id)).collect();
|
||||
selection.remove_all(held);
|
||||
selection
|
||||
}
|
||||
|
||||
/// Take out of the `ids` of a drag's preview `params` the objects that a command run during the
|
||||
/// drag removed from `doc`, or hid or locked there while they were editable in `began` → false
|
||||
/// when the preview named objects and none of them is left.
|
||||
fn drag_targets(params: &mut Value, began: &Document, doc: &Document) -> bool {
|
||||
let Some(ids) = params.get_mut("ids").and_then(Value::as_array_mut) else { return true };
|
||||
if ids.is_empty() {
|
||||
return true;
|
||||
}
|
||||
let (was, now) = (began.editable(), doc.editable());
|
||||
ids.retain(|v| v.as_u64().map(vectorcraft_doc::NodeId).is_none_or(|id| doc.node(id).is_some() && (now(id) || !was(id))));
|
||||
!ids.is_empty()
|
||||
}
|
||||
|
||||
/// Whether a path with anchors or segments in `selection` is other in `doc` than in `began`, the
|
||||
/// document a drag began from, in more than a move: its anchors added, removed, put in another
|
||||
/// order (Reverse Path Direction) or reshaped, or a subpath opened or closed. A path the command
|
||||
/// moved as a whole keeps its numbers.
|
||||
fn renumbered(selection: &Selection, began: &Document, doc: &Document) -> bool {
|
||||
fn path(d: &Document, id: vectorcraft_doc::NodeId) -> Option<&[vectorcraft_geom::SubPath]> {
|
||||
d.node(id).and_then(|n| n.path_data()).map(|p| p.subpaths.as_slice())
|
||||
}
|
||||
selection.anchors.keys().chain(selection.segments.keys()).any(|&id| match (path(began, id), path(doc, id)) {
|
||||
(Some(was), Some(now)) => !moved_whole(was, now),
|
||||
(was, now) => was.is_some() != now.is_some(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Whether the subpaths `now` are the subpaths `was` moved by one offset: the same number of each,
|
||||
/// each opened or closed as before, every anchor of the same kind, and every anchor and handle
|
||||
/// offset alike.
|
||||
fn moved_whole(was: &[vectorcraft_geom::SubPath], now: &[vectorcraft_geom::SubPath]) -> bool {
|
||||
if was.len() != now.len() || was.iter().zip(now).any(|(a, b)| a.closed != b.closed || a.anchors.len() != b.anchors.len()) {
|
||||
return false;
|
||||
}
|
||||
let mut pairs = was.iter().zip(now).flat_map(|(a, b)| a.anchors.iter().zip(b.anchors.iter()));
|
||||
let Some((a0, b0)) = pairs.next() else { return true };
|
||||
let (dx, dy) = (b0.p.x - a0.p.x, b0.p.y - a0.p.y);
|
||||
let alike = |a: vectorcraft_geom::Point, b: vectorcraft_geom::Point| {
|
||||
(b.x - a.x - dx).abs() <= vectorcraft_geom::EPS && (b.y - a.y - dy).abs() <= vectorcraft_geom::EPS
|
||||
};
|
||||
std::iter::once((a0, b0)).chain(pairs).all(|(a, b)| a.kind == b.kind && alike(a.p, b.p) && alike(a.h_in, b.h_in) && alike(a.h_out, b.h_out))
|
||||
}
|
||||
|
||||
/// The journal entries that select `selection` again in `doc` after `made`, the selection a
|
||||
/// command left with `layer` current and `rows` highlighted in the Layers panel ([`object_steps`]).
|
||||
/// When selecting the objects would make another layer current, `layer.setCurrent` makes `layer`
|
||||
/// current again, as the drag leaves it, and `layer.highlight` gives back the highlighted rows.
|
||||
fn selection_steps(
|
||||
selection: &Selection,
|
||||
made: &Selection,
|
||||
doc: &Document,
|
||||
layer: Option<vectorcraft_doc::NodeId>,
|
||||
rows: &[vectorcraft_doc::NodeId],
|
||||
) -> Vec<(String, Value)> {
|
||||
let mut steps = object_steps(selection, doc);
|
||||
// `layer.target` on a layer makes it current; any other change to the selected objects makes
|
||||
// the layer of the last selected object current.
|
||||
let targeted = steps.first().is_some_and(|(id, _)| id == "layer.target");
|
||||
let selects = match selection.target.filter(|t| targeted && doc.node(*t).is_some_and(|n| n.is_layer())) {
|
||||
Some(t) => Some(t),
|
||||
None if selection.objects != made.objects => {
|
||||
selection.objects.last().and_then(|id| doc.layer_containing(*id)).filter(|l| doc.is_editable(*l))
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
if let Some(layer) = layer.filter(|l| selects.is_some_and(|s| s != *l)) {
|
||||
steps.push(("layer.setCurrent".into(), serde_json::json!({ "id": layer.0 })));
|
||||
// `layer.setCurrent` highlights the layer's row. `layer.highlight` sets the rows the command
|
||||
// left instead; it keeps `layer` current while the last of them is on `layer`, or none is left.
|
||||
if rows != [layer] && rows.last().is_none_or(|r| doc.layer_containing(*r) == Some(layer)) {
|
||||
let ids: Vec<u64> = rows.iter().map(|r| r.0).collect();
|
||||
steps.push(("layer.highlight".into(), serde_json::json!({ "ids": ids, "mode": "set" })));
|
||||
}
|
||||
}
|
||||
steps
|
||||
}
|
||||
|
||||
/// The journal entries that select `selection` in `doc`: the selections made on their own (its
|
||||
/// slices with `object.slice.select`, its target with `layer.target`, its symbol part with
|
||||
/// `symbol.instance.selectPart`, its Objects on Path member with
|
||||
/// `object.objectsOnPath.selectMember`), or its objects in their order (`select.set`), the anchors
|
||||
/// left out on paths that are not selected whole (`select.anchorsMany`), the anchors of paths with
|
||||
/// every anchor selected (`select.anchors`) and its segments (`select.segments`); after its objects
|
||||
/// or its target, its ruler guides (`guide.select`) and its key object, key guide or key anchor
|
||||
/// (`select.key`).
|
||||
fn object_steps(selection: &Selection, doc: &Document) -> Vec<(String, Value)> {
|
||||
use serde_json::json;
|
||||
if !selection.slices.is_empty() {
|
||||
let slices: Vec<u64> = selection.slices.iter().map(|id| id.0).collect();
|
||||
return vec![("object.slice.select".into(), json!({ "slices": slices }))];
|
||||
}
|
||||
// A target is selected again only while targeting it selects the same objects: when a command
|
||||
// added art to a targeted layer, `select.set` selects the drag's objects.
|
||||
let targets = |t: vectorcraft_doc::NodeId| match doc.node(t) {
|
||||
Some(n) if n.is_layer() => n.layer_art(true) == selection.objects,
|
||||
_ => selection.objects == [t],
|
||||
};
|
||||
let json_refs = |refs: &mut dyn Iterator<Item = &(usize, usize)>| Value::Array(refs.map(|&(a, b)| json!([a, b])).collect());
|
||||
// A targeted object keeps the ruler guides and the key selected beside it.
|
||||
let mut steps = if let Some(t) = selection.target.filter(|&t| targets(t)) {
|
||||
vec![("layer.target".to_string(), json!({ "id": t.0 }))]
|
||||
} else if let Some(part) = &selection.symbol_part {
|
||||
return vec![("symbol.instance.selectPart".into(), json!({ "id": part.instance.0, "path": part.path }))];
|
||||
} else if let Some(member) = selection.on_path_member {
|
||||
return vec![("object.objectsOnPath.selectMember".into(), json!({ "member": member.0 }))];
|
||||
} else {
|
||||
let ids: Vec<u64> = selection.objects.iter().map(|id| id.0).collect();
|
||||
let mut steps = vec![("select.set".to_string(), json!({ "ids": ids }))];
|
||||
// `select.set` selects each path whole: subtracting the anchors that are not selected leaves
|
||||
// the ones that are, and keeps the order of the objects. A path with every anchor selected
|
||||
// as anchors gets them back with `select.anchors`, which keeps them all as anchors.
|
||||
let mut every = Vec::new();
|
||||
let partial: Vec<Value> = selection
|
||||
.objects
|
||||
.iter()
|
||||
.filter_map(|id| {
|
||||
let refs = selection.anchors.get(id)?;
|
||||
let path = doc.node(*id)?.path_data()?;
|
||||
let out: Vec<(usize, usize)> = path.anchors().map(|(s, i, _)| (s, i)).filter(|r| !refs.contains(r)).collect();
|
||||
if out.is_empty() {
|
||||
every.push(("select.anchors".to_string(), json!({ "id": id.0, "anchors": json_refs(&mut refs.iter()), "mode": "add" })));
|
||||
return None;
|
||||
}
|
||||
Some(json!({ "id": id.0, "anchors": json_refs(&mut out.iter()) }))
|
||||
})
|
||||
.collect();
|
||||
if !partial.is_empty() {
|
||||
steps.push(("select.anchorsMany".into(), json!({ "items": partial, "mode": "subtract" })));
|
||||
}
|
||||
steps.extend(every);
|
||||
for (id, refs) in &selection.segments {
|
||||
steps.push(("select.segments".into(), json!({ "id": id.0, "segments": json_refs(&mut refs.iter()), "mode": "add" })));
|
||||
}
|
||||
steps
|
||||
};
|
||||
if !selection.guides.is_empty() {
|
||||
let indexes = cmd::guide_indexes(doc, &selection.guides);
|
||||
steps.push(("guide.select".into(), json!({ "indexes": indexes, "toggle": true })));
|
||||
}
|
||||
if let Some((id, (s, i))) = selection.key_anchor {
|
||||
steps.push(("select.key".into(), json!({ "id": id.0, "anchor": [s, i] })));
|
||||
} else if let Some(g) = selection.key_guide.and_then(|g| cmd::guide_indexes(doc, &[g]).first().copied()) {
|
||||
steps.push(("select.key".into(), json!({ "guide": g })));
|
||||
} else if let Some(key) = selection.key {
|
||||
steps.push(("select.key".into(), json!({ "id": key.0 })));
|
||||
}
|
||||
steps
|
||||
}
|
||||
@@ -99,10 +99,17 @@ impl Session {
|
||||
self.finish_tool_edit_later()?;
|
||||
}
|
||||
let outer = std::mem::replace(&mut self.reading, !spec.journal || JOURNALED_READS.contains(&id));
|
||||
// A command from outside the tool, while the tool's drag is in progress, is a step of its
|
||||
// own before the drag's ([`Session::outside_interaction`]). Find Objects with `select` is
|
||||
// journaled (`Session::journal_query`), so it is one too.
|
||||
let find_selects = id == "document.find" && params.get("select").and_then(Value::as_bool) == Some(true);
|
||||
let outside = (spec.journal || find_selects) && !self.previewing && !self.in_tool_actions;
|
||||
// A preview that a top-level command applied first (a drag with Real-time Drawing off, kept
|
||||
// before Undo) reports its warning in the command's result.
|
||||
let r = if self.depth == 0 {
|
||||
let (r, settled) = self.collect_settled_warnings(|s| s.execute_spec(spec, id, params));
|
||||
let (r, settled) = self.collect_settled_warnings(|s| {
|
||||
if outside { s.outside_interaction(id, params, |s| s.execute_spec(spec, id, params)) } else { s.execute_spec(spec, id, params) }
|
||||
});
|
||||
r.map(|v| with_settled_warnings(v, &settled))
|
||||
} else {
|
||||
self.execute_spec(spec, id, params)
|
||||
|
||||
@@ -54,6 +54,7 @@ mod distort;
|
||||
mod docsetup;
|
||||
mod document_close;
|
||||
mod document_move;
|
||||
mod double_click_adds_anchor;
|
||||
mod draw2;
|
||||
mod dynamic_symbols;
|
||||
mod dynamic_text;
|
||||
@@ -88,6 +89,7 @@ mod history_document;
|
||||
mod history_mem;
|
||||
mod ids_without_selection;
|
||||
mod inline;
|
||||
mod interaction_commands;
|
||||
mod interactivity;
|
||||
mod interpolate_handles;
|
||||
mod intertwine;
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
//! General › Double-Click Adds Anchor Points (`doubleClickAddsAnchorPoints`). With it on, a
|
||||
//! Direct Selection double-click on a path segment adds an anchor there. Off (the default), the
|
||||
//! double-click adds nothing.
|
||||
|
||||
use serde_json::json;
|
||||
use vectorcraft_geom::kurbo::ParamCurveNearest;
|
||||
use vectorcraft_geom::{ParamCurve, PathData, Point};
|
||||
use vectorcraft_tools::{PointerEvent, PointerKind};
|
||||
|
||||
use super::history;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({"width": 800, "height": 600})).unwrap();
|
||||
s
|
||||
}
|
||||
|
||||
fn set_pref(s: &mut Session, key: &str, on: bool) {
|
||||
s.execute("prefs.set", &json!({"key": key, "value": on})).unwrap();
|
||||
}
|
||||
|
||||
fn path_of(s: &Session, id: NodeId) -> Option<PathData> {
|
||||
s.doc().unwrap().doc.node(id).and_then(|n| n.path_data().cloned())
|
||||
}
|
||||
|
||||
fn points(s: &Session, id: NodeId) -> Vec<Point> {
|
||||
path_of(s, id).unwrap().subpaths.iter().flat_map(|sp| sp.anchors.iter().map(|a| a.p)).collect()
|
||||
}
|
||||
|
||||
/// Two clicks and the double-click that follows them, with Direct Selection, at `at`. On a segment
|
||||
/// the clicks select it, so the double-click finds its path selected.
|
||||
fn double_click(s: &mut Session, at: Point) {
|
||||
let v = ViewInfo::default();
|
||||
s.select_tool("directSelection", v).unwrap();
|
||||
for kind in [PointerKind::Down, PointerKind::Up, PointerKind::Down, PointerKind::Up, PointerKind::DoubleClick] {
|
||||
s.pointer(&PointerEvent::new(kind, at.x, at.y), v).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// An open curve from (100, 300) to (300, 300) whose middle, at t = 0.5, is (200, 225).
|
||||
fn arch(s: &mut Session) -> NodeId {
|
||||
let anchors = json!([{"x": 100, "y": 300, "out": [100, 200]}, {"x": 300, "y": 300, "in": [300, 200]}]);
|
||||
NodeId(s.execute("path.create", &json!({ "anchors": anchors, "closed": false })).unwrap()["id"].as_u64().unwrap())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn off_by_default() {
|
||||
let s = session();
|
||||
assert!(!s.prefs.double_click_adds_anchor_points);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_the_preference_on_a_double_click_on_a_segment_adds_an_anchor_in_one_undo_step() {
|
||||
// The clicks before the double-click select the segment either way; an unselected path at the
|
||||
// double-click is covered by the tools crate's tests.
|
||||
for selected in [true, false] {
|
||||
let mut s = session();
|
||||
set_pref(&mut s, "doubleClickAddsAnchorPoints", true);
|
||||
let id = arch(&mut s);
|
||||
if !selected {
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
}
|
||||
let curve = path_of(&s, id).unwrap().subpaths[0].segment(0);
|
||||
let before = history(&s).0;
|
||||
double_click(&mut s, Point::new(200.0, 225.0));
|
||||
assert_eq!(history(&s).0, before + 1, "one undo step (selected before the clicks: {selected})");
|
||||
assert_eq!(points(&s, id).len(), 3, "an anchor is added (selected before the clicks: {selected})");
|
||||
assert!(points(&s, id)[1].distance(Point::new(200.0, 225.0)) < 0.5, "at the clicked point: {:?}", points(&s, id));
|
||||
let halves = path_of(&s, id).unwrap().subpaths[0].clone();
|
||||
for seg in 0..2 {
|
||||
for t in [0.25, 0.5, 0.75] {
|
||||
let q = ParamCurve::eval(&halves.segment(seg), t);
|
||||
let d = ParamCurveNearest::nearest(&curve, q, 1e-9).distance_sq;
|
||||
assert!(d < 1e-6, "the curve keeps its shape at {q:?}");
|
||||
}
|
||||
}
|
||||
let st = s.doc().unwrap();
|
||||
assert_eq!(st.selection.objects, vec![id]);
|
||||
assert_eq!(st.selection.anchors.get(&id), Some(&[(0, 1)].into()), "only the new anchor is selected (selected before the clicks: {selected})");
|
||||
assert!(st.selection.segments.get(&id).is_none_or(|s| s.is_empty()), "no segment stays selected");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(points(&s, id).len(), 2, "undo removes it");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_the_preference_off_a_double_click_on_a_segment_adds_nothing() {
|
||||
let mut s = session();
|
||||
let id = arch(&mut s);
|
||||
let before = history(&s).0;
|
||||
double_click(&mut s, Point::new(200.0, 225.0));
|
||||
assert_eq!(history(&s).0, before);
|
||||
assert_eq!(points(&s, id).len(), 2);
|
||||
}
|
||||
|
||||
/// The two General preferences are separate: Delete Removes Anchor Points and Keeps Paths Joined
|
||||
/// does not turn on the double-click, and the double-click preference does not change Delete.
|
||||
#[test]
|
||||
fn the_double_click_and_delete_preferences_are_separate() {
|
||||
let mut s = session();
|
||||
set_pref(&mut s, "deleteKeepsPathsJoined", true);
|
||||
let id = arch(&mut s);
|
||||
let before = history(&s).0;
|
||||
double_click(&mut s, Point::new(200.0, 225.0));
|
||||
assert_eq!(history(&s).0, before, "deleteKeepsPathsJoined alone adds no anchor");
|
||||
assert_eq!(points(&s, id).len(), 2);
|
||||
|
||||
let mut s = session();
|
||||
set_pref(&mut s, "doubleClickAddsAnchorPoints", true);
|
||||
let anchors = json!([{"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200}]);
|
||||
let id = NodeId(s.execute("path.create", &json!({ "anchors": anchors, "closed": true })).unwrap()["id"].as_u64().unwrap());
|
||||
s.execute("select.anchors", &json!({"id": id.0, "anchors": [[0, 1]], "mode": "set"})).unwrap();
|
||||
s.execute("edit.clear", &json!({})).unwrap();
|
||||
assert!(!path_of(&s, id).unwrap().subpaths[0].closed, "Delete still opens the path");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_select_anchor_param_must_be_a_boolean() {
|
||||
let mut s = session();
|
||||
let id = arch(&mut s);
|
||||
assert!(s.execute("path.insertAnchor", &json!({"id": id.0, "segment": 0, "selectAnchor": "yes"})).is_err());
|
||||
assert_eq!(points(&s, id).len(), 2, "a refused call changes nothing");
|
||||
}
|
||||
@@ -0,0 +1,829 @@
|
||||
//! A command run from outside the tool (a panel, a menu item, an automation client) while a tool's drag is
|
||||
//! in progress is a step of its own, before the drag's: the drag's next preview, its release and
|
||||
//! Escape keep the command's edit, and the release still draws what the drag drew, with Real-time
|
||||
//! Drawing on and off.
|
||||
|
||||
use serde_json::json;
|
||||
use vectorcraft_geom::Rect;
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use crate::*;
|
||||
|
||||
/// The view the gestures run in: page coordinates, with Smart Guides off so nothing snaps.
|
||||
fn view() -> ViewInfo {
|
||||
ViewInfo { smart_guides: false, ..ViewInfo::default() }
|
||||
}
|
||||
|
||||
/// Feed the pointer event `(kind, x, y)` to the active tool.
|
||||
fn pointer(s: &mut Session, kind: PointerKind, x: f64, y: f64) {
|
||||
s.pointer(&PointerEvent::new(kind, x, y), view()).unwrap();
|
||||
}
|
||||
|
||||
/// A new 400 × 400 pt document with Real-time Drawing `real_time`, holding one 20 × 20 pt rectangle
|
||||
/// (returned), nothing selected, and the Rectangle tool chosen.
|
||||
fn session(real_time: bool) -> (Session, NodeId) {
|
||||
let mut s = Session::new();
|
||||
s.prefs.real_time_drawing = real_time;
|
||||
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
|
||||
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap();
|
||||
let other = s.doc().unwrap().selection.objects[0];
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
s.select_tool("rectangle", view()).unwrap();
|
||||
(s, other)
|
||||
}
|
||||
|
||||
fn visible(s: &Session, id: NodeId) -> bool {
|
||||
s.doc().unwrap().doc.node(id).expect("the object is in the document").visible
|
||||
}
|
||||
|
||||
/// The objects of the document's first layer.
|
||||
fn objects(s: &Session) -> usize {
|
||||
s.doc().unwrap().doc.layers[0].children().map_or(0, Vec::len)
|
||||
}
|
||||
|
||||
/// The commands journaled from entry `start` on.
|
||||
fn journaled(s: &Session, start: usize) -> Vec<String> {
|
||||
s.journal.iter().skip(start).map(|(id, _)| id.clone()).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_command_during_a_drag_is_a_step_of_its_own_before_the_drag() {
|
||||
for real_time in [true, false] {
|
||||
let (mut s, other) = session(real_time);
|
||||
let (steps, start) = (s.doc().unwrap().history.undo.len(), s.journal.len());
|
||||
pointer(&mut s, PointerKind::Down, 100.0, 100.0);
|
||||
pointer(&mut s, PointerKind::Drag, 150.0, 150.0);
|
||||
s.execute("object.hide", &json!({"ids": [other.0]})).unwrap();
|
||||
assert!(!visible(&s, other), "real time {real_time}: the command hides the object at once");
|
||||
pointer(&mut s, PointerKind::Drag, 200.0, 180.0);
|
||||
assert!(!visible(&s, other), "real time {real_time}: the drag's next preview keeps the command's edit");
|
||||
pointer(&mut s, PointerKind::Up, 200.0, 180.0);
|
||||
assert!(!visible(&s, other), "real time {real_time}: the release keeps the command's edit");
|
||||
assert_eq!(objects(&s), 2, "real time {real_time}: the release draws the rectangle");
|
||||
let drawn = s.doc().unwrap().selection.objects[0];
|
||||
assert_ne!(drawn, other);
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[drawn], false), Some(Rect::new(100.0, 100.0, 200.0, 180.0)), "real time {real_time}");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "real time {real_time}: the command and the drag are a step each");
|
||||
assert_eq!(journaled(&s, start), ["object.hide", "shape.rectangle"], "real time {real_time}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(objects(&s), 1, "real time {real_time}: Undo takes back the drawn rectangle");
|
||||
assert!(!visible(&s, other), "real time {real_time}: and leaves the command's edit");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(visible(&s, other), "real time {real_time}: the next Undo takes back the command's edit");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escape_after_a_command_during_a_drag_keeps_the_command() {
|
||||
for real_time in [true, false] {
|
||||
let (mut s, other) = session(real_time);
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
pointer(&mut s, PointerKind::Down, 100.0, 100.0);
|
||||
pointer(&mut s, PointerKind::Drag, 150.0, 150.0);
|
||||
s.execute("object.hide", &json!({"ids": [other.0]})).unwrap();
|
||||
s.tool_key(ToolKey::Escape, Mods::default(), view()).unwrap();
|
||||
pointer(&mut s, PointerKind::Up, 150.0, 150.0);
|
||||
assert!(!visible(&s, other), "real time {real_time}: Escape takes back only the drag");
|
||||
assert_eq!(objects(&s), 1, "real time {real_time}: nothing is drawn");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "real time {real_time}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(visible(&s, other), "real time {real_time}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Every object of the first layer but `other`, as the document has it.
|
||||
fn others(s: &Session, other: NodeId) -> Vec<vectorcraft_doc::Node> {
|
||||
let d = &s.doc().unwrap().doc;
|
||||
d.layers[0].children().map_or_else(Vec::new, |c| c.iter().filter(|n| n.id != other).map(|n| (**n).clone()).collect())
|
||||
}
|
||||
|
||||
/// A new 400 × 400 pt document with Real-time Drawing `real_time`, holding a 40 × 40 pt square at
|
||||
/// (100, 100) and a 20 × 20 pt one at (10, 10) → the session, the larger square (selected) and the
|
||||
/// smaller one.
|
||||
fn two_squares(real_time: bool) -> (Session, NodeId, NodeId) {
|
||||
let mut s = Session::new();
|
||||
s.prefs.real_time_drawing = real_time;
|
||||
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
|
||||
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap();
|
||||
let other = s.doc().unwrap().selection.objects[0];
|
||||
s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 40, "height": 40})).unwrap();
|
||||
let target = s.doc().unwrap().selection.objects[0];
|
||||
(s, target, other)
|
||||
}
|
||||
|
||||
/// A press at the first point of `pts`, drags to the others and a release at the last, with
|
||||
/// `mid` run after the first drag.
|
||||
fn drag_with(s: &mut Session, pts: &[(f64, f64)], mid: impl FnOnce(&mut Session)) {
|
||||
let (&(x0, y0), rest) = pts.split_first().expect("a press");
|
||||
pointer(s, PointerKind::Down, x0, y0);
|
||||
let mut mid = Some(mid);
|
||||
for &(x, y) in rest {
|
||||
pointer(s, PointerKind::Drag, x, y);
|
||||
if let Some(f) = mid.take() {
|
||||
f(s);
|
||||
}
|
||||
}
|
||||
let &(x, y) = pts.last().expect("a release");
|
||||
pointer(s, PointerKind::Up, x, y);
|
||||
}
|
||||
|
||||
/// Is `id` filled red?
|
||||
fn red(s: &Session, id: NodeId) -> bool {
|
||||
s.doc().unwrap().doc.node(id).and_then(|n| n.appearance.fill_paint().color()).is_some_and(|c| c.to_hex() == "#ff0000")
|
||||
}
|
||||
|
||||
/// The Selection tool's move, the Scale and Rotate tools and the Pen, each with a command that
|
||||
/// fills another object red during the drag: the release keeps both, as two undo steps, and Undo
|
||||
/// takes back the drag first.
|
||||
#[test]
|
||||
fn the_move_scale_rotate_and_pen_drags_keep_a_command_run_during_them() {
|
||||
let drags: [(&str, &[(f64, f64)]); 4] = [
|
||||
("selection", &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)]),
|
||||
("scale", &[(150.0, 150.0), (170.0, 170.0), (190.0, 190.0)]),
|
||||
("rotate", &[(160.0, 120.0), (150.0, 150.0), (120.0, 160.0)]),
|
||||
("pen", &[(300.0, 300.0), (320.0, 300.0), (350.0, 320.0)]),
|
||||
];
|
||||
for (tool, pts) in drags {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("{tool}, real time {real_time}");
|
||||
let (mut s, _, other) = two_squares(real_time);
|
||||
if tool == "pen" {
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
}
|
||||
s.select_tool(tool, view()).unwrap();
|
||||
let (before, steps) = (others(&s, other), s.doc().unwrap().history.undo.len());
|
||||
drag_with(&mut s, pts, |s| {
|
||||
s.execute("paint.setFill", &json!({"ids": [other.0], "color": "#ff0000"})).unwrap();
|
||||
});
|
||||
assert!(!s.in_interaction(), "{at}");
|
||||
assert!(red(&s, other), "{at}: the release keeps the command's edit");
|
||||
assert_ne!(others(&s, other), before, "{at}: the release keeps the drag's edit");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "{at}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(others(&s, other), before, "{at}: Undo takes back the drag");
|
||||
assert!(red(&s, other), "{at}: and leaves the command's edit");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(!red(&s, other), "{at}: the next Undo takes back the command's edit");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A command that changes the object being moved: the move applies to the changed object.
|
||||
#[test]
|
||||
fn a_move_drag_moves_the_object_as_a_command_during_it_changed_it() {
|
||||
for real_time in [true, false] {
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let fill = |s: &Session| s.doc().unwrap().doc.node(target).unwrap().appearance.fill_paint().color().map(|c| c.to_hex());
|
||||
let was = fill(&s);
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute("paint.setFill", &json!({"ids": [target.0], "color": "#ff0000"})).unwrap();
|
||||
});
|
||||
let moved = s.doc().unwrap().doc.bounds_of(&[target], false);
|
||||
assert_eq!(moved, Some(Rect::new(150.0, 130.0, 190.0, 170.0)), "real time {real_time}");
|
||||
assert_eq!(fill(&s).as_deref(), Some("#ff0000"), "real time {real_time}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[target], false), Some(Rect::new(100.0, 100.0, 140.0, 140.0)), "real time {real_time}");
|
||||
assert_eq!(fill(&s).as_deref(), Some("#ff0000"), "real time {real_time}: the fill is a step of its own");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(fill(&s), was, "real time {real_time}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A command that deletes the object being moved: the drag goes on and ends without an edit of
|
||||
/// its own, on release and on Escape, and the deletion stays.
|
||||
#[test]
|
||||
fn a_move_drag_of_an_object_a_command_deleted_ends_without_an_edit() {
|
||||
for (real_time, escape) in [(true, false), (false, false), (true, true), (false, true)] {
|
||||
let at = format!("real time {real_time}, Escape {escape}");
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
pointer(&mut s, PointerKind::Down, 120.0, 120.0);
|
||||
pointer(&mut s, PointerKind::Drag, 140.0, 130.0);
|
||||
s.execute("edit.clear", &json!({"ids": [target.0]})).unwrap();
|
||||
assert!(s.doc().unwrap().doc.node(target).is_none(), "{at}");
|
||||
pointer(&mut s, PointerKind::Drag, 170.0, 150.0);
|
||||
if escape {
|
||||
s.tool_key(ToolKey::Escape, Mods::default(), view()).unwrap();
|
||||
}
|
||||
pointer(&mut s, PointerKind::Up, 170.0, 150.0);
|
||||
assert!(!s.in_interaction(), "{at}");
|
||||
assert!(s.doc().unwrap().doc.node(target).is_none(), "{at}: the deletion stays");
|
||||
assert_eq!(others(&s, other), [], "{at}");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "{at}: only the deletion is a step");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[target], false), Some(Rect::new(100.0, 100.0, 140.0, 140.0)), "{at}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A command that hides or locks the object being moved: the object stays where it was and
|
||||
/// unselected, and the drag ends without an edit of its own.
|
||||
#[test]
|
||||
fn a_move_drag_of_an_object_a_command_hid_or_locked_leaves_it_alone() {
|
||||
for command in ["object.hide", "object.lock"] {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("{command}, real time {real_time}");
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute(command, &json!({"ids": [target.0]})).unwrap();
|
||||
});
|
||||
assert!(!s.in_interaction(), "{at}");
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[target], false), Some(Rect::new(100.0, 100.0, 140.0, 140.0)), "{at}: not moved");
|
||||
assert!(!s.doc().unwrap().selection.objects.contains(&target), "{at}: not selected");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "{at}: only the command is a step");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The commands that end a drag first still do: Undo during a drag keeps the drag as a step and
|
||||
/// takes it back, and `command.batch` and `swatch.renameGroup` keep it as a step before their own.
|
||||
#[test]
|
||||
fn undo_and_a_batch_during_a_drag_still_keep_the_drag_first() {
|
||||
for real_time in [true, false] {
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
pointer(&mut s, PointerKind::Down, 120.0, 120.0);
|
||||
pointer(&mut s, PointerKind::Drag, 170.0, 150.0);
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(!s.in_interaction(), "real time {real_time}");
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[target], false), Some(Rect::new(100.0, 100.0, 140.0, 140.0)), "real time {real_time}");
|
||||
s.execute("edit.redo", &json!({})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[target], false), Some(Rect::new(150.0, 130.0, 190.0, 170.0)), "real time {real_time}");
|
||||
pointer(&mut s, PointerKind::Up, 170.0, 150.0);
|
||||
|
||||
let (mut s, target, other2) = two_squares(real_time);
|
||||
assert_eq!(other, other2);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
pointer(&mut s, PointerKind::Down, 120.0, 120.0);
|
||||
pointer(&mut s, PointerKind::Drag, 170.0, 150.0);
|
||||
s.execute("command.batch", &json!({"commands": [{"command": "object.hide", "params": {"ids": [other.0]}}]})).unwrap();
|
||||
assert!(!s.in_interaction(), "real time {real_time}: the batch keeps the drag first");
|
||||
pointer(&mut s, PointerKind::Up, 170.0, 150.0);
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "real time {real_time}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(visible(&s, other), "real time {real_time}: Undo takes back the batch first");
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[target], false), Some(Rect::new(150.0, 130.0, 190.0, 170.0)), "real time {real_time}");
|
||||
|
||||
// A color group renamed during the drag keeps the drag as a step before the rename.
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
pointer(&mut s, PointerKind::Down, 120.0, 120.0);
|
||||
pointer(&mut s, PointerKind::Drag, 170.0, 150.0);
|
||||
s.execute("swatch.renameGroup", &json!({"group": "Brights", "name": "Vivid"})).unwrap();
|
||||
assert!(!s.in_interaction(), "real time {real_time}: the rename keeps the drag first");
|
||||
pointer(&mut s, PointerKind::Up, 170.0, 150.0);
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "real time {real_time}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(s.doc().unwrap().doc.swatch_groups.iter().any(|g| g.name == "Brights"), "real time {real_time}: Undo takes back the rename");
|
||||
assert_eq!(s.doc().unwrap().doc.bounds_of(&[target], false), Some(Rect::new(150.0, 130.0, 190.0, 170.0)), "real time {real_time}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A copy made with `object.transform` during an Alt-drag runs inside the drag, with Real-time
|
||||
/// Drawing on and off: the release records one step that holds both.
|
||||
#[test]
|
||||
fn a_copy_during_an_alt_drag_is_part_of_the_drag() {
|
||||
for real_time in [true, false] {
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
let alt = Mods { alt: true, ..Mods::default() };
|
||||
for (kind, x, y) in [(PointerKind::Down, 120.0, 120.0), (PointerKind::Drag, 170.0, 150.0)] {
|
||||
s.pointer(&PointerEvent::new(kind, x, y).with_mods(alt), view()).unwrap();
|
||||
}
|
||||
s.execute("object.transform", &json!({"matrix": [1, 0, 0, 1, 0, 60], "copy": true, "ids": [target.0]})).unwrap();
|
||||
s.pointer(&PointerEvent::new(PointerKind::Up, 170.0, 150.0).with_mods(alt), view()).unwrap();
|
||||
assert!(!s.in_interaction(), "real time {real_time}");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "real time {real_time}: one step for the drag and the copy");
|
||||
|
||||
// With Alt let go during the drag, the drag moves again, and the copy is a step of its own.
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
s.pointer(&PointerEvent::new(PointerKind::Down, 120.0, 120.0).with_mods(alt), view()).unwrap();
|
||||
s.pointer(&PointerEvent::new(PointerKind::Drag, 150.0, 140.0).with_mods(alt), view()).unwrap();
|
||||
pointer(&mut s, PointerKind::Drag, 170.0, 150.0);
|
||||
s.execute("object.transform", &json!({"matrix": [1, 0, 0, 1, 0, 60], "copy": true, "ids": [target.0]})).unwrap();
|
||||
pointer(&mut s, PointerKind::Up, 170.0, 150.0);
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "real time {real_time}: the copy and the move");
|
||||
}
|
||||
}
|
||||
|
||||
/// A command that changes only the current layer during a drag keeps its change through Escape.
|
||||
#[test]
|
||||
fn escape_keeps_a_current_layer_set_during_a_drag() {
|
||||
for real_time in [true, false] {
|
||||
let (mut s, _) = session(real_time);
|
||||
let first = s.doc().unwrap().active_layer;
|
||||
let second = NodeId(s.execute("layer.new", &json!({})).unwrap()["id"].as_u64().unwrap());
|
||||
let first = first.expect("a current layer");
|
||||
s.execute("layer.setCurrent", &json!({"id": first.0})).unwrap();
|
||||
pointer(&mut s, PointerKind::Down, 100.0, 100.0);
|
||||
pointer(&mut s, PointerKind::Drag, 150.0, 150.0);
|
||||
s.execute("layer.setCurrent", &json!({"id": second.0})).unwrap();
|
||||
s.tool_key(ToolKey::Escape, Mods::default(), view()).unwrap();
|
||||
pointer(&mut s, PointerKind::Up, 150.0, 150.0);
|
||||
assert_eq!(s.doc().unwrap().active_layer, Some(second), "real time {real_time}");
|
||||
}
|
||||
}
|
||||
|
||||
/// With Real-time Drawing on, the drag's preview is on show again right after the command.
|
||||
#[test]
|
||||
fn the_drag_preview_shows_again_after_the_command() {
|
||||
let (mut s, other) = session(true);
|
||||
pointer(&mut s, PointerKind::Down, 100.0, 100.0);
|
||||
pointer(&mut s, PointerKind::Drag, 150.0, 150.0);
|
||||
assert_eq!(objects(&s), 2, "the preview draws the rectangle");
|
||||
s.execute("object.hide", &json!({"ids": [other.0]})).unwrap();
|
||||
assert_eq!(objects(&s), 2, "the preview is on show after the command");
|
||||
s.execute("object.showAll", &json!({})).unwrap();
|
||||
assert_eq!(objects(&s), 2, "and after a second one");
|
||||
assert!(visible(&s, other));
|
||||
assert!(s.in_interaction());
|
||||
pointer(&mut s, PointerKind::Up, 150.0, 150.0);
|
||||
assert_eq!(objects(&s), 2);
|
||||
assert!(visible(&s, other));
|
||||
}
|
||||
|
||||
/// A command that changes the selection during a move drag (Select All, Deselect, a duplicate)
|
||||
/// leaves the drag moving the object it began with.
|
||||
#[test]
|
||||
fn a_selection_made_during_a_move_drag_leaves_the_drag_moving_its_object() {
|
||||
for command in ["select.all", "select.none", "edit.duplicate"] {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("{command}, real time {real_time}");
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute(command, &json!({})).unwrap();
|
||||
});
|
||||
let d = &s.doc().unwrap().doc;
|
||||
assert_eq!(d.bounds_of(&[target], false), Some(Rect::new(150.0, 130.0, 190.0, 170.0)), "{at}: the drag moves its object");
|
||||
assert_eq!(d.bounds_of(&[other], false), Some(Rect::new(10.0, 10.0, 30.0, 30.0)), "{at}: and nothing else");
|
||||
if command == "edit.duplicate" {
|
||||
let copies = others(&s, other).into_iter().filter(|n| n.id != target).map(|n| n.id).collect::<Vec<_>>();
|
||||
assert_eq!(copies.len(), 1, "{at}");
|
||||
assert_eq!(d.bounds_of(&copies, false), Some(Rect::new(100.0, 100.0, 140.0, 140.0)), "{at}: the copy stays where it was made");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A command that selects another object during a move drag: the drag's object stays selected,
|
||||
/// and the fill and stroke proxies keep showing its paints.
|
||||
#[test]
|
||||
fn a_selection_made_during_a_move_drag_leaves_the_paints_of_the_drag_object() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.execute("paint.setFill", &json!({"ids": [target.0], "color": "#ff0000"})).unwrap();
|
||||
s.execute("paint.setFill", &json!({"ids": [other.0], "color": "#0000ff"})).unwrap();
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [target.0]})).unwrap();
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let fill = |s: &Session| s.paint.fill.color().map(|c| c.to_hex());
|
||||
assert_eq!(fill(&s).as_deref(), Some("#ff0000"), "{at}");
|
||||
pointer(&mut s, PointerKind::Down, 120.0, 120.0);
|
||||
pointer(&mut s, PointerKind::Drag, 140.0, 130.0);
|
||||
s.execute("select.set", &json!({"ids": [other.0]})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().selection.objects, [target], "{at}");
|
||||
assert_eq!(fill(&s).as_deref(), Some("#ff0000"), "{at}: after the command");
|
||||
pointer(&mut s, PointerKind::Drag, 170.0, 150.0);
|
||||
pointer(&mut s, PointerKind::Up, 170.0, 150.0);
|
||||
assert_eq!(s.doc().unwrap().selection.objects, [target], "{at}");
|
||||
assert_eq!(fill(&s).as_deref(), Some("#ff0000"), "{at}: after the release");
|
||||
}
|
||||
}
|
||||
|
||||
/// Replay the journal of `s` from `start` on `replayed`.
|
||||
fn replay_from(s: &Session, start: usize, replayed: &mut Session) {
|
||||
for (id, p) in s.journal.iter().skip(start) {
|
||||
replayed.replay(id, p).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// The journal of a move drag with a selection command run during it replays as the drag went:
|
||||
/// the drag moves its own object, not the one the command selected.
|
||||
#[test]
|
||||
fn a_move_drag_after_a_selection_command_replays_on_its_own_object() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let start = s.journal.len();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute("select.set", &json!({"ids": [other.0]})).unwrap();
|
||||
});
|
||||
let bounds = |s: &Session| {
|
||||
let d = &s.doc().unwrap().doc;
|
||||
(d.bounds_of(&[target], false), d.bounds_of(&[other], false))
|
||||
};
|
||||
assert_eq!(bounds(&s), (Some(Rect::new(150.0, 130.0, 190.0, 170.0)), Some(Rect::new(10.0, 10.0, 30.0, 30.0))), "{at}");
|
||||
let (mut replayed, _, _) = two_squares(real_time);
|
||||
replay_from(&s, start, &mut replayed);
|
||||
assert_eq!(bounds(&replayed), bounds(&s), "{at}: {:?}", journaled(&s, start));
|
||||
assert_eq!(replayed.doc().unwrap().selection.objects, s.doc().unwrap().selection.objects, "{at}");
|
||||
assert_eq!(replayed.doc().unwrap().active_layer, s.doc().unwrap().active_layer, "{at}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Find Objects with `select` during a drag is a step of its own, as it is journaled: it finds and
|
||||
/// selects only the objects outside the drag's preview, as its replay before the drag does.
|
||||
#[test]
|
||||
fn find_objects_with_select_during_a_drag_skips_the_drag_preview() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, other) = session(real_time);
|
||||
let start = s.journal.len();
|
||||
let find = json!({"intersects": [0, 0, 400, 400], "select": true});
|
||||
pointer(&mut s, PointerKind::Down, 100.0, 100.0);
|
||||
pointer(&mut s, PointerKind::Drag, 150.0, 150.0);
|
||||
let r = s.execute("document.find", &find).unwrap();
|
||||
assert_eq!(r["total"], 1, "{at}: {r}");
|
||||
assert_eq!(r["matches"][0]["id"], other.0, "{at}: {r}");
|
||||
pointer(&mut s, PointerKind::Up, 200.0, 180.0);
|
||||
assert_eq!(objects(&s), 2, "{at}: the release draws the rectangle");
|
||||
// The drag's own selection is journaled after the find, so the release replays on it.
|
||||
assert_eq!(journaled(&s, start), ["document.find", "select.set", "shape.rectangle"], "{at}");
|
||||
let (mut replayed, _) = session(real_time);
|
||||
replay_from(&s, start, &mut replayed);
|
||||
assert_eq!(objects(&replayed), 2, "{at}");
|
||||
assert_eq!(replayed.doc().unwrap().selection.objects, s.doc().unwrap().selection.objects, "{at}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A square on a second layer selected with a ruler guide, and a square on the first layer →
|
||||
/// the session (with Real-time Drawing `real_time`) and the square on the first layer.
|
||||
fn square_and_guide(real_time: bool) -> (Session, NodeId) {
|
||||
let mut s = Session::new();
|
||||
s.prefs.real_time_drawing = real_time;
|
||||
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
|
||||
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap();
|
||||
let other = s.doc().unwrap().selection.objects[0];
|
||||
s.execute("layer.new", &json!({})).unwrap();
|
||||
s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 40, "height": 40})).unwrap();
|
||||
let target = s.doc().unwrap().selection.objects[0];
|
||||
s.execute("guide.add", &json!({"vertical": true, "pos": 300})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [target.0]})).unwrap();
|
||||
s.execute("guide.select", &json!({"indexes": [0], "toggle": true})).unwrap();
|
||||
(s, other)
|
||||
}
|
||||
|
||||
/// The journal of a move drag of a square and a ruler guide, with a command during it that
|
||||
/// selects an object on another layer, replays with the drag's selection, guide included, with
|
||||
/// the layer the command made current and with the Layers panel rows the command left highlighted.
|
||||
#[test]
|
||||
fn a_move_drag_of_a_guide_after_a_selection_command_replays_its_selection_and_layer() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, other) = square_and_guide(real_time);
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
let start = s.journal.len();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute("select.set", &json!({"ids": [other.0]})).unwrap();
|
||||
});
|
||||
let (mut replayed, _) = square_and_guide(real_time);
|
||||
replay_from(&s, start, &mut replayed);
|
||||
let state = |s: &mut Session| {
|
||||
let d = s.doc().unwrap();
|
||||
let state = (
|
||||
d.selection.objects.clone(),
|
||||
d.selection.guides.clone(),
|
||||
d.active_layer,
|
||||
d.highlighted_rows(),
|
||||
d.doc.bounds_of(&d.selection.objects, false),
|
||||
);
|
||||
(state, s.execute("guide.list", &json!({})).unwrap())
|
||||
};
|
||||
assert_eq!(state(&mut replayed), state(&mut s), "{at}: {:?}", journaled(&s, start));
|
||||
}
|
||||
}
|
||||
|
||||
/// The journal of a move drag of a targeted square, with a command during it that selects another
|
||||
/// square, replays with the square targeted, as the drag leaves it.
|
||||
#[test]
|
||||
fn a_move_drag_of_a_targeted_object_after_a_selection_command_replays_its_target() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let setup = || {
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.execute("layer.target", &json!({"id": target.0})).unwrap();
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
(s, other)
|
||||
};
|
||||
let (mut s, other) = setup();
|
||||
let start = s.journal.len();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute("select.set", &json!({"ids": [other.0]})).unwrap();
|
||||
});
|
||||
let (mut replayed, _) = setup();
|
||||
replay_from(&s, start, &mut replayed);
|
||||
let state = |s: &Session| {
|
||||
let d = s.doc().unwrap();
|
||||
(d.selection.objects.clone(), d.selection.target, d.doc.bounds_of(&d.selection.objects, false))
|
||||
};
|
||||
assert_eq!(state(&replayed), state(&s), "{at}: {:?}", journaled(&s, start));
|
||||
}
|
||||
}
|
||||
|
||||
/// The journal of a move drag of a targeted square and a ruler guide, with a command during it
|
||||
/// that selects another square, replays with the square targeted and the guide selected.
|
||||
#[test]
|
||||
fn a_move_drag_of_a_targeted_object_and_a_guide_after_a_selection_command_replays_both() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let setup = || {
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.execute("guide.add", &json!({"vertical": true, "pos": 300})).unwrap();
|
||||
s.execute("layer.target", &json!({"id": target.0})).unwrap();
|
||||
s.execute("guide.select", &json!({"indexes": [0], "toggle": true})).unwrap();
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
(s, target, other)
|
||||
};
|
||||
let (mut s, target, other) = setup();
|
||||
let start = s.journal.len();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute("select.set", &json!({"ids": [other.0]})).unwrap();
|
||||
});
|
||||
let state = |s: &mut Session| {
|
||||
let d = s.doc().unwrap();
|
||||
let state = (d.selection.objects.clone(), d.selection.target, d.selection.guides.clone(), d.doc.bounds_of(&d.selection.objects, false));
|
||||
(state, s.execute("guide.list", &json!({})).unwrap())
|
||||
};
|
||||
let live = state(&mut s);
|
||||
assert_eq!((live.0.1, live.0.2.len()), (Some(target), 1), "{at}: the drag leaves the square targeted and the guide selected");
|
||||
let (mut replayed, _, _) = setup();
|
||||
replay_from(&s, start, &mut replayed);
|
||||
assert_eq!(state(&mut replayed), live, "{at}: {:?}", journaled(&s, start));
|
||||
}
|
||||
}
|
||||
|
||||
/// The journal of a move drag of a path with every anchor selected as anchor points, with a
|
||||
/// command during it that selects another square, replays with those anchors selected.
|
||||
#[test]
|
||||
fn a_move_drag_of_every_anchor_of_a_path_after_a_selection_command_replays_its_anchors() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let setup = || {
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.execute("select.set", &json!({"ids": [target.0]})).unwrap();
|
||||
s.execute("select.anchors", &json!({"id": target.0, "anchors": [[0, 0]], "mode": "add"})).unwrap();
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
(s, target, other)
|
||||
};
|
||||
let (mut s, target, other) = setup();
|
||||
let every = s.doc().unwrap().selection.anchors.get(&target).cloned();
|
||||
assert!(every.as_ref().is_some_and(|a| a.len() > 1), "{at}: {every:?}");
|
||||
let start = s.journal.len();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute("select.set", &json!({"ids": [other.0]})).unwrap();
|
||||
});
|
||||
let state = |s: &Session| {
|
||||
let d = s.doc().unwrap();
|
||||
(d.selection.objects.clone(), d.selection.anchors.clone(), d.doc.bounds_of(&d.selection.objects, false))
|
||||
};
|
||||
assert_eq!(state(&s).1.get(&target), every.as_ref(), "{at}: the drag leaves every anchor selected as anchors");
|
||||
let (mut replayed, _, _) = setup();
|
||||
replay_from(&s, start, &mut replayed);
|
||||
assert_eq!(state(&replayed), state(&s), "{at}: {:?}", journaled(&s, start));
|
||||
}
|
||||
}
|
||||
|
||||
/// The journal of a move drag of a targeted layer's art, with a duplicate made on that layer
|
||||
/// during it, replays with the drag moving its own objects, not the duplicates.
|
||||
#[test]
|
||||
fn a_move_drag_of_a_targeted_layer_after_a_duplicate_replays_its_objects() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let setup = || {
|
||||
let (mut s, _, _) = two_squares(real_time);
|
||||
let layer = s.doc().unwrap().doc.layers[0].id;
|
||||
s.execute("layer.target", &json!({"id": layer.0})).unwrap();
|
||||
s.select_tool("selection", view()).unwrap();
|
||||
s
|
||||
};
|
||||
let mut s = setup();
|
||||
let start = s.journal.len();
|
||||
drag_with(&mut s, &[(120.0, 120.0), (140.0, 130.0), (170.0, 150.0)], |s| {
|
||||
s.execute("edit.duplicate", &json!({})).unwrap();
|
||||
});
|
||||
let mut replayed = setup();
|
||||
replay_from(&s, start, &mut replayed);
|
||||
let state = |s: &Session| {
|
||||
let d = s.doc().unwrap();
|
||||
(d.selection.objects.clone(), d.doc.bounds_of(&d.selection.objects, false), objects(s))
|
||||
};
|
||||
assert_eq!(state(&replayed), state(&s), "{at}: {:?}", journaled(&s, start));
|
||||
}
|
||||
}
|
||||
|
||||
/// A selected user slice and a square → the session (with Real-time Drawing `real_time`), the
|
||||
/// slice and the square.
|
||||
fn slice_and_square(real_time: bool) -> (Session, NodeId, NodeId) {
|
||||
let mut s = Session::new();
|
||||
s.prefs.real_time_drawing = real_time;
|
||||
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
|
||||
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap();
|
||||
let other = s.doc().unwrap().selection.objects[0];
|
||||
let slice = s.execute("object.slice.create", &json!({"x": 200, "y": 200, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("object.slice.select", &json!({"slices": [slice]})).unwrap();
|
||||
(s, NodeId(slice), other)
|
||||
}
|
||||
|
||||
/// The journal of a Slice Selection drag, with a command during it that selects an object,
|
||||
/// replays with the slice selected, as the drag leaves it.
|
||||
#[test]
|
||||
fn a_slice_drag_after_a_selection_command_replays_its_slice_selection() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, slice, other) = slice_and_square(real_time);
|
||||
s.select_tool("sliceSelection", view()).unwrap();
|
||||
let start = s.journal.len();
|
||||
drag_with(&mut s, &[(220.0, 220.0), (230.0, 230.0), (240.0, 240.0)], |s| {
|
||||
s.execute("select.set", &json!({"ids": [other.0]})).unwrap();
|
||||
});
|
||||
assert_eq!(s.doc().unwrap().selection.slices, [slice], "{at}");
|
||||
let (mut replayed, _, _) = slice_and_square(real_time);
|
||||
replay_from(&s, start, &mut replayed);
|
||||
let state = |s: &Session| {
|
||||
let sel = &s.doc().unwrap().selection;
|
||||
(sel.objects.clone(), sel.slices.clone())
|
||||
};
|
||||
assert_eq!(state(&replayed), state(&s), "{at}: {:?}", journaled(&s, start));
|
||||
}
|
||||
}
|
||||
|
||||
/// A Warp stroke over two selected squares, with a command that deletes one of them during the
|
||||
/// stroke: the release still warps the other square, and the stroke's journal entry names it.
|
||||
#[test]
|
||||
fn a_warp_stroke_over_an_object_a_command_deleted_still_warps_the_others() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, target, other) = two_squares(real_time);
|
||||
s.execute("select.all", &json!({})).unwrap();
|
||||
s.select_tool("warp", view()).unwrap();
|
||||
let before = s.doc().unwrap().doc.node(target).cloned();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
pointer(&mut s, PointerKind::Down, 120.0, 120.0);
|
||||
pointer(&mut s, PointerKind::Drag, 135.0, 125.0);
|
||||
let r = s.execute("edit.clear", &json!({"ids": [other.0]})).unwrap();
|
||||
assert!(r.get("warning").is_none(), "{at}: {r}");
|
||||
pointer(&mut s, PointerKind::Up, 135.0, 125.0);
|
||||
assert!(!s.in_interaction(), "{at}");
|
||||
assert!(s.doc().unwrap().doc.node(other).is_none(), "{at}: the deletion stays");
|
||||
assert_ne!(s.doc().unwrap().doc.node(target).cloned(), before, "{at}: the release warps the other square");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "{at}: the deletion and the stroke are a step each");
|
||||
let (id, p) = s.journal.last().unwrap();
|
||||
assert_eq!((id.as_str(), &p["ids"]), ("object.liquify", &json!([target.0])), "{at}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The Scale and Rotate tools and the Pen adding to a path, with a command that deletes the
|
||||
/// object they act on during the drag: the drag ends without an edit of its own and the deletion
|
||||
/// stays.
|
||||
#[test]
|
||||
fn a_scale_rotate_or_pen_drag_of_an_object_a_command_deleted_ends_without_an_edit() {
|
||||
let drags: [(&str, &[(f64, f64)]); 3] = [
|
||||
("scale", &[(150.0, 150.0), (170.0, 170.0), (190.0, 190.0)]),
|
||||
("rotate", &[(160.0, 120.0), (150.0, 150.0), (120.0, 160.0)]),
|
||||
("pen", &[(350.0, 350.0), (370.0, 360.0), (380.0, 380.0)]),
|
||||
];
|
||||
for (tool, pts) in drags {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("{tool}, real time {real_time}");
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.select_tool(tool, view()).unwrap();
|
||||
let target = if tool == "pen" {
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
for (x, y) in [(300.0, 300.0), (350.0, 300.0)] {
|
||||
pointer(&mut s, PointerKind::Down, x, y);
|
||||
pointer(&mut s, PointerKind::Up, x, y);
|
||||
}
|
||||
s.doc().unwrap().selection.objects[0]
|
||||
} else {
|
||||
target
|
||||
};
|
||||
let before = s.doc().unwrap().doc.clone();
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
drag_with(&mut s, pts, |s| {
|
||||
s.execute("edit.clear", &json!({"ids": [target.0]})).unwrap();
|
||||
});
|
||||
assert!(!s.in_interaction(), "{at}");
|
||||
assert!(s.doc().unwrap().doc.node(target).is_none(), "{at}: the deletion stays");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "{at}: only the deletion is a step");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(*s.doc().unwrap().doc, *before, "{at}: Undo brings the object back as it was");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A Direct Selection drag of an anchor, with a command during it that numbers the path's anchors
|
||||
/// anew (Add Anchor Point before the dragged one, Reverse Path Direction): the command's edit
|
||||
/// stays, the drag ends without an edit of its own and moves no other anchor of the path.
|
||||
#[test]
|
||||
fn an_anchor_drag_after_a_command_renumbers_its_anchors_moves_no_other_anchor() {
|
||||
let commands = [("path.insertAnchor", json!({"segment": 0, "t": 0.5}), 1), ("path.reverse", json!({}), 0)];
|
||||
for ((id, params, added), real_time) in commands.iter().flat_map(|c| [(c, true), (c, false)]) {
|
||||
let at = format!("{id}, real time {real_time}");
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
s.select_tool("directSelection", view()).unwrap();
|
||||
let points = |s: &Session| -> Vec<(f64, f64)> {
|
||||
let doc = &s.doc().unwrap().doc;
|
||||
let path = doc.node(target).and_then(|n| n.path_data()).expect("the square is a path");
|
||||
path.anchors().map(|(_, _, a)| (a.p.x, a.p.y)).collect()
|
||||
};
|
||||
let before = points(&s);
|
||||
let &(x, y) = before.last().expect("the square has anchors");
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
let mut params = params.clone();
|
||||
params["id"] = json!(target.0);
|
||||
drag_with(&mut s, &[(x, y), (x + 10.0, y + 10.0), (x + 30.0, y + 20.0)], |s| {
|
||||
s.execute(id, ¶ms).unwrap();
|
||||
});
|
||||
assert!(!s.in_interaction(), "{at}");
|
||||
let after = points(&s);
|
||||
assert_eq!(after.len(), before.len() + added, "{at}: the command's edit stays");
|
||||
assert!(before.iter().all(|p| after.contains(p)), "{at}: no anchor of the square moved: {before:?} → {after:?}");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "{at}: only the command is a step");
|
||||
}
|
||||
}
|
||||
|
||||
/// A Direct Selection drag of an anchor, with a command during it that moves the path: the drag
|
||||
/// goes on and moves the same anchor of the moved path.
|
||||
#[test]
|
||||
fn an_anchor_drag_after_a_command_moves_its_path_moves_the_same_anchor() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, target, _) = two_squares(real_time);
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
s.select_tool("directSelection", view()).unwrap();
|
||||
let points = |s: &Session| -> Vec<(f64, f64)> {
|
||||
let doc = &s.doc().unwrap().doc;
|
||||
let path = doc.node(target).and_then(|n| n.path_data()).expect("the square is a path");
|
||||
path.anchors().map(|(_, _, a)| (a.p.x, a.p.y)).collect()
|
||||
};
|
||||
let before = points(&s);
|
||||
let &(x, y) = before.last().expect("the square has anchors");
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
drag_with(&mut s, &[(x, y), (x + 10.0, y + 10.0), (x + 30.0, y + 20.0)], |s| {
|
||||
s.execute("object.move", &json!({"ids": [target.0], "dx": 0, "dy": 50})).unwrap();
|
||||
});
|
||||
let after = points(&s);
|
||||
let last = before.len() - 1;
|
||||
let moved: Vec<(f64, f64)> =
|
||||
before.iter().enumerate().map(|(i, &(px, py))| if i == last { (px + 30.0, py + 70.0) } else { (px, py + 50.0) }).collect();
|
||||
assert_eq!(after, moved, "{at}: the drag moves the same anchor of the moved square");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "{at}: the move and the drag are a step each");
|
||||
}
|
||||
}
|
||||
|
||||
/// With the Live Paint Bucket's Selection tool (Cmd+drag), a fill chosen during the drag stays the
|
||||
/// new-art fill after the release and after Escape, though the drag puts back the bucket's colors
|
||||
/// it began with.
|
||||
#[test]
|
||||
fn a_fill_chosen_during_a_bucket_drag_stays() {
|
||||
for (real_time, escape) in [(true, false), (false, false), (true, true), (false, true)] {
|
||||
let at = format!("real time {real_time}, Escape {escape}");
|
||||
let (mut s, _, _) = two_squares(real_time);
|
||||
s.select_tool("livePaintBucket", view()).unwrap();
|
||||
let cmd = Mods { cmd: true, ..Mods::default() };
|
||||
for (kind, x, y) in [(PointerKind::Down, 120.0, 120.0), (PointerKind::Drag, 140.0, 130.0)] {
|
||||
s.pointer(&PointerEvent::new(kind, x, y).with_mods(cmd), view()).unwrap();
|
||||
}
|
||||
assert!(s.in_interaction(), "{at}: the lent Selection tool drags the square");
|
||||
s.execute("paint.setFill", &json!({"color": "#00ff00", "ids": []})).unwrap();
|
||||
let green = s.paint.fill.clone();
|
||||
s.pointer(&PointerEvent::new(PointerKind::Drag, 170.0, 150.0).with_mods(cmd), view()).unwrap();
|
||||
if escape {
|
||||
s.tool_key(ToolKey::Escape, Mods::default(), view()).unwrap();
|
||||
}
|
||||
s.pointer(&PointerEvent::new(PointerKind::Up, 170.0, 150.0).with_mods(cmd), view()).unwrap();
|
||||
assert_eq!(s.paint.fill, green, "{at}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A command run during a Quick Pen press still runs inside the press, so it records no undo
|
||||
/// step of its own while the press is held.
|
||||
#[test]
|
||||
fn a_command_during_a_quick_pen_press_runs_inside_it() {
|
||||
for real_time in [true, false] {
|
||||
let at = format!("real time {real_time}");
|
||||
let (mut s, other) = session(real_time);
|
||||
s.select_tool(vectorcraft_tools::quickpen::ID, view()).unwrap();
|
||||
pointer(&mut s, PointerKind::Down, 50.0, 50.0);
|
||||
pointer(&mut s, PointerKind::Up, 50.0, 50.0);
|
||||
pointer(&mut s, PointerKind::Down, 100.0, 100.0);
|
||||
pointer(&mut s, PointerKind::Drag, 150.0, 120.0);
|
||||
assert!(s.in_interaction(), "{at}: the press drags a piece");
|
||||
let steps = s.doc().unwrap().history.undo.len();
|
||||
s.execute("object.hide", &json!({"ids": [other.0]})).unwrap();
|
||||
assert!(s.in_interaction(), "{at}");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps, "{at}: no step of its own during the press");
|
||||
}
|
||||
}
|
||||
@@ -618,6 +618,7 @@ impl Session {
|
||||
path_only: self.prefs.object_selection_by_path_only,
|
||||
type_path_only: self.prefs.type_selection_by_path_only,
|
||||
double_click_isolate: self.prefs.double_click_to_isolate,
|
||||
double_click_adds_anchor: self.prefs.double_click_adds_anchor_points,
|
||||
select_behind: self.prefs.ctrl_click_selects_behind,
|
||||
highlight_anchors: self.prefs.highlight_anchors_on_hover,
|
||||
snap_tolerance: self.prefs.snap_to_point_tolerance,
|
||||
@@ -1727,6 +1728,10 @@ impl Session {
|
||||
|
||||
/// Apply tool actions. Errors from previews are reported but keep the interaction alive.
|
||||
pub fn apply_actions(&mut self, acts: Vec<Action>) -> Result<Vec<UiRequest>> {
|
||||
// The tool acts on its own interaction, which a command from outside it may have set aside.
|
||||
if !acts.is_empty() {
|
||||
self.put_back_interaction();
|
||||
}
|
||||
let outer = std::mem::replace(&mut self.in_tool_actions, true);
|
||||
let outer_bucket = self.back_to_bucket;
|
||||
// The Eyedropper's sample into a stop of the Live Paint Bucket's gradient, which switches back to the bucket.
|
||||
@@ -1752,7 +1757,16 @@ impl Session {
|
||||
let mut ui = vec![];
|
||||
for a in acts {
|
||||
match a {
|
||||
Action::Begin(label) => self.begin_interaction(&label)?,
|
||||
Action::Begin(label) => {
|
||||
// The snapshot of the interaction open before, which the tool's drag then joins.
|
||||
let open = self.active().and_then(|st| st.interaction.as_ref()).map(|it| std::sync::Arc::as_ptr(&it.doc));
|
||||
self.begin_interaction(&label)?;
|
||||
if let Some(it) = self.active_mut().and_then(|st| st.interaction.as_mut())
|
||||
&& open != Some(std::sync::Arc::as_ptr(&it.doc))
|
||||
{
|
||||
it.tool = true;
|
||||
}
|
||||
}
|
||||
Action::Preview(cmd, p) => {
|
||||
// Performance › Real-time Drawing and Editing (#394): off, remember the latest
|
||||
// params and apply them once on Commit instead of every move. A ruler guide
|
||||
|
||||
@@ -789,7 +789,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"window.learn",
|
||||
"Learn",
|
||||
"",
|
||||
"{show?: bool} show (true), hide (false) or toggle (omitted or null) the Learn panel, as Window › Learn and the app bar's Explore tutorials button do; any other value is an error and changes nothing; returns whether the panel shows",
|
||||
"{show?: bool} show (true), hide (false) or toggle (omitted or null) the Learn panel, as Window › Learn does; any other value is an error and changes nothing; returns whether the panel shows",
|
||||
),
|
||||
(
|
||||
"learn.list",
|
||||
|
||||
@@ -284,6 +284,9 @@ pub struct ToolContext<'a> {
|
||||
/// General → Double Click To Isolate: a double-click on a group with the Selection tool
|
||||
/// isolates it.
|
||||
pub double_click_isolate: bool,
|
||||
/// General → Double-Click Adds Anchor Points: a plain double-click on a path segment with Direct
|
||||
/// Selection adds an anchor there.
|
||||
pub double_click_adds_anchor: bool,
|
||||
/// Selection & Anchor Display → Command Click to Select Objects Behind: Cmd/Ctrl-click with the
|
||||
/// Selection tool selects the object under the selected one, the next click the one under
|
||||
/// that.
|
||||
|
||||
@@ -863,6 +863,31 @@ fn segment_at(cx: &ToolContext, id: NodeId, p: Point) -> Option<SegmentHit> {
|
||||
Some(SegmentHit { si, seg, t, curved: a.has_out() || b.has_in() })
|
||||
}
|
||||
|
||||
/// With General › Double-Click Adds Anchor Points on, a plain
|
||||
/// double-click on a path segment adds an anchor there, the new anchor alone selected. The path is
|
||||
/// the one whose stroke or outline a press at `p` hits, a clipping path included. An anchor or a
|
||||
/// center point under the pointer comes first, so nothing is added (the caller has already given
|
||||
/// way to the handles, mesh points and blend spine points a press takes first). The path's own
|
||||
/// line must pass within the pick tolerance of `p`: a click on a wide stroke or on the drawn
|
||||
/// outline of an effect farther from the path adds nothing.
|
||||
fn add_anchor_at(cx: &ToolContext, ev: &PointerEvent, p: Point) -> Option<Action> {
|
||||
let m = ev.mods;
|
||||
if !cx.double_click_adds_anchor || m.shift || m.alt || m.cmd || m.ctrl {
|
||||
return None;
|
||||
}
|
||||
let (tol, point) = (cx.pick_tol(), cx.point_tol());
|
||||
if hit_anchor(cx, p, point).is_some() || hit_center(cx, p, point).is_some() {
|
||||
return None;
|
||||
}
|
||||
let h = hit_test(cx.doc, p, cx.selection_hit_options()).filter(|h| matches!(h.kind, HitKind::Stroke | HitKind::Outline))?;
|
||||
let id = cx.doc.node(h.leaf).and_then(|n| compound_part_at(n, p, tol)).unwrap_or(h.leaf);
|
||||
if !cx.doc.node(id).is_some_and(|n| matches!(n.kind, NodeKind::Path { .. })) {
|
||||
return None;
|
||||
}
|
||||
let (id, si, seg, t) = crate::draw2::segment_in(cx, [id], p, tol)?;
|
||||
Some(Action::Exec("path.insertAnchor".into(), json!({"id": id.0, "subpath": si, "segment": seg, "t": t, "selectAnchor": true})))
|
||||
}
|
||||
|
||||
impl Tool for DirectSelectionTool {
|
||||
/// The pointer hovers nothing for the tool: no bracket is highlighted.
|
||||
fn hover_ended(&mut self, _cx: &ToolContext) {
|
||||
@@ -1484,6 +1509,9 @@ impl DirectSelectionTool {
|
||||
if crate::rulerguide::guide_at(cx, p).is_some() {
|
||||
return vec![];
|
||||
}
|
||||
if let Some(a) = add_anchor_at(cx, ev, p).filter(|_| !self.takes_point(cx, p)) {
|
||||
return vec![a];
|
||||
}
|
||||
// A double-click edits what is drawn: not a clipping path's outline.
|
||||
let hit = hit_test(cx.doc, p, cx.hit_options());
|
||||
if hit.as_ref().and_then(|h| cx.doc.node(h.leaf)).is_some_and(|n| matches!(n.kind, NodeKind::Text(_))) {
|
||||
|
||||
@@ -1355,6 +1355,110 @@ fn a_double_click_outside_isolation_leaves_it() {
|
||||
assert!(DirectSelectionTool::new(false).pointer(&cx(&d, &none, &p), &PointerEvent::new(PointerKind::DoubleClick, 700.0, 700.0)).is_empty());
|
||||
}
|
||||
|
||||
/// The anchor a Direct Selection double-click at `at` adds: (path, subpath, segment, t).
|
||||
fn double_click_adds(cx: &ToolContext, at: (f64, f64), mods: Mods) -> Option<(u64, usize, usize, f64)> {
|
||||
let a = DirectSelectionTool::new(false).pointer(cx, &PointerEvent::new(PointerKind::DoubleClick, at.0, at.1).with_mods(mods));
|
||||
a.iter().find_map(|a| match a {
|
||||
Action::Exec(c, p) if c == "path.insertAnchor" => {
|
||||
assert_eq!(p["selectAnchor"], true, "the new anchor is selected: {p}");
|
||||
Some((p["id"].as_u64()?, p["subpath"].as_u64()? as usize, p["segment"].as_u64()? as usize, p["t"].as_f64()?))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
/// With General › Double-Click Adds Anchor Points on, a plain
|
||||
/// Direct Selection double-click on a segment of a selected or unselected path adds an anchor at
|
||||
/// the clicked point. Off, Group Selection, a modifier, an anchor or the fill add none.
|
||||
#[test]
|
||||
fn with_the_preference_on_a_double_click_on_a_segment_adds_an_anchor_there() {
|
||||
let (d, id) = doc_with_rect();
|
||||
let p = paint();
|
||||
let mut whole = Selection::default();
|
||||
whole.add(id);
|
||||
let none = Selection::default();
|
||||
let top = d.node(id).and_then(|n| n.path_data()).map(|pd| pd.subpaths[0].clone()).unwrap_or_else(|| panic!("the rectangle"));
|
||||
for sel in [&none, &whole] {
|
||||
let on = ToolContext { double_click_adds_anchor: true, ..cx(&d, sel, &p) };
|
||||
let (path, si, seg, t) = double_click_adds(&on, (150.0, 101.0), Mods::default()).unwrap_or_else(|| panic!("an anchor is added"));
|
||||
assert_eq!((path, si), (id.0, 0));
|
||||
let c = top.segment(seg);
|
||||
assert!(c.p0.y == 100.0 && c.p3.y == 100.0, "on the top edge: {c:?}");
|
||||
let at = vectorcraft_geom::ParamCurve::eval(&c, t);
|
||||
assert!(at.distance(Point::new(150.0, 100.0)) < 1e-6, "at the clicked point: {at:?}");
|
||||
assert_eq!(double_click_adds(&on, (100.0, 100.0), Mods::default()), None, "on an anchor");
|
||||
assert_eq!(double_click_adds(&on, (150.0, 150.0), Mods::default()), None, "in the middle of the fill");
|
||||
for m in [Mods { shift: true, ..Mods::default() }, Mods { alt: true, ..Mods::default() }, Mods { cmd: true, ..Mods::default() }] {
|
||||
assert_eq!(double_click_adds(&on, (150.0, 101.0), m), None, "with {m:?}");
|
||||
}
|
||||
let group = DirectSelectionTool::new(true).pointer(&on, &PointerEvent::new(PointerKind::DoubleClick, 150.0, 101.0));
|
||||
assert!(group.is_empty(), "Group Selection: {group:?}");
|
||||
let off = cx(&d, sel, &p);
|
||||
assert!(DirectSelectionTool::new(false).pointer(&off, &PointerEvent::new(PointerKind::DoubleClick, 150.0, 101.0)).is_empty(), "off");
|
||||
}
|
||||
// On a 40 pt stroke 15 pt above the path, the stroke is hit but the path is out of reach.
|
||||
let mut wide = d.clone();
|
||||
if let Some(s) = wide.node_mut(id).and_then(|n| n.appearance.stroke_mut()) {
|
||||
s.width = 40.0;
|
||||
}
|
||||
let on = ToolContext { double_click_adds_anchor: true, ..cx(&wide, &none, &p) };
|
||||
assert!(hit_test(&wide, Point::new(150.0, 85.0), on.selection_hit_options()).is_some_and(|h| matches!(h.kind, HitKind::Stroke)));
|
||||
assert_eq!(double_click_adds(&on, (150.0, 85.0), Mods::default()), None, "away from the path");
|
||||
assert!(double_click_adds(&on, (150.0, 101.0), Mods::default()).is_some(), "on the path");
|
||||
// Without a stroke, the edge is taken within the tolerance, and the fill just past it is not.
|
||||
let mut unstroked = d.clone();
|
||||
if let Some(n) = unstroked.node_mut(id) {
|
||||
n.appearance.set_stroke(vectorcraft_color::Paint::None);
|
||||
}
|
||||
let on = ToolContext { double_click_adds_anchor: true, ..cx(&unstroked, &none, &p) };
|
||||
assert!(double_click_adds(&on, (150.0, 101.0), Mods::default()).is_some(), "on the edge of the fill");
|
||||
assert!(hit_test(&unstroked, Point::new(150.0, 104.0), on.selection_hit_options()).is_some_and(|h| matches!(h.kind, HitKind::Fill)));
|
||||
assert_eq!(double_click_adds(&on, (150.0, 104.0), Mods::default()), None, "on the fill past the tolerance");
|
||||
}
|
||||
|
||||
/// With the preference on, a double-click on a segment of a path in a group adds the anchor to
|
||||
/// that path; on the group's fill it does what it did before (nothing), and outside isolated art it
|
||||
/// still leaves isolation mode.
|
||||
#[test]
|
||||
fn with_the_preference_on_a_double_click_in_a_group_adds_only_on_a_segment() {
|
||||
let (d, inside, outside, inner, _) = nested_group_doc();
|
||||
let p = paint();
|
||||
let none = Selection::default();
|
||||
let on = ToolContext { double_click_adds_anchor: true, ..cx(&d, &none, &p) };
|
||||
assert_eq!(double_click_adds(&on, (150.0, 101.0), Mods::default()).map(|a| a.0), Some(inside.0));
|
||||
assert_eq!(double_click_adds(&on, (350.0, 301.0), Mods::default()).map(|a| a.0), Some(outside.0));
|
||||
assert!(DirectSelectionTool::new(false).pointer(&on, &PointerEvent::new(PointerKind::DoubleClick, 150.0, 150.0)).is_empty(), "the fill");
|
||||
let isolated = ToolContext { isolation: Some(inner), ..on };
|
||||
assert_eq!(double_click_adds(&isolated, (150.0, 101.0), Mods::default()).map(|a| a.0), Some(inside.0), "isolated art");
|
||||
let exit = vec![Action::Exec("object.exitIsolation".into(), json!({}))];
|
||||
assert_eq!(DirectSelectionTool::new(false).pointer(&isolated, &PointerEvent::new(PointerKind::DoubleClick, 350.0, 301.0)), exit);
|
||||
}
|
||||
|
||||
/// With the preference on, a double-click on a blend's spine point, which a press takes before the
|
||||
/// path under it, adds no anchor to that path; on the same path away from the spine point it does.
|
||||
/// A clipping path's segment, which a press takes over the art it clips, gets the anchor.
|
||||
#[test]
|
||||
fn with_the_preference_on_a_double_click_gives_way_to_spine_points_and_reaches_clipping_paths() {
|
||||
let (mut d, _) = doc_with_rect();
|
||||
let l = d.layers[0].id;
|
||||
let key = |id: NodeId, x: f64| {
|
||||
let line = vectorcraft_geom::shapes::line(Point::new(x, 310.0), Point::new(x + 40.0, 310.0));
|
||||
std::sync::Arc::new(vectorcraft_doc::Node::path(id, line, vectorcraft_doc::Appearance::default_art()))
|
||||
};
|
||||
let (g, k1, k2) = (d.alloc_id(), d.alloc_id(), d.alloc_id());
|
||||
let b = vectorcraft_doc::Node::new(g, NodeKind::Blend { children: vec![key(k1, 100.0), key(k2, 200.0)], spec: Default::default() });
|
||||
d.insert(Some(l), 1, b).unwrap();
|
||||
let p = paint();
|
||||
let none = Selection::default();
|
||||
let on = ToolContext { double_click_adds_anchor: true, ..cx(&d, &none, &p) };
|
||||
assert_eq!(double_click_adds(&on, (130.0, 310.0), Mods::default()).map(|a| a.0), Some(k1.0), "on the line");
|
||||
assert_eq!(double_click_adds(&on, (120.0, 310.0), Mods::default()), None, "on the spine point at its center");
|
||||
|
||||
let (d, _, clip, _) = doc_with_masked_square();
|
||||
let on = ToolContext { double_click_adds_anchor: true, ..cx(&d, &none, &p) };
|
||||
assert_eq!(double_click_adds(&on, (500.0, 450.0), Mods::default()).map(|a| a.0), Some(clip.0), "on the clipping path");
|
||||
}
|
||||
|
||||
/// With Direct Selection, an Alt-click on a path selected whole adds its group on release, and
|
||||
/// each further Alt-click adds the next group up, as Group Selection's clicks do, on an anchor,
|
||||
/// a segment and the fill alike. The climb stops below the layer and at the isolated group.
|
||||
|
||||
@@ -653,6 +653,7 @@ pub(crate) mod testutil {
|
||||
path_only: false,
|
||||
type_path_only: false,
|
||||
double_click_isolate: true,
|
||||
double_click_adds_anchor: false,
|
||||
select_behind: true,
|
||||
highlight_anchors: true,
|
||||
snap_tolerance: 2.0,
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
use craft::automation::ControlChannel;
|
||||
use craft::host::{AppInfo, Host, Wake};
|
||||
use craft::layers::ui::filter::ObjectsSearch;
|
||||
use craft::platform::clipboard::{Clipboard, ClipboardProbe, EventClipboard};
|
||||
use craft::platform::clock::monotonic_ms;
|
||||
use craft::theme::variant::Tone;
|
||||
use craft::ui::buttons::{ActiveLook, PushButtonLook};
|
||||
use craft::ui::contract::{Bind, GlyphColon};
|
||||
use craft::ui::choice::ChoiceLook;
|
||||
use craft::ui::contract::{Bind, CaptionInk, GlyphColon, LinkLabelInk, LinkLabelUnderline, QuietHeader, SectionRhythm};
|
||||
use craft::ui::docking::IconGroupSeparator;
|
||||
use craft::ui::list::{CommandHighlight, ThumbRows};
|
||||
use craft::ui::menu::MenuTitlePad;
|
||||
use craft::ui::patterns::form_dialogs::PresetCardLook;
|
||||
use craft::ui::runtime::env::{RootEnv, Scale, ScrubDrags, WindowKey};
|
||||
use craft::ui::runtime::frame::{FrameInput, FrameOutput};
|
||||
use craft::ui::runtime::toast::{self, Toast};
|
||||
use craft::ui::runtime::windows::WindowHost;
|
||||
use craft::ui::sections::{DialogButtonLook, QuietTitleRow};
|
||||
use craft::ui::shell::embed::CloseDecision;
|
||||
use craft::ui::shell::{AppShell, CanvasPanel, Slot};
|
||||
use craft::ui::style::TrackFill;
|
||||
use craft::ui::tabs::DocumentTabLook;
|
||||
use craft::ui::text::{NumberLook, NumberPrecision};
|
||||
use vectorcraft_engine::cmd::clipboard::PASTE_ORDER;
|
||||
use vectorcraft_engine::cmd::toast::Level;
|
||||
@@ -519,11 +527,13 @@ impl VectorcraftApp {
|
||||
pub(crate) fn canvas_area(&mut self, ui: &mut egui::Ui) {
|
||||
let opening = !self.opening.pending.is_empty();
|
||||
let presenting = self.ui.presenting();
|
||||
let large_tabs = self.session.prefs.large_tabs;
|
||||
// The tab strip and the document are two closures of one panel: they take the app in
|
||||
// turn, and a borrow that fails (a closure re-entered) skips its part.
|
||||
let app = std::cell::RefCell::new(self);
|
||||
CanvasPanel::new()
|
||||
.opening(opening)
|
||||
.large_tabs(large_tabs)
|
||||
.tabs(|ui, _cx| {
|
||||
if !presenting && let Ok(mut app) = app.try_borrow_mut() {
|
||||
chrome::doc_tabs(&mut app, ui);
|
||||
@@ -533,7 +543,10 @@ impl VectorcraftApp {
|
||||
let Ok(mut app) = app.try_borrow_mut() else { return };
|
||||
let app: &mut VectorcraftApp = &mut app;
|
||||
app.canvas.windows.area = Some(ui.available_rect_before_wrap());
|
||||
app.canvas.windows.last_noted = std::mem::take(&mut app.canvas.windows.noted);
|
||||
// Only the shown pass starts the frame's panes: a measuring run before it would drop the last frame's.
|
||||
if !craft::ui::runtime::measure::active(ui.ctx()) {
|
||||
app.canvas.windows.last_noted = std::mem::take(&mut app.canvas.windows.noted);
|
||||
}
|
||||
let floats = crate::doc_windows::current_floats(app);
|
||||
// The current window's body is in its floating window, drawn after this pane: the pane's drop catcher
|
||||
// waits for it ([`crate::doc_windows::show`]).
|
||||
@@ -683,8 +696,41 @@ pub(crate) fn root_env(prefs: &vectorcraft_engine::Prefs, native_ppp: f32) -> Ro
|
||||
// A glyph that stands for a word caption ("X", "W") takes a form's colon as production drew it ("X:"); "#" and
|
||||
// the colour channel letters stay bare.
|
||||
root.values.set(GlyphColon::Form);
|
||||
// A field's label that opens its options ("Opacity:", "Stroke") reads in the normal ink, underlined, as production
|
||||
// drew it.
|
||||
root.values.set(LinkLabelInk::Neutral);
|
||||
// Its underline stands inside the label's rect, under the text, as production drew it.
|
||||
root.values.set(LinkLabelUnderline::Inside);
|
||||
// Other field labels ("X:", "Angle:", "Opacity") read in the normal ink of the values beside them, as production
|
||||
// drew them.
|
||||
root.values.set(CaptionInk::Normal);
|
||||
// Menu rows, open menu bar titles and the command palette's active row show production's hover highlight.
|
||||
root.values.set(CommandHighlight::Hover);
|
||||
// Check boxes, radio buttons and switches that are on take the strong accent with a white mark, sliders fill their
|
||||
// track to the value in the accent, and a dialog's Cancel is a filled button beside its accent answer.
|
||||
root.values.set(ChoiceLook::Strong);
|
||||
root.values.set(TrackFill::Accent);
|
||||
root.values.set(DialogButtonLook::Filled);
|
||||
// Sections stand apart with production's room around their dividers.
|
||||
root.values.set(SectionRhythm::Spaced);
|
||||
// The Properties kind line ("Ellipse") heads the sections under it, so the first draws no divider above it, as
|
||||
// production's did.
|
||||
root.values.set(QuietHeader::Heads);
|
||||
// Quiet headings (the kind line, "Ellipse Properties:") stand a line of text high over their fields, as
|
||||
// production's did.
|
||||
root.values.set(QuietTitleRow::Text);
|
||||
// Layers rows stand as production's: the thumbnail with a tight gap, 14 points of indent per level.
|
||||
root.values.set(ThumbRows::Tight);
|
||||
// The Layers Objects search field fills the filter bar up to its Filter button, as production's did.
|
||||
root.values.set(ObjectsSearch::Fill);
|
||||
// The menu bar's titles stand as close as production's, which share the line with the bar's other controls.
|
||||
root.values.set(MenuTitlePad::Control);
|
||||
// Document tabs show their title and its `*` in the label's semibold face, as production drew them.
|
||||
root.values.set(DocumentTabLook::Semibold);
|
||||
// A collapsed panel column's icon groups stand apart by a hairline, as production drew them.
|
||||
root.values.set(IconGroupSeparator::Rule);
|
||||
// New Document's preset cards show blank paper on a flat card, as production drew them.
|
||||
root.values.set(PresetCardLook::Page);
|
||||
// A bare Tab on the canvas, or with nothing focused, toggles the panels (`window.dock`) instead of moving focus.
|
||||
root.tab_toggles_chrome = true;
|
||||
// Escape in a text field gives up its focus, reverting any typing, so the next keys are the window's.
|
||||
|
||||
@@ -75,8 +75,9 @@ impl VectorcraftApp {
|
||||
}
|
||||
}
|
||||
// A capture is issued only after passes settle it, and an idle window runs none; a hidden
|
||||
// one runs only this logic unless asked to paint.
|
||||
if self.channel.as_ref().is_some_and(|channel| channel.captures.any_unissued()) {
|
||||
// one runs only this logic unless asked to paint. Its readback finishes only in a later frame,
|
||||
// so frames keep coming until it is answered, as production's did.
|
||||
if self.channel.as_ref().is_some_and(|channel| channel.captures.any_pending()) {
|
||||
if self.viewport_hidden(ctx) {
|
||||
host.paint_while_hidden();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use craft::behavior::{CanvasView, EditEvent};
|
||||
use craft::ui::canvas::{PageBorder, PageFrame, Pasteboard, PasteboardColor, PasteboardOutput};
|
||||
use craft::ui::canvas::{ArtboardEdge, PageBorder, PageFrame, Pasteboard, PasteboardColor, PasteboardOutput};
|
||||
use craft::ui::contract::{Rename, Show as _};
|
||||
use craft::ui::primitives::Checker;
|
||||
use craft::ui::style::DataColor;
|
||||
@@ -98,7 +98,8 @@ pub(super) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, space: &CanvasSp
|
||||
let outline = view.outline;
|
||||
let list = frames(app, st, view, outline);
|
||||
// The pasteboard's colour is the canvas's (`Canvas::pasteboard`).
|
||||
let out = Pasteboard::new("Artboards", &list).border(border(outline)).shows_outside().show_at(ui, space.view.rect);
|
||||
let out =
|
||||
Pasteboard::new("Artboards", &list).border(border(outline)).artboard_edge(ArtboardEdge::Plain).shows_outside().show_at(ui, space.view.rect);
|
||||
match kind {
|
||||
BodyKind::Live => apply(app, &out),
|
||||
BodyKind::Pane => None,
|
||||
|
||||
@@ -195,8 +195,11 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kind: BodyKi
|
||||
later.push((win, rect, ui.layer_id()));
|
||||
return;
|
||||
}
|
||||
// A pane outside Tile (a floating window's, the main window's while the current window floats).
|
||||
app.canvas.windows.noted.push((win, rect));
|
||||
// A pane outside Tile (a floating window's, the main window's while the current window floats), as shown: a
|
||||
// measuring run's area is not where it draws.
|
||||
if !craft::ui::runtime::measure::active(ui.ctx()) {
|
||||
app.canvas.windows.noted.push((win, rect));
|
||||
}
|
||||
}
|
||||
let view = match kind {
|
||||
BodyKind::Live => app.canvas_view(),
|
||||
|
||||
@@ -3,7 +3,7 @@ use craft::ui::buttons::Button;
|
||||
use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::display::Text;
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::shell::{RecentFile, StartAction, StartLink, StartScreen, Template};
|
||||
use craft::ui::shell::{RecentFile, StartAction, StartLayout, StartLink, StartScreen, Template};
|
||||
|
||||
use super::{Ui, VectorcraftApp, json};
|
||||
|
||||
@@ -25,25 +25,32 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) {
|
||||
let templates: Vec<Template> = TEMPLATES
|
||||
.iter()
|
||||
.filter_map(|name| vectorcraft_engine::cmd::newdoc::find(&app.session, name))
|
||||
.map(|s| Template::new(s.name.clone(), s.name.clone(), s.size_label()))
|
||||
.map(|s| Template::new(s.name.clone(), s.name.clone(), s.size_label()).page(s.width, s.height))
|
||||
.collect();
|
||||
let mut links = vec![];
|
||||
let discord = crate::credits::discord_url(app);
|
||||
if !discord.is_empty() {
|
||||
links.push(StartLink::url(tl!("Join our Discord"), Some(IconId::new("message-circle")), discord));
|
||||
links.push(StartLink::url(tl!("Join our Discord"), Some(IconId::new("message-circle")), discord).primary());
|
||||
}
|
||||
for ((label, url), icon) in crate::community::link_urls(app).into_iter().zip(LINK_ICONS) {
|
||||
links.push(StartLink::url(tl!(label), Some(IconId::new(icon)), url));
|
||||
}
|
||||
// The bindings hold copies so the Learn section can borrow the app.
|
||||
// The column shows no view switch or sort; the bindings hold copies so the Learn section can borrow the app.
|
||||
let (mut view, mut sort) = (app.ui.home_view, app.ui.home_sort);
|
||||
let mut pressed = None;
|
||||
let mut learn = |ui: &mut Ui| learn(app, ui, &mut pressed);
|
||||
let mut child = ui.new_child(egui::UiBuilder::new().max_rect(rect).layout(egui::Layout::top_down(egui::Align::Min)));
|
||||
let out = StartScreen::new(Bind::bound(&mut view), Bind::bound(&mut sort), &recent)
|
||||
.layout(StartLayout::Column)
|
||||
.title(tl!("Welcome to VectorCraft"))
|
||||
.subtitle(tl!("Vector illustration — fast, open, scriptable."))
|
||||
.new_label(tl!("New file"))
|
||||
.open_label(tl!("Open"))
|
||||
.max_recent(6)
|
||||
.templates(&templates)
|
||||
.templates_title(tl!("Quickly start a new file"))
|
||||
.links(&links)
|
||||
.links_title(tl!("Community"))
|
||||
.app_section(tl!("Learn"), &mut learn)
|
||||
.show(&mut child);
|
||||
app.ui.home_view = view;
|
||||
|
||||
@@ -484,8 +484,10 @@ impl HiddenMarks {
|
||||
pub struct ArtMarksStyle {
|
||||
#[style(metrics)]
|
||||
metrics: Metrics,
|
||||
/// The artboards' bleed and marks.
|
||||
line: StyleColor,
|
||||
/// The artboards' bleed outline.
|
||||
bleed: StyleColor,
|
||||
/// The artboards' marks (cross hairs, centre mark, video-safe areas).
|
||||
marks: StyleColor,
|
||||
/// The spelling waves.
|
||||
bad: StyleColor,
|
||||
}
|
||||
@@ -546,7 +548,12 @@ impl Component for ArtMarks<'_> {
|
||||
type Output = Response;
|
||||
|
||||
fn style(cx: &StyleCx<'_>, _: ArtMarksStyleKey) -> ArtMarksStyle {
|
||||
ArtMarksStyle { metrics: Metrics::new(), line: cx.color(cx.tokens.color.overlay.line), bad: cx.tone(Tone::Bad) }
|
||||
ArtMarksStyle {
|
||||
metrics: Metrics::new(),
|
||||
bleed: cx.color(cx.tokens.color.status.bad.solid),
|
||||
marks: cx.color(cx.tokens.color.overlay.grid),
|
||||
bad: cx.tone(Tone::Bad),
|
||||
}
|
||||
}
|
||||
|
||||
fn measure(&mut self, _: &MeasureCx<'_, Self>) -> Vec2 {
|
||||
@@ -563,9 +570,10 @@ impl Component for ArtMarks<'_> {
|
||||
for quad in self.fade {
|
||||
draw.data_fill(&PaintShape::Polygon(quad.to_vec()), FADE_OUTSIDE);
|
||||
}
|
||||
for path in self.bleed.iter().chain(self.artboard_marks) {
|
||||
let bleed = self.bleed.iter().map(|path| (path, style.bleed));
|
||||
for (path, color) in bleed.chain(self.artboard_marks.iter().map(|path| (path, style.marks))) {
|
||||
for (points, closed) in path_runs(&self.view, path) {
|
||||
draw.stroke(&PaintShape::Path(ring(points, closed)), StrokeWidth::Thin, style.line);
|
||||
draw.stroke(&PaintShape::Path(ring(points, closed)), StrokeWidth::Thin, color);
|
||||
}
|
||||
}
|
||||
draw.faded(BAND_SHARE, |d| {
|
||||
|
||||
@@ -116,8 +116,6 @@ pub struct ToolMarksStyle {
|
||||
dark: StyleColor,
|
||||
/// Text on the pill.
|
||||
ink: StyleColor,
|
||||
/// The text of a label.
|
||||
label: StyleColor,
|
||||
/// The selection ring of a stop chip.
|
||||
accent: StyleColor,
|
||||
/// Around a measure's text.
|
||||
@@ -154,7 +152,6 @@ impl Component for ToolMarks<'_> {
|
||||
metrics: Metrics::new(),
|
||||
dark: cx.color(tokens.color.overlay.halo),
|
||||
ink: cx.color(tokens.color.text.on_strong),
|
||||
label: cx.color(tokens.color.text.normal),
|
||||
accent: cx.color(tokens.color.accent.solid),
|
||||
pad: Vec2::new(tokens.space.pad.control, tokens.space.gap.tight),
|
||||
radius: UiTokens::corner(tokens.shape.radius.control),
|
||||
@@ -212,8 +209,8 @@ fn paint(draw: &Draw<'_>, view: &CanvasView, overlays: &[Overlay], options: &Pat
|
||||
Overlay::Handle { p, color } => handle_end(draw, view.to_screen(*p), data(*color), options, style),
|
||||
// The pasteboard names an artboard, so its label is not drawn twice.
|
||||
Overlay::Label { text, .. } if names_an_artboard(text) => {}
|
||||
Overlay::Label { p, text, .. } => {
|
||||
let run = TextRun::new(crate::panels::label_or_name(text, true).to_string()).role(TypeRole::Caption).color(style.label); // PLAN: a text run takes a theme colour, so the label's own colour is not applied
|
||||
Overlay::Label { p, text, color } => {
|
||||
let run = TextRun::new(crate::panels::label_or_name(text, true).to_string()).role(TypeRole::Caption).data_color(data(*color));
|
||||
let layout = draw.layout(&run, f32::INFINITY);
|
||||
draw.galley(view.to_screen(*p) + Vec2::new(8.0, -14.0), &layout);
|
||||
}
|
||||
|
||||
@@ -398,35 +398,6 @@ fn the_tile_items_check_the_layout_the_panes_show() {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Arrange Documents items tile and consolidate through the commands they name.
|
||||
#[test]
|
||||
fn the_arrange_documents_items_tile_and_consolidate() {
|
||||
let mut app = app_with(3);
|
||||
let items = crate::menus::arrange_documents_items();
|
||||
let items = commands(&items);
|
||||
let labels: Vec<&str> = items.iter().map(|(l, ..)| *l).collect();
|
||||
for item in [
|
||||
"Consolidate All Windows",
|
||||
"Tile",
|
||||
"Tile All Vertically",
|
||||
"Tile All Horizontally",
|
||||
"2-Up Layout",
|
||||
"3-Up Layout",
|
||||
"4-Up Layout",
|
||||
"6-Up Layout",
|
||||
] {
|
||||
assert!(labels.contains(&item), "the items list {item}");
|
||||
}
|
||||
let choose = |app: &mut VectorcraftApp, label: &str| {
|
||||
let (_, id, p) = items.iter().find(|(l, ..)| *l == label).unwrap_or_else(|| panic!("{label} is listed"));
|
||||
app.run(id, if p.is_null() { json!({}) } else { (*p).clone() }).unwrap();
|
||||
};
|
||||
choose(&mut app, "Tile All Vertically");
|
||||
assert!(app.ui.tiled && app.ui.tile_layout == Layout::Vertical, "{}", app.ui.status);
|
||||
choose(&mut app, "Consolidate All Windows");
|
||||
assert!(!app.ui.tiled);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tile_shows_a_pane_for_each_document_fitted_to_it() {
|
||||
let mut app = app_with(3);
|
||||
|
||||
@@ -558,7 +558,7 @@ pub(super) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, space: &CanvasSp
|
||||
let (visible, info) = (shown(app, tool), app.view_info());
|
||||
let layout = app.session.with_tool_context(info, |cx| Layout::of(cx, &space.view, visible));
|
||||
end_hidden(app, &mut held, &layout);
|
||||
let out = SelectionWidgets::new(layout).show(ui);
|
||||
let out = SelectionWidgets::new(layout).show_at(ui, space.view.rect);
|
||||
for (widget, press) in out.presses {
|
||||
if !press.phase.start().is_some_and(|s| s.button == PointerButton::Primary) {
|
||||
continue;
|
||||
|
||||
@@ -2933,9 +2933,11 @@ fn double_clicking_type_with_the_selection_tool_puts_the_caret_there() {
|
||||
let at = xf.to_screen(b.center());
|
||||
let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
|
||||
timed(&mut app, 1.0, vec![egui::Event::PointerMoved(at), button(true), button(false), button(true), button(false)]);
|
||||
// The framework holds a frame's second press for the next pass.
|
||||
// The framework holds a frame's second press for the next frame; the double-click it completes hands the text
|
||||
// to the Type tool two frames after that.
|
||||
timed(&mut app, 1.05, vec![]);
|
||||
timed(&mut app, 1.1, vec![]);
|
||||
timed(&mut app, 1.15, vec![]);
|
||||
// The Type tool edits the text, with the caret inside it, where it was clicked: typing goes
|
||||
// into the text, not to tool shortcuts (X would swap fill and stroke).
|
||||
assert_eq!(app.session.tool_id(), "type");
|
||||
@@ -3076,9 +3078,11 @@ fn double_clicking_type_with_the_direct_selection_tool_puts_the_caret_there() {
|
||||
let at = xf.to_screen(b.center());
|
||||
let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
|
||||
timed(&mut app, 1.0, vec![egui::Event::PointerMoved(at), button(true), button(false), button(true), button(false)]);
|
||||
// The framework holds a frame's second press for the next pass.
|
||||
// The framework holds a frame's second press for the next frame; the double-click it completes hands the text
|
||||
// to the Type tool two frames after that.
|
||||
timed(&mut app, 1.05, vec![]);
|
||||
timed(&mut app, 1.1, vec![]);
|
||||
timed(&mut app, 1.15, vec![]);
|
||||
// The Type tool edits the text, with the caret inside it, where it was clicked: typing goes
|
||||
// into the text, not to tool shortcuts.
|
||||
assert_eq!(app.session.tool_id(), "type");
|
||||
@@ -3136,9 +3140,11 @@ fn double_clicking_type_in_a_missing_font_asks_before_editing() {
|
||||
let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
|
||||
let double_click = |app: &mut VectorcraftApp, time: f64| {
|
||||
timed(app, time, vec![egui::Event::PointerMoved(at), button(true), button(false), button(true), button(false)]);
|
||||
// The framework holds a frame's second press for the next pass.
|
||||
// The framework holds a frame's second press for the next frame; the double-click it completes asks two
|
||||
// frames after that.
|
||||
timed(app, time + 0.05, vec![]);
|
||||
timed(app, time + 0.1, vec![]);
|
||||
timed(app, time + 0.15, vec![]);
|
||||
};
|
||||
let asking = |app: &VectorcraftApp| app.dialogs().unwrap().with(|h| h.is_open::<crate::dialogs::confirm::MissingFontQuestion>());
|
||||
double_click(&mut app, 1.0);
|
||||
@@ -3238,9 +3244,11 @@ fn escape_while_editing_in_isolation_returns_to_selection_tool_and_keeps_isolati
|
||||
|
||||
// 1st double-click on group enters isolation mode.
|
||||
timed(&mut app, 1.0, vec![egui::Event::PointerMoved(at), button(true), button(false), button(true), button(false)]);
|
||||
// The framework holds a frame's second press for the next pass.
|
||||
// The framework holds a frame's second press for the next frame; the double-click it completes isolates the group
|
||||
// two frames after that.
|
||||
timed(&mut app, 1.05, vec![]);
|
||||
timed(&mut app, 1.1, vec![]);
|
||||
timed(&mut app, 1.15, vec![]);
|
||||
assert!(app.session.active().unwrap().isolation.is_some(), "should be in isolation mode");
|
||||
assert_eq!(app.session.tool_id(), "selection");
|
||||
|
||||
|
||||
@@ -5,11 +5,10 @@ use std::cell::RefCell;
|
||||
|
||||
use craft::behavior::IconId;
|
||||
use craft::menu::MenuBarUi;
|
||||
use craft::ui::buttons::{Button, CommandSearch, IconButton, PopupMark, ToggleButton};
|
||||
use craft::ui::contract::{Bind, BodyCx, Props, Show, ShowContainer, Trigger};
|
||||
use craft::ui::display::{Divider, Picture};
|
||||
use craft::ui::buttons::{Button, IconButton, ToggleButton};
|
||||
use craft::ui::contract::{Bind, BodyCx, Props, Show, ShowContainer};
|
||||
use craft::ui::display::Picture;
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::menu::{Menu, MenuItem};
|
||||
use craft::ui::primitives::IconSpec;
|
||||
use craft::ui::runtime::windows::WindowHost;
|
||||
use craft::ui::shell::{Frame, Title, TitleBar};
|
||||
@@ -17,7 +16,6 @@ use craft::ui::style::{SurfaceKind, Variant};
|
||||
use egui::Ui;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::menus::Node;
|
||||
use crate::state::{ROTATE_VIEW_ANGLES, zoom_label};
|
||||
use crate::{VectorcraftApp, brand, menus};
|
||||
|
||||
@@ -55,11 +53,7 @@ enum Trailing {
|
||||
Safe,
|
||||
/// The community button.
|
||||
Discord,
|
||||
/// Explore tutorials.
|
||||
Learn,
|
||||
/// Arrange Documents.
|
||||
Arrange,
|
||||
/// The search that opens the command palette.
|
||||
/// The search icon that opens the command palette.
|
||||
Search,
|
||||
/// The workspace switcher.
|
||||
Switcher,
|
||||
@@ -67,16 +61,14 @@ enum Trailing {
|
||||
|
||||
impl Trailing {
|
||||
/// The controls in the order they are drawn.
|
||||
const SHOWN: [Trailing; 6] = [Trailing::Discord, Trailing::Learn, Trailing::Search, Trailing::Arrange, Trailing::Safe, Trailing::Switcher];
|
||||
const SHOWN: [Trailing; 4] = [Trailing::Discord, Trailing::Search, Trailing::Safe, Trailing::Switcher];
|
||||
|
||||
/// The rank the bar gives it up in, lowest first: Discord, tutorials, Arrange Documents, then the search. Each is
|
||||
/// also in a menu, so a hidden one goes nowhere. Safe Mode and the switcher always show.
|
||||
/// The rank the bar gives it up in, lowest first: Discord, then the search. Each is also in a menu, so a hidden one
|
||||
/// goes nowhere. Safe Mode and the switcher always show.
|
||||
fn rank(self) -> Option<u8> {
|
||||
match self {
|
||||
Trailing::Discord => Some(1),
|
||||
Trailing::Learn => Some(2),
|
||||
Trailing::Arrange => Some(3),
|
||||
Trailing::Search => Some(4),
|
||||
Trailing::Search => Some(2),
|
||||
Trailing::Safe | Trailing::Switcher => None,
|
||||
}
|
||||
}
|
||||
@@ -91,17 +83,9 @@ impl Trailing {
|
||||
}
|
||||
}
|
||||
Trailing::Discord => crate::community::discord_button(app, ui),
|
||||
Trailing::Learn => {
|
||||
// PLAN: assumed `IconButton::command` is bound by a `&str` command id.
|
||||
IconButton::command(IconId::new("graduation-cap"), "window.learn")
|
||||
.label(tl!("Explore tutorials"))
|
||||
.selected(crate::panels::learn::visible(app))
|
||||
.show(ui);
|
||||
}
|
||||
Trailing::Arrange => arrange_documents(app, ui),
|
||||
// Named as production's field, not after the command's menu row.
|
||||
// Named as production's search, not after the command's menu row.
|
||||
Trailing::Search => {
|
||||
CommandSearch::new(PALETTE, tl!("Search commands")).show(ui);
|
||||
IconButton::command(IconId::new("search"), PALETTE).label(tl!("Search commands")).show(ui);
|
||||
}
|
||||
// PLAN: assumed `crate::workspaces::switcher(app: &mut VectorcraftApp, ui: &mut Ui)` (chrome-w14's `WorkspaceSwitcher`).
|
||||
Trailing::Switcher => crate::workspaces::switcher(app, ui),
|
||||
@@ -109,40 +93,6 @@ impl Trailing {
|
||||
}
|
||||
}
|
||||
|
||||
/// Arrange Documents: Consolidate All Windows and the Tile layouts, each item as the Window menu shows it.
|
||||
fn arrange_documents(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let opener =
|
||||
IconButton::new(IconId::new("layout_grid")).label(tl!("Arrange Documents")).selected(app.ui.tiled).popup_mark(PopupMark::Menu).show(ui);
|
||||
let mut chosen = None;
|
||||
let state = &*app;
|
||||
// PLAN: the sheet names `Trigger::Manual`; `Trigger::Press` is the pop-up menu button's trigger and needs no open binding.
|
||||
Menu::new(tl!("Arrange Documents")).opened_by(&opener.response, Trigger::Press).show(ui, |ui, _| {
|
||||
for item in menus::arrange_documents_items() {
|
||||
match item {
|
||||
Node::Separator => {
|
||||
Divider::horizontal().show(ui);
|
||||
}
|
||||
Node::Item(item) => {
|
||||
let (id, params) = (item.command.id, item.command.params);
|
||||
let Some((enabled, checked)) = menus::shown_state(state, &id, ¶ms) else { continue };
|
||||
let mut row = MenuItem::new(menus::shown_label(state, &id, ¶ms, &item.label)).enabled(enabled);
|
||||
if let Some(checked) = checked {
|
||||
row = row.check(checked);
|
||||
}
|
||||
let row = row.show(ui);
|
||||
if row.ran {
|
||||
chosen = Some((id, if params.is_null() { json!({}) } else { params }));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
});
|
||||
if let Some((id, params)) = chosen {
|
||||
menus::invoke(app, &id, params);
|
||||
}
|
||||
}
|
||||
|
||||
/// The start of the bar: the brand mark (the OS draws its own icon in a native frame), Home and the menus.
|
||||
fn leading(ui: &mut Ui, app: &mut VectorcraftApp) {
|
||||
if !matches!(WindowHost::of(ui.ctx()).frame(), Frame::Native) {
|
||||
@@ -178,7 +128,7 @@ fn trailing(ui: &mut Ui, app: &mut VectorcraftApp) {
|
||||
}
|
||||
|
||||
/// The application bar, the body of the shell's title bar: brand mark, Home and menus, then Discord,
|
||||
/// tutorials, Arrange Documents, search and the workspace switcher at the end. The title bar draws
|
||||
/// the search and the workspace switcher at the end. The title bar draws
|
||||
/// the caption buttons and drags the window; it shows the title only while the menus are in the macOS
|
||||
/// menu bar, where the bar has the room the menus leave.
|
||||
pub fn app_bar(ui: &mut Ui, _cx: &mut BodyCx<'_>, app: &mut VectorcraftApp) {
|
||||
|
||||
@@ -8,7 +8,7 @@ use craft::ui::display::{Divider, Elide, Shade, Text};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::menu::Menu;
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::pickers::{Select, SelectLook};
|
||||
use craft::ui::style::TypeRole;
|
||||
use craft::ui::text::ZoomField;
|
||||
|
||||
@@ -74,7 +74,7 @@ pub fn status_bar(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
}
|
||||
Field::new(tl!("Rotation")).side(SideLabel::new().kind(LabelKind::Hidden)).show(ui, |ui, _| {
|
||||
// Entries are keyed by index: an angle is not a hashable value.
|
||||
rotate_to = Select::new(tl!("Rotation"), Bind::given(turned), &angles).show(ui).value().copied();
|
||||
rotate_to = Select::new(tl!("Rotation"), Bind::given(turned), &angles).look(SelectLook::Filled).show(ui).value().copied();
|
||||
});
|
||||
Divider::vertical().show(ui);
|
||||
for (icon, to, tip, enabled) in
|
||||
@@ -85,7 +85,9 @@ pub fn status_bar(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
}
|
||||
}
|
||||
Field::new(tl!("Artboard")).side(SideLabel::new().kind(LabelKind::Hidden)).show(ui, |ui, _| {
|
||||
if let Some(i) = Select::new(tl!("Artboard"), Bind::given(cur), &boards).enabled(nab > 0).show(ui).value().copied() {
|
||||
if let Some(i) =
|
||||
Select::new(tl!("Artboard"), Bind::given(cur), &boards).look(SelectLook::Filled).enabled(nab > 0).show(ui).value().copied()
|
||||
{
|
||||
go = Some(json!(i));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -261,8 +261,7 @@ fn hints_name_keys_as_the_menus_do() {
|
||||
}
|
||||
|
||||
/// As the window narrows, the app bar gives up its right-hand controls one at a time, each before the one after it:
|
||||
/// Discord, Explore tutorials, Arrange Documents, the search and last the workspace switcher; each keeps its whole width
|
||||
/// until it goes. Whatever shows lies inside the window. Safe Mode's rows are in `tests/safe_mode.rs`, whose
|
||||
/// Discord, the search and last the workspace switcher; each keeps its whole width until it goes. Whatever shows lies inside the window. Safe Mode's rows are in `tests/safe_mode.rs`, whose
|
||||
/// process owns the Safe Mode switch.
|
||||
#[test]
|
||||
fn the_app_bar_gives_up_its_right_hand_controls_in_order() {
|
||||
@@ -270,9 +269,8 @@ fn the_app_bar_gives_up_its_right_hand_controls_in_order() {
|
||||
let app = crate::VectorcraftApp::new(Session::new(), Default::default());
|
||||
// The bar is the shell's title bar, which only the whole window's frame draws.
|
||||
let mut bar = Shown::new(app, egui::vec2(1600.0, 600.0), |app, ui| app.ui(ui));
|
||||
// PLAN: shell-w9 builds Explore tutorials as `IconButton::command(.., "window.learn")`, whose command label is "Learn"; the button keeps production's name "Explore tutorials".
|
||||
// In the order the bar gives them up; the search's name goes on with its chord.
|
||||
let controls = ["Discord", "Explore tutorials", "Arrange Documents", "Search commands", "Choose a workspace"];
|
||||
let controls = ["Discord", "Search commands", "Choose a workspace"];
|
||||
let mut before: Option<Vec<bool>> = None;
|
||||
let mut search_widths = vec![];
|
||||
for width in (30..=160).rev().map(|w| w as f32 * 10.0) {
|
||||
@@ -290,13 +288,13 @@ fn the_app_bar_gives_up_its_right_hand_controls_in_order() {
|
||||
if let Some(before) = &before {
|
||||
assert!(on.iter().zip(before).all(|(now, was)| !now || *was), "{width}: a control came back as the window narrowed: {on:?}");
|
||||
}
|
||||
if let Some(search) = shown[3] {
|
||||
if let Some(search) = shown[1] {
|
||||
search_widths.push(search.rect.width());
|
||||
}
|
||||
before = Some(on);
|
||||
}
|
||||
let (widest, narrowest) = (search_widths.first().copied(), search_widths.last().copied());
|
||||
assert!(widest.zip(narrowest).is_some_and(|(w, n)| n >= w - 0.5), "the search field keeps its width until it goes: {search_widths:?}");
|
||||
assert!(widest.zip(narrowest).is_some_and(|(w, n)| n >= w - 0.5), "the search keeps its width until it goes: {search_widths:?}");
|
||||
}
|
||||
|
||||
/// A text the status bar painted, with where it lies.
|
||||
@@ -2742,6 +2740,113 @@ fn the_control_bar_align_to_menu_chooses_what_align_aligns_to() {
|
||||
assert_eq!(menu(&mut bar).1.as_deref(), Some("Align to Selection"));
|
||||
}
|
||||
|
||||
/// What the latest frame paints in the Control bar's Style field.
|
||||
struct StyleFace {
|
||||
/// The field's rect.
|
||||
field: egui::Rect,
|
||||
/// The rects of the textured meshes inside the field, each with the texel at its middle when the texture is known.
|
||||
pictures: Vec<(egui::Rect, Option<egui::Color32>)>,
|
||||
/// The rects the field fills, each with its fill, in paint order.
|
||||
fills: Vec<(egui::Rect, egui::Color32)>,
|
||||
}
|
||||
|
||||
/// The Style field of the settled bar. `textures` holds the textures the frames uploaded since the fixture began
|
||||
/// recording; the uploads of these frames are applied to it.
|
||||
fn style_face(bar: &mut Shown, textures: &mut std::collections::HashMap<egui::TextureId, egui::ColorImage>) -> StyleFace {
|
||||
fn flat(shape: egui::Shape, out: &mut Vec<egui::Shape>) {
|
||||
if let egui::Shape::Vec(shapes) = shape {
|
||||
shapes.into_iter().for_each(|s| flat(s, out));
|
||||
} else {
|
||||
out.push(shape);
|
||||
}
|
||||
}
|
||||
let field = bar.settle().named("Graphic Styles").rect;
|
||||
let mut paint = bar.fixture.take_paint().expect("the fixture records what it paints");
|
||||
for (id, delta) in paint.textures_delta.set.iter().flat_map(|(id, deltas)| deltas.iter().map(move |delta| (id, delta))) {
|
||||
let egui::ImageData::Color(image) = &delta.image;
|
||||
match delta.pos {
|
||||
None => {
|
||||
textures.insert(*id, egui::ColorImage::clone(image.as_ref()));
|
||||
}
|
||||
Some([x0, y0]) => {
|
||||
let Some(page) = textures.get_mut(id) else { continue };
|
||||
for (i, texel) in image.pixels.iter().enumerate() {
|
||||
let (x, y) = (x0 + i % image.size[0], y0 + i / image.size[0]);
|
||||
if x < page.size[0] && y < page.size[1] {
|
||||
page.pixels[y * page.size[0] + x] = *texel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// The uploads are applied to `textures`, not to a renderer.
|
||||
paint.textures_delta.clear();
|
||||
let mut shapes = Vec::new();
|
||||
for clipped in std::mem::take(&mut paint.shapes) {
|
||||
flat(clipped.shape, &mut shapes);
|
||||
}
|
||||
let mut face = StyleFace { field, pictures: Vec::new(), fills: Vec::new() };
|
||||
for shape in shapes {
|
||||
match shape {
|
||||
egui::Shape::Mesh(mesh) if mesh.texture_id != egui::TextureId::default() => {
|
||||
let rect = egui::Rect::from_points(&mesh.vertices.iter().map(|v| v.pos).collect::<Vec<_>>());
|
||||
if !field.contains_rect(rect) {
|
||||
continue;
|
||||
}
|
||||
let uv = egui::Rect::from_points(&mesh.vertices.iter().map(|v| v.uv).collect::<Vec<_>>()).center();
|
||||
let texel = textures.get(&mesh.texture_id).map(|image| {
|
||||
let x = ((uv.x * image.size[0] as f32) as usize).min(image.size[0] - 1);
|
||||
let y = ((uv.y * image.size[1] as f32) as usize).min(image.size[1] - 1);
|
||||
image.pixels[y * image.size[0] + x]
|
||||
});
|
||||
face.pictures.push((rect, texel));
|
||||
}
|
||||
egui::Shape::Rect(r) if field.contains_rect(r.rect) && r.fill != egui::Color32::TRANSPARENT => face.fills.push((r.rect, r.fill)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
face
|
||||
}
|
||||
|
||||
/// The Control bar's Style picker is a swatch of the style the selection is linked to: the field shows that style's
|
||||
/// thumbnail, and white once the selection is linked to no style. It paints no style's name, and it keeps its width
|
||||
/// whether the selection is linked or not and when a style with a long name is added.
|
||||
#[test]
|
||||
fn the_control_bar_style_picker_is_a_swatch_of_the_linked_style() {
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let mut app = crate::VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 40, "height": 40})).unwrap();
|
||||
let mut bar = control_shown(app);
|
||||
bar.fixture.record_paint();
|
||||
let mut textures = std::collections::HashMap::new();
|
||||
bar.room(egui::vec2(2400.0, 300.0));
|
||||
let unlinked = style_face(&mut bar, &mut textures).field.width();
|
||||
let long = "A graphic style whose name is longer than any field on the bar";
|
||||
bar.app().run("paint.setFill", json!({"color": "#ff0000"})).unwrap();
|
||||
bar.app().run("graphicStyle.new", json!({"name": long})).unwrap();
|
||||
bar.app().run("graphicStyle.apply", json!({"name": long})).unwrap();
|
||||
let linked = bar.app().session.selection_graphic_style().is_some_and(|(g, linked)| linked && g.name == long);
|
||||
assert!(linked, "the rectangle is linked to the new style");
|
||||
let face = style_face(&mut bar, &mut textures);
|
||||
let shown = face.field.width();
|
||||
assert!((shown - unlinked).abs() < 0.5, "the swatch keeps its width: {unlinked} unlinked, {shown} linked to {long:?}");
|
||||
assert!(!bar.texts().iter().any(|t| t.text.contains(long)), "the swatch paints no style name: {:?}", bar.texts());
|
||||
let largest = |face: &StyleFace| face.pictures.iter().copied().max_by(|a, b| a.0.area().total_cmp(&b.0.area()));
|
||||
let Some((thumb, Some(texel))) = largest(&face) else { panic!("the field shows the style's thumbnail: {:?}", face.pictures) };
|
||||
assert!(texel.r() > 180 && texel.g() < 70 && texel.b() < 70, "the thumbnail shows the style's red fill: {texel:?}");
|
||||
|
||||
// Break Link to Graphic Style: the field turns white where the thumbnail was.
|
||||
bar.app().run("graphicStyle.breakLink", json!({})).unwrap();
|
||||
assert!(bar.app().session.selection_graphic_style().is_none_or(|(_, linked)| !linked), "the rectangle is linked to no style");
|
||||
let face = style_face(&mut bar, &mut textures);
|
||||
assert!((face.field.width() - unlinked).abs() < 0.5, "the swatch keeps its width once unlinked");
|
||||
let middle = thumb.center();
|
||||
assert!(!face.pictures.iter().any(|(r, _)| r.contains(middle)), "no thumbnail shows once unlinked: {:?}", face.pictures);
|
||||
let top = face.fills.iter().rev().find(|(r, _)| r.contains(middle)).map(|(_, fill)| *fill);
|
||||
assert_eq!(top, Some(egui::Color32::WHITE), "the unlinked swatch is white: {:?}", face.fills);
|
||||
}
|
||||
|
||||
/// The Control bar shows the Global Edit Options dropdown while Start Global Edit can run. Its
|
||||
/// options are the session's, which the Properties panel's dropdown also sets: Match Size from
|
||||
/// the Control bar narrows the Results and the objects Start Global Edit takes. The dropdown is off
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
//! Each field is unset (empty, absent, or a checkbox in its unset state) or set, and an unset field leaves
|
||||
//! its attribute out of the style. A field still as it opened keeps the style's stored value as it is.
|
||||
|
||||
use std::ops::RangeInclusive;
|
||||
use std::sync::Arc;
|
||||
|
||||
use craft::behavior::Mixed;
|
||||
use craft::text::ui::character::{AKI_PRESETS, DIACRITIC_PRESETS, TSUME_PRESETS};
|
||||
use craft::ui::choice::Checkbox;
|
||||
use craft::ui::contract::{Bind, Entry, Outcome as _, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::dialog::{DialogResult, FieldRefusal};
|
||||
@@ -15,7 +17,8 @@ use craft::ui::patterns::form_dialogs::{
|
||||
DialogFields, FieldValue, HostedPropertiesDialog, Param, ParamKind, PropertiesDialog, PropertiesTab, PropertyRow, TabLayout,
|
||||
};
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::runtime::env::{Env, Label};
|
||||
use craft::ui::text::{NumberField, NumberPick};
|
||||
use serde_json::{Map, Value, json};
|
||||
use vectorcraft_doc::setup::DocSetup;
|
||||
|
||||
@@ -429,6 +432,23 @@ fn case_from_attrs(attrs: &Map<String, Value>) -> Option<&'static str> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The number the text typed into number field `key` reads as, with the arithmetic of the app's number
|
||||
/// fields (`6x2`, `10+4`, `200/2`) and a decimal comma: a length in points in the length fields (`1 in`),
|
||||
/// and a final `%` in the percent fields or `°` in Character Rotation.
|
||||
fn typed_number(key: &str, text: &str) -> Option<f64> {
|
||||
let text = text.trim().replace('\u{2212}', "-");
|
||||
let text = vectorcraft_doc::decimal_point(&text);
|
||||
let mark = match key {
|
||||
"size" | "leading" | "baseline_shift" | "tcyUpDown" | "tcyLeftRight" | "stroke_width" => {
|
||||
return vectorcraft_doc::Unit::Points.parse(&text);
|
||||
}
|
||||
"h_scale" | "v_scale" | "tsume" | "fill_tint" | "stroke_tint" => Some('%'),
|
||||
"rotation" => Some('°'),
|
||||
_ => None,
|
||||
};
|
||||
vectorcraft_doc::parse_number(mark.and_then(|m| text.strip_suffix(m)).unwrap_or(&text))
|
||||
}
|
||||
|
||||
fn optional_number(d: &Values, key: &str) -> Result<Option<Value>, String> {
|
||||
let label = match key {
|
||||
"size" => tl!("Size"),
|
||||
@@ -458,7 +478,7 @@ fn optional_number(d: &Values, key: &str) -> Result<Option<Value>, String> {
|
||||
Some(v) => {
|
||||
let n = v
|
||||
.as_f64()
|
||||
.or_else(|| v.as_str().and_then(|s| s.trim().parse::<f64>().ok()))
|
||||
.or_else(|| v.as_str().and_then(|s| typed_number(key, s)))
|
||||
.filter(|n| n.is_finite())
|
||||
.ok_or_else(|| format!("{label} must be a number"))?;
|
||||
// Character Style fields use the Character panel's visible ranges.
|
||||
@@ -898,7 +918,39 @@ fn basic_rows() -> Vec<PropertyRow> {
|
||||
])
|
||||
}
|
||||
|
||||
// PLAN: the Aki, Tsume and Diacritic rows are plain text rows: `Param::text` has no preset menu to carry the Character panel's presets.
|
||||
/// A number row over the text field `key` (empty for unset) whose menu offers `presets`, as the Character panel's field
|
||||
/// of the same name does. A typed value stays within `range`; automation sets the field's text, as for a text row.
|
||||
fn preset_number(key: &'static str, label: String, range: RangeInclusive<f64>, presets: &'static [f32]) -> Param {
|
||||
let name = label.clone();
|
||||
Param::custom(key, label, move |ui, fields, _| {
|
||||
let value = fields.text(key).and_then(|text| text.trim().parse::<f64>().ok()).filter(|n| n.is_finite());
|
||||
let units = Env::of(ui).units();
|
||||
let rows: Vec<Entry<NumberPick>> = presets
|
||||
.iter()
|
||||
.map(|&p| {
|
||||
let n = f64::from(p);
|
||||
Entry::new(NumberPick::Number(n), units.number(n, 0..=2))
|
||||
})
|
||||
.collect();
|
||||
let out = NumberField::new(name.clone(), Bind::given(value)).range(range.clone()).presets(&rows).id_salt(key).show(ui);
|
||||
if let Some(picked) = out.edit.value() {
|
||||
let text = picked.map(|n| n.to_string()).unwrap_or_default();
|
||||
if fields.text(key) != Some(text.as_str()) {
|
||||
fields.set(key, FieldValue::Text(text));
|
||||
}
|
||||
}
|
||||
out.edit.response.clone()
|
||||
})
|
||||
// Set from outside: the field's text, as a text row takes it.
|
||||
.on_set(|fields, key, value| match value {
|
||||
Value::String(text) => {
|
||||
fields.set(key, FieldValue::Text(text));
|
||||
Ok(())
|
||||
}
|
||||
other => Err(FieldRefusal::Rejects(&other).message(key)),
|
||||
})
|
||||
}
|
||||
|
||||
fn advanced_rows() -> Vec<PropertyRow> {
|
||||
let mut params: Vec<Param> = [
|
||||
("h_scale", tl!("Horizontal Scale"), "%"),
|
||||
@@ -907,15 +959,20 @@ fn advanced_rows() -> Vec<PropertyRow> {
|
||||
("tcyUpDown", tl!("Tate-chu-yoko Up/Down"), "pt"),
|
||||
("tcyLeftRight", tl!("Tate-chu-yoko Left/Right"), "pt"),
|
||||
("rotation", tl!("Character Rotation"), "°"),
|
||||
("akiLeft", tl!("Insert Aki Left"), ""),
|
||||
("akiRight", tl!("Insert Aki Right"), ""),
|
||||
("tsume", tl!("Tsume"), "%"),
|
||||
("diacriticHorizontal", tl!("Adjust Horizontal Diacritic Position"), ""),
|
||||
("diacriticVertical", tl!("Adjust Vertical Diacritic Position"), ""),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|(key, caption, unit)| text(key, if unit.is_empty() { caption.to_string() } else { format!("{caption} ({unit})") }))
|
||||
.map(|(key, caption, unit)| text(key, format!("{caption} ({unit})")))
|
||||
.collect();
|
||||
let aki = 0.0..=vectorcraft_doc::text::MAX_AKI;
|
||||
let tsume = 0.0..=vectorcraft_doc::text::MAX_TSUME;
|
||||
let diacritic = -vectorcraft_doc::text::MAX_DIACRITIC_POSITION..=vectorcraft_doc::text::MAX_DIACRITIC_POSITION;
|
||||
params.extend([
|
||||
preset_number("akiLeft", tl!("Insert Aki Left").to_string(), aki.clone(), &AKI_PRESETS),
|
||||
preset_number("akiRight", tl!("Insert Aki Right").to_string(), aki, &AKI_PRESETS),
|
||||
preset_number("tsume", format!("{} (%)", tl!("Tsume")), tsume, &TSUME_PRESETS),
|
||||
preset_number("diacriticHorizontal", tl!("Adjust Horizontal Diacritic Position").to_string(), diacritic.clone(), &DIACRITIC_PRESETS),
|
||||
preset_number("diacriticVertical", tl!("Adjust Vertical Diacritic Position").to_string(), diacritic, &DIACRITIC_PRESETS),
|
||||
]);
|
||||
let languages: Vec<(&'static str, &'static str)> = vectorcraft_doc::setup::LANGUAGES.iter().map(|(name, _, _)| (*name, *name)).collect();
|
||||
params.push(select("language", tl!("Language:"), &languages));
|
||||
rows(params)
|
||||
|
||||
@@ -515,6 +515,33 @@ fn diacritic_position_fields_show_set_reset_and_commit() {
|
||||
assert!(t.runs.iter().all(|r| (r.style.diacritic_horizontal, r.style.diacritic_vertical) == (-120.0, 1000.0)));
|
||||
}
|
||||
|
||||
/// The number fields read typed text as the app's other number fields do: `6x2`, `10+4`, `200/2%`,
|
||||
/// `45°`, a decimal comma, and a length with its unit. `%` and `°` only where the field takes them,
|
||||
/// and an exponent is not read.
|
||||
#[test]
|
||||
fn number_fields_take_field_arithmetic() {
|
||||
let typed = [
|
||||
("size", "6x2", 12.0),
|
||||
("tracking", "10+4", 14.0),
|
||||
("h_scale", "200/2%", 100.0),
|
||||
("rotation", "45°", 45.0),
|
||||
("fill_tint", "25*2", 50.0),
|
||||
("leading", "1 in", 72.0),
|
||||
("baseline_shift", "\u{2212}2", -2.0),
|
||||
("kerning", "12,5", 12.5),
|
||||
];
|
||||
for (key, text, want) in typed {
|
||||
let (mut d, _) = dialog_for(json!({}));
|
||||
put(&mut d, key, json!(text));
|
||||
assert_eq!(optional_number(&Values::new(&d), key), Ok(Some(json!(want))), "{key} {text}");
|
||||
}
|
||||
for (key, text) in [("size", "12°"), ("leading", "50%"), ("tracking", "10%"), ("rotation", "45%"), ("h_scale", "1%2"), ("size", "1e3")] {
|
||||
let (mut d, _) = dialog_for(json!({}));
|
||||
put(&mut d, key, json!(text));
|
||||
assert!(optional_number(&Values::new(&d), key).is_err(), "{key} {text}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Tsume: empty is unset, an explicit 0 stays set, a typed value stops at 0 and 100, Reset Panel
|
||||
/// unsets it, and it commits to the style and the text set in it.
|
||||
#[test]
|
||||
@@ -523,7 +550,7 @@ fn tsume_field_shows_sets_resets_and_commits() {
|
||||
assert_eq!(val(&d, "tsume"), json!(""));
|
||||
let (mut d, o) = dialog_for(json!({"tsume": 50.0}));
|
||||
assert_eq!(val(&d, "tsume"), json!("50.0"));
|
||||
for (typed, kept) in [("0", 0.0), ("25.5", 25.5), ("150", 100.0), ("-5", 0.0)] {
|
||||
for (typed, kept) in [("0", 0.0), ("25.5", 25.5), ("25%", 25.0), ("50/2%", 25.0), ("150", 100.0), ("-5", 0.0)] {
|
||||
put(&mut d, "tsume", json!(typed));
|
||||
assert_eq!(edited_attrs(&d, &o).unwrap(), attrs(json!({"tsume": kept})), "{typed}");
|
||||
}
|
||||
@@ -547,6 +574,41 @@ fn tsume_field_shows_sets_resets_and_commits() {
|
||||
assert!(t.runs.iter().all(|r| r.style.tsume == 75.0));
|
||||
}
|
||||
|
||||
/// The Insert Aki, Tsume and diacritic rows each have the Character panel's presets menu beside the field, and a
|
||||
/// preset picked from it is the field's value and commits to the style, with each frame drawn once.
|
||||
#[test]
|
||||
fn aki_tsume_and_diacritic_rows_pick_from_the_character_panel_presets() {
|
||||
use craft::ui::testing::Fixture;
|
||||
let mut fx = Fixture::new(|ui| crate::dialogs::host::window_dialogs(ui.ctx()).with(|host| host.run(ui)));
|
||||
fx.room(egui::vec2(900.0, 900.0));
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.ui_ctx = Some(fx.ctx().clone());
|
||||
app.run("file.new", json!({"width": 300, "height": 200})).unwrap();
|
||||
styled(&mut app, json!({"size": 24.0}), "Text");
|
||||
open(&mut app, "Body");
|
||||
set::<Existing>(&app, "tab", json!("advanced"));
|
||||
fx.settle();
|
||||
|
||||
let presets_in_row = |fx: &Fixture, label: &str| {
|
||||
let field = fx.by_label(label).unwrap_or_else(|| panic!("the {label} field"));
|
||||
let tree = fx.tree();
|
||||
tree.keys().into_iter().filter(|key| tree.name_of(*key) == Some("Presets")).filter_map(|key| fx.target(key)).find(|chevron| {
|
||||
chevron.rect.center().y > field.rect.top() && chevron.rect.center().y < field.rect.bottom() && chevron.rect.left() >= field.rect.left()
|
||||
})
|
||||
};
|
||||
for label in ["Insert Aki Left", "Insert Aki Right", "Tsume (%)", "Adjust Horizontal Diacritic Position", "Adjust Vertical Diacritic Position"] {
|
||||
assert!(presets_in_row(&fx, label).is_some(), "{label} has a presets menu");
|
||||
}
|
||||
|
||||
let chevron = presets_in_row(&fx, "Insert Aki Left").unwrap();
|
||||
fx.click(&chevron).settle();
|
||||
let pick = fx.by_label("500").expect("the 500 preset");
|
||||
fx.click(&pick).settle();
|
||||
assert_eq!(fields::<Existing>(&app)["akiLeft"], json!("500"));
|
||||
assert!(ok::<Existing>(&mut app));
|
||||
assert_eq!(app.session.doc().unwrap().doc.char_styles[0].attrs, attrs(json!({"size": 24.0, "akiLeft": 500.0})));
|
||||
}
|
||||
|
||||
/// The negated tags of the twenty stylistic sets: an explicit empty Stylistic Sets choice.
|
||||
fn no_sets() -> Vec<String> {
|
||||
vectorcraft_text::EXTRA_FEATURES[..20].iter().map(|s| format!("-{s}")).collect()
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
//! `artboard.setProps {index, color}`.
|
||||
//!
|
||||
//! A command dialog's colour row raises a `ColorRequest`; [`pump`] opens a picker over that dialog
|
||||
//! and answers the row with its OK.
|
||||
//! and answers the row with its OK. The OK for a Save for Web colour table cell shifts the cell's
|
||||
//! colour in the table instead ([`super::save_for_web::take_palette_pick`]).
|
||||
//!
|
||||
//! Fields agents set with `ui.dialog.set`: the framework picker's (`color`, `mode`, `webColors`,
|
||||
//! `swatches`, `library`). `stroke`, `artboard` and `color` come from the opener.
|
||||
@@ -253,7 +254,11 @@ fn finish(
|
||||
) {
|
||||
let preview = std::mem::take(&mut open.preview);
|
||||
match (result, &open.target) {
|
||||
(Some(DialogResult::Ok(r)), Target::Answer { parent, key }) => dialogs.with(|h| h.answer_color(*parent, key, r.picked.color)),
|
||||
(Some(DialogResult::Ok(r)), Target::Answer { parent, key }) => {
|
||||
if !super::save_for_web::take_palette_pick(app, *parent, key, open.start, r.picked.color) {
|
||||
dialogs.with(|h| h.answer_color(*parent, key, r.picked.color));
|
||||
}
|
||||
}
|
||||
(Some(DialogResult::Ok(r)), _) => {
|
||||
if let Err(e) = commit(app, open, preview, &r.picked) {
|
||||
app.status(e);
|
||||
|
||||
@@ -2092,9 +2092,6 @@ fn assign_tab(
|
||||
}
|
||||
});
|
||||
}
|
||||
if rows.is_empty() {
|
||||
Text::new(tl!("No colors to recolor (preserved colors are left out).")).shade(Shade::Muted).show(ui);
|
||||
}
|
||||
let columns = vec![
|
||||
ColumnSpec::new(
|
||||
CURRENT,
|
||||
@@ -2122,10 +2119,12 @@ fn assign_tab(
|
||||
let source = keyed(&keys, |k| *k).with_text(|k| Cow::Owned(names.get(*k).cloned().unwrap_or_default()));
|
||||
let edits: RefCell<Vec<RowEdit>> = RefCell::new(Vec::new());
|
||||
let shown_rows: &[Value] = rows;
|
||||
let out = Table::<usize>::new(tl!("Colors"), columns).min_rows(5).max_rows(8).selection(Bind::bound(&mut sel)).show_items(
|
||||
ui,
|
||||
&source,
|
||||
&mut |key, icx| {
|
||||
let out = Table::<usize>::new(tl!("Colors"), columns)
|
||||
.min_rows(5)
|
||||
.max_rows(8)
|
||||
.empty(tl!("No colors to recolor (preserved colors are left out)."))
|
||||
.selection(Bind::bound(&mut sel))
|
||||
.show_items(ui, &source, &mut |key, icx| {
|
||||
let i = *key;
|
||||
let edits = &edits;
|
||||
let row = shown_rows.get(i).cloned().unwrap_or_default();
|
||||
@@ -2159,8 +2158,7 @@ fn assign_tab(
|
||||
edits.borrow_mut().push(RowEdit::Hex(i, *c));
|
||||
}
|
||||
})
|
||||
},
|
||||
);
|
||||
});
|
||||
let mut items = sel.items.clone();
|
||||
items.sort_unstable();
|
||||
items.dedup();
|
||||
|
||||
@@ -19,10 +19,12 @@ use vectorcraft_render::encode::quantize::Reduction;
|
||||
|
||||
use craft::behavior::PixelSize;
|
||||
use craft::host::PickRequest;
|
||||
use craft::theme::Srgba;
|
||||
use craft::ui::dialog::{DialogId, DialogResult, StackDialog};
|
||||
use craft::ui::patterns::form_dialogs::{
|
||||
BrowserPreview, ColorTable, ColorTableEdit, ColorTableEvent, HostedSaveForWeb, OptimizeAnswer, OptimizeRequest, OptimizeScope, OptimizeStart,
|
||||
SaveForWebOptions, SaveForWebResult, WantedVariant, WebDocument, WebFormat, WebPreset, WebPresetEvent, WebSlice, WebSlices, WebVariant,
|
||||
PALETTE_COLOR_KEY, SaveForWebOptions, SaveForWebResult, WantedVariant, WebDocument, WebFormat, WebPreset, WebPresetEvent, WebSlice, WebSlices,
|
||||
WebVariant,
|
||||
};
|
||||
use craft::ui::primitives::{Revision, TextureStore, TextureStoreOptions};
|
||||
use craft::ui::runtime::requests::PathRequest;
|
||||
@@ -432,7 +434,7 @@ fn on_dialog<R>(host: &craft::ui::shell::WindowDialogs, f: impl FnOnce(&mut Host
|
||||
|
||||
/// Answers the open dialog once per frame: its result when it closed, else its requests.
|
||||
/// Colour requests (the matte, a palette cell) are routed by the host-wide colour picker routing;
|
||||
/// a palette answer comes back as a `Shift` table event.
|
||||
/// a palette cell's pick is applied to the table by [`take_palette_pick`].
|
||||
pub(crate) fn pump(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
let Some(host) = app.dialogs() else { return };
|
||||
match host.with(|h| h.take::<HostedSaveForWeb>()) {
|
||||
@@ -511,12 +513,7 @@ fn answer_variants(app: &mut VectorcraftApp, ctx: &egui::Context, host: &craft::
|
||||
|
||||
/// Applies the colour table edits the dialog filed. A Delete clears the dialog's colour selection.
|
||||
fn edit_table(app: &mut VectorcraftApp, ctx: &egui::Context, host: &craft::ui::shell::WindowDialogs, asked: &Asked) {
|
||||
let shown = app
|
||||
.session
|
||||
.web_settings(&settings_of(&asked.options, &app.web_export.table, None))
|
||||
.and_then(|s| encoded(app, &s))
|
||||
.map(|o| o.colors.iter().map(|c| c.source).collect::<Vec<[u8; 3]>>());
|
||||
let shown = match shown {
|
||||
let shown = match shown_colors(app, &asked.options) {
|
||||
Ok(shown) => shown,
|
||||
Err(e) => return app.status(e),
|
||||
};
|
||||
@@ -533,6 +530,36 @@ fn edit_table(app: &mut VectorcraftApp, ctx: &egui::Context, host: &craft::ui::s
|
||||
}
|
||||
}
|
||||
|
||||
/// The source colours of the palette the dialog's settings `options` show, with the table as it stands.
|
||||
fn shown_colors(app: &mut VectorcraftApp, options: &SaveForWebOptions) -> Result<Vec<[u8; 3]>, String> {
|
||||
let settings = app.session.web_settings(&settings_of(options, &app.web_export.table, None))?;
|
||||
Ok(encoded(app, &settings)?.colors.iter().map(|c| c.source).collect())
|
||||
}
|
||||
|
||||
/// The Color Picker's OK for the colour table cell `key` of the open dialog `parent`: the cell's colour `from`
|
||||
/// is shifted to `to` in the table at once, so Done or Save in the dialog's next pass keeps the shift. A colour
|
||||
/// the palette no longer shows is not shifted, and a refused shift shows in the status line. `false` when
|
||||
/// `parent` is not Save for Web or `key` is not its palette, and the picker answers the row instead.
|
||||
pub(crate) fn take_palette_pick(app: &mut VectorcraftApp, parent: DialogId, key: &str, from: Srgba, to: Srgba) -> bool {
|
||||
let Some(host) = app.dialogs() else { return false };
|
||||
if key != PALETTE_COLOR_KEY {
|
||||
return false;
|
||||
}
|
||||
let Some(options) = host.with(|h| h.get_mut_by_id::<HostedSaveForWeb>(parent).map(|d| d.current().clone())) else {
|
||||
return false;
|
||||
};
|
||||
let rgb = |c: Srgba| {
|
||||
let [r, g, b, _] = c.to_rgba().0;
|
||||
[r, g, b]
|
||||
};
|
||||
let edit = ColorTableEdit::Shift(rgb(to));
|
||||
let shifted = shown_colors(app, &options).and_then(|shown| color_table::apply(&mut app.web_export.table, &edit, &[rgb(from)], &shown));
|
||||
if let Err(e) = shifted {
|
||||
app.status(e);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
/// Runs what the preset list asked for and shows a failure in the status line.
|
||||
fn store_presets(app: &mut VectorcraftApp, events: Vec<WebPresetEvent>) {
|
||||
for event in events {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
//! The Save for Web colour table model: the edits the table's buttons and menu make, applied to the
|
||||
//! engine's `colorTable` value (`webexport::ColorTable`), and the marks the table shows from it.
|
||||
//!
|
||||
//! The value is user input (automation sets it), so every read skips what is not a `#rrggbb`
|
||||
//! string. Lists hold lowercase `#rrggbb` and colours compare case-insensitively.
|
||||
//! The value is user input (automation sets it), so every read skips what is not a colour.
|
||||
//! Entries compare as the colours they name, however each is written (`#F00`, `#ff0000`), as the
|
||||
//! engine reads them; the edits write lowercase `#rrggbb`.
|
||||
|
||||
use serde_json::{Map, Value, json};
|
||||
use vectorcraft_engine::cmd::webexport;
|
||||
@@ -15,14 +16,30 @@ fn hex(c: [u8; 3]) -> String {
|
||||
format!("#{:02x}{:02x}{:02x}", c[0], c[1], c[2])
|
||||
}
|
||||
|
||||
/// The colour a `#rrggbb` string names.
|
||||
/// The colour `s` names, read as the engine reads the table's colours: `None` for text that is not
|
||||
/// a colour and for a spelling with alpha (four or eight hex digits).
|
||||
fn parse(s: &str) -> Option<[u8; 3]> {
|
||||
let digits = s.strip_prefix('#')?;
|
||||
if digits.len() != 6 || !digits.bytes().all(|b| b.is_ascii_hexdigit()) {
|
||||
let t = s.trim();
|
||||
let digits = t.strip_prefix('#').unwrap_or(t);
|
||||
if matches!(digits.len(), 4 | 8) && digits.bytes().all(|b| b.is_ascii_hexdigit()) {
|
||||
return None;
|
||||
}
|
||||
let channel = |i: usize| u8::from_str_radix(digits.get(i..i + 2)?, 16).ok();
|
||||
Some([channel(0)?, channel(2)?, channel(4)?])
|
||||
let [r, g, b, _] = vectorcraft_color::Color::from_hex(t)?.to_rgba8(1.0);
|
||||
Some([r, g, b])
|
||||
}
|
||||
|
||||
/// Whether `a` and `b` name one colour, however each is written; text that names no colour matches
|
||||
/// only the same text in any case.
|
||||
fn same(a: &str, b: &str) -> bool {
|
||||
match (parse(a), parse(b)) {
|
||||
(Some(a), Some(b)) => a == b,
|
||||
_ => a.eq_ignore_ascii_case(b),
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `list` holds an entry that names `color`.
|
||||
fn holds(list: &[String], color: &str) -> bool {
|
||||
list.iter().any(|c| same(c, color))
|
||||
}
|
||||
|
||||
/// The strings of the table's list `key`, lowercase.
|
||||
@@ -50,30 +67,31 @@ fn toggle(table: &mut Value, key: &str, colors: &[String]) {
|
||||
return;
|
||||
}
|
||||
let mut v = list(table, key);
|
||||
if colors.iter().all(|c| v.contains(c)) {
|
||||
v.retain(|c| !colors.contains(c));
|
||||
if colors.iter().all(|c| holds(&v, c)) {
|
||||
v.retain(|c| !holds(colors, c));
|
||||
} else {
|
||||
let missing: Vec<String> = colors.iter().filter(|c| !v.contains(c)).cloned().collect();
|
||||
let missing: Vec<String> = colors.iter().filter(|c| !holds(&v, c)).cloned().collect();
|
||||
v.extend(missing);
|
||||
}
|
||||
set_table(table, key, json!(v));
|
||||
}
|
||||
|
||||
/// Take `colors` out of the table's list `key`; the list is left alone when none is in it.
|
||||
/// Take `colors` out of the table's list `key` (every entry that names one of them); the list is
|
||||
/// left alone when none is in it.
|
||||
fn remove(table: &mut Value, key: &str, colors: &[String]) {
|
||||
let mut v = list(table, key);
|
||||
let before = v.len();
|
||||
v.retain(|c| !colors.contains(c));
|
||||
v.retain(|c| !holds(colors, c));
|
||||
if v.len() != before {
|
||||
set_table(table, key, json!(v));
|
||||
}
|
||||
}
|
||||
|
||||
/// Take the shift by hand of the source colour `source` away.
|
||||
/// Take the shift by hand of the source colour `source` away: every key that names that colour.
|
||||
fn unshift(table: &mut Value, source: &str) {
|
||||
let mut map = shifts(table);
|
||||
let before = map.len();
|
||||
map.retain(|k, _| !k.eq_ignore_ascii_case(source));
|
||||
map.retain(|k, _| !same(k, source));
|
||||
if map.len() != before {
|
||||
set_table(table, "shifted", Value::Object(map));
|
||||
}
|
||||
@@ -111,7 +129,7 @@ pub(crate) fn apply(table: &mut Value, edit: &ColorTableEdit, colors: &[[u8; 3]]
|
||||
// first selected colour is shifted to.
|
||||
ColorTableEdit::Shift(to) => {
|
||||
if let Some(&from) = colors.first().filter(|c| shown.contains(c)) {
|
||||
shift(table, from, *to);
|
||||
return shift(table, from, *to);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
@@ -130,12 +148,13 @@ pub(crate) fn apply(table: &mut Value, edit: &ColorTableEdit, colors: &[[u8; 3]]
|
||||
match edit {
|
||||
ColorTableEdit::Lock => {
|
||||
let by_hand = shifts(table);
|
||||
let free: Vec<String> = picked.into_iter().filter(|c| !by_hand.keys().any(|k| k.eq_ignore_ascii_case(c))).collect();
|
||||
let free: Vec<String> = picked.into_iter().filter(|c| !by_hand.keys().any(|k| same(k, c))).collect();
|
||||
toggle(table, "locked", &free);
|
||||
}
|
||||
ColorTableEdit::Transparent => toggle(table, "transparent", &picked),
|
||||
ColorTableEdit::WebShift => {
|
||||
let adds = !picked.iter().all(|c| list(table, "webShift").contains(c));
|
||||
let web = list(table, "webShift");
|
||||
let adds = !picked.iter().all(|c| holds(&web, c));
|
||||
toggle(table, "webShift", &picked);
|
||||
if adds {
|
||||
picked.iter().for_each(|c| unshift(table, c));
|
||||
@@ -157,12 +176,12 @@ fn delete(table: &mut Value, picked: &[String], shown: &[[u8; 3]]) -> Result<(),
|
||||
}
|
||||
let mut deleted = list(table, "deleted");
|
||||
for c in picked {
|
||||
if !deleted.contains(c) {
|
||||
if !holds(&deleted, c) {
|
||||
deleted.push(c.clone());
|
||||
}
|
||||
}
|
||||
let clear: Vec<String> = list(table, "transparent").into_iter().filter(|c| !picked.contains(c)).collect();
|
||||
if custom.iter().all(|c| deleted.contains(c) || clear.contains(c)) {
|
||||
let clear: Vec<String> = list(table, "transparent").into_iter().filter(|c| !holds(picked, c)).collect();
|
||||
if custom.iter().all(|c| holds(&deleted, c) || holds(&clear, c)) {
|
||||
return Err(webexport::KEEP_ONE.into());
|
||||
}
|
||||
for key in ["locked", "transparent", "webShift"] {
|
||||
@@ -177,16 +196,44 @@ fn delete(table: &mut Value, picked: &[String], shown: &[[u8; 3]]) -> Result<(),
|
||||
}
|
||||
|
||||
/// Shift the source colour `from` to `to`, wherever it is in the image; it is no longer
|
||||
/// web-shifted. Shifting a colour to itself takes its shift away.
|
||||
pub(crate) fn shift(table: &mut Value, from: [u8; 3], to: [u8; 3]) {
|
||||
/// web-shifted. Shifting a colour to itself takes its shift away. A shift that would leave more
|
||||
/// than 256 colours shifted is refused with the engine's limit error, and nothing changes. Entries the
|
||||
/// engine drops (a colour shifted to itself, a deleted colour) do not count, and a new shift writes
|
||||
/// the map without them.
|
||||
pub(crate) fn shift(table: &mut Value, from: [u8; 3], to: [u8; 3]) -> Result<(), String> {
|
||||
let (source, to) = (hex(from), hex(to));
|
||||
let deleted: Vec<[u8; 3]> = list(table, "deleted").iter().filter_map(|c| parse(c)).collect();
|
||||
let map = shifts(table);
|
||||
// Entries are dropped only from a map the engine accepts (at most 256 entries, every key and
|
||||
// value a colour, no two keys naming one colour); any other map is kept whole for the engine to
|
||||
// refuse.
|
||||
let mut keys: Vec<[u8; 3]> = Vec::new();
|
||||
let valid = map.len() <= webexport::MAX_TABLE
|
||||
&& map.iter().all(|(k, v)| match (parse(k), v.as_str().and_then(parse)) {
|
||||
(Some(k), Some(_)) if !keys.contains(&k) => {
|
||||
keys.push(k);
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
});
|
||||
let live = |k: &str, v: &Value| {
|
||||
let (true, Some(key), Some(to)) = (valid, parse(k), v.as_str().and_then(parse)) else { return true };
|
||||
to != key && !deleted.contains(&key)
|
||||
};
|
||||
let count = map.iter().filter(|(k, v)| live(k, v)).count();
|
||||
let held = usize::from(map.iter().any(|(k, v)| live(k, v) && same(k, &source)));
|
||||
if to != source && count - held >= webexport::MAX_TABLE {
|
||||
return Err(webexport::too_many("shifted"));
|
||||
}
|
||||
unshift(table, &source);
|
||||
if to != source {
|
||||
let mut map = shifts(table);
|
||||
map.retain(|k, v| live(k, v));
|
||||
map.insert(source.clone(), json!(to));
|
||||
set_table(table, "shifted", Value::Object(map));
|
||||
}
|
||||
remove(table, "webShift", &[source]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Restore Generated Table: no deleted colours and no fixed palette; the reduction makes the
|
||||
@@ -197,9 +244,17 @@ pub(crate) fn restore(table: &mut Value) {
|
||||
}
|
||||
|
||||
/// What the table shows of `table`: its locked, transparent and shifted colours. An entry that is
|
||||
/// not a colour is skipped.
|
||||
/// not a colour is skipped, and a colour written more than once in a list is listed once.
|
||||
pub(crate) fn marks(table: &Value) -> TableMarks {
|
||||
let colors = |key: &str| list(table, key).iter().filter_map(|c| parse(c)).collect();
|
||||
let colors = |key: &str| {
|
||||
let mut out: Vec<[u8; 3]> = Vec::new();
|
||||
for c in list(table, key).iter().filter_map(|c| parse(c)) {
|
||||
if !out.contains(&c) {
|
||||
out.push(c);
|
||||
}
|
||||
}
|
||||
out
|
||||
};
|
||||
let shifted = shifts(table).iter().filter_map(|(k, v)| Some((parse(k)?, parse(v.as_str()?)?))).collect();
|
||||
// PLAN: TableMarks lacks `web_shifted` (ex.W9 request); the Web Shift/Unshift label needs it.
|
||||
let mut marks = TableMarks::default();
|
||||
|
||||
@@ -31,7 +31,7 @@ fn every_table_edit_changes_the_lists_it_names() {
|
||||
run(&mut t, ColorTableEdit::Transparent, &[D], &shown).unwrap();
|
||||
assert_eq!(t["transparent"], json!(["#333333"]));
|
||||
// A hand-shifted colour stays locked: Lock does nothing to it.
|
||||
shift(&mut t, B, [255, 136, 0]);
|
||||
shift(&mut t, B, [255, 136, 0]).unwrap();
|
||||
run(&mut t, ColorTableEdit::Lock, &[B], &shown).unwrap();
|
||||
assert_eq!(t["locked"], json!([]));
|
||||
// Web Shift takes the hand shift away; Unshift takes colours out of webShift only.
|
||||
@@ -40,9 +40,9 @@ fn every_table_edit_changes_the_lists_it_names() {
|
||||
run(&mut t, ColorTableEdit::Unshift, &[B], &shown).unwrap();
|
||||
assert_eq!(t["webShift"], json!(["#222222"]));
|
||||
// A shift takes the colour out of webShift; one to the source colour takes it away.
|
||||
shift(&mut t, C, [0, 255, 0]);
|
||||
shift(&mut t, C, [0, 255, 0]).unwrap();
|
||||
assert_eq!((&t["webShift"], &t["shifted"]), (&json!([]), &json!({"#222222": "#00ff00"})));
|
||||
shift(&mut t, C, C);
|
||||
shift(&mut t, C, C).unwrap();
|
||||
assert_eq!(t["shifted"], json!({}));
|
||||
// The Shift edit is a shift of the first selected colour.
|
||||
run(&mut t, ColorTableEdit::Shift([1, 2, 3]), &[A], &shown).unwrap();
|
||||
@@ -110,6 +110,113 @@ fn an_edit_skips_selected_colors_the_table_does_not_show() {
|
||||
assert_eq!((&t["customPalette"], &t["deleted"]), (&json!(["#000000", "#111111"]), &json!(["#111111"])));
|
||||
}
|
||||
|
||||
/// With 256 colours shifted, shifting another colour is refused with the engine's limit error and
|
||||
/// changes nothing; a shifted colour can still be shifted again or have its shift taken away.
|
||||
#[test]
|
||||
fn a_shift_holds_at_most_256_colors() {
|
||||
let full: serde_json::Map<String, Value> = (0..256).map(|i| (format!("#{i:06x}"), json!("#ffffff"))).collect();
|
||||
let mut t = json!({"shifted": full});
|
||||
let before = t.clone();
|
||||
let e = shift(&mut t, [0x12, 0x34, 0x56], A).unwrap_err();
|
||||
assert_eq!((e, &t), (webexport::too_many("shifted"), &before));
|
||||
// The Shift edit reports the same error.
|
||||
let new = [0x12, 0x34, 0x56];
|
||||
assert_eq!(run(&mut t, ColorTableEdit::Shift(A), &[new], &[new]), Err(webexport::too_many("shifted")));
|
||||
assert_eq!(t, before);
|
||||
shift(&mut t, [0, 0, 5], A).unwrap();
|
||||
assert_eq!((t["shifted"]["#000005"].as_str(), t["shifted"].as_object().map(|m| m.len())), (Some("#000000"), Some(256)));
|
||||
shift(&mut t, [0, 0, 5], [0, 0, 5]).unwrap();
|
||||
shift(&mut t, new, A).unwrap();
|
||||
assert_eq!(t["shifted"]["#123456"], "#000000");
|
||||
}
|
||||
|
||||
/// Entries the engine drops (a colour shifted to itself, a deleted colour) do not count toward the
|
||||
/// 256 shifts, and a new shift writes the map without them. A map the engine refuses is kept whole.
|
||||
#[test]
|
||||
fn a_shift_skips_entries_the_engine_drops() {
|
||||
let mut full: serde_json::Map<String, Value> = (0..255).map(|i| (format!("#{i:06x}"), json!(format!("#{i:06x}")))).collect();
|
||||
full.insert("#abcdef".into(), json!("#000000"));
|
||||
let mut t = json!({"shifted": full, "deleted": ["#ABCDEF"]});
|
||||
shift(&mut t, [0x12, 0x34, 0x56], A).unwrap();
|
||||
assert_eq!(t["shifted"], json!({"#123456": "#000000"}));
|
||||
for shifted in [json!({"nope": "NOPE"}), json!({"#abcdef": "nope"}), json!({"#f00": "#f00", "#FF0000": "#00ff00"})] {
|
||||
let mut t = json!({"shifted": shifted.clone(), "deleted": ["#abcdef"]});
|
||||
shift(&mut t, [0x12, 0x34, 0x56], A).unwrap();
|
||||
let mut want = shifted.as_object().cloned().unwrap_or_default();
|
||||
want.insert("#123456".into(), json!("#000000"));
|
||||
assert_eq!(t["shifted"], Value::Object(want), "{shifted}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A map with more than 256 entries is one the engine refuses, so none of its entries are dropped:
|
||||
/// with 257 colours shifted to themselves, a new shift and a new target for a shifted colour are
|
||||
/// refused with the limit error and nothing changes. Taking a shift away still works.
|
||||
#[test]
|
||||
fn a_shift_keeps_a_map_over_the_limit_whole() {
|
||||
let over: serde_json::Map<String, Value> = (0..257).map(|i| (format!("#{i:06x}"), json!(format!("#{i:06x}")))).collect();
|
||||
let mut t = json!({"shifted": over});
|
||||
let before = t.clone();
|
||||
let e = shift(&mut t, [0x12, 0x34, 0x56], A).unwrap_err();
|
||||
assert_eq!((e, &t), (webexport::too_many("shifted"), &before));
|
||||
let e = shift(&mut t, [0, 0, 5], [0x12, 0x34, 0x56]).unwrap_err();
|
||||
assert_eq!((e, &t), (webexport::too_many("shifted"), &before));
|
||||
shift(&mut t, [0, 0, 5], [0, 0, 5]).unwrap();
|
||||
assert_eq!(t["shifted"].as_object().map(|m| m.len()), Some(256));
|
||||
}
|
||||
|
||||
/// A key or list entry written another way (`#F00`, upper case, `blue`) still names its colour:
|
||||
/// a new shift replaces it, Unshift and the buttons take it out, the marks show it, and a
|
||||
/// spelling with alpha names no colour.
|
||||
#[test]
|
||||
fn table_edits_match_a_color_written_another_way() {
|
||||
let (red, blue) = ([0xff, 0, 0], [0, 0, 0xff]);
|
||||
let shown = [red, blue];
|
||||
let mut t = json!({"shifted": {"#F00": "#00ff00", "nope": "#000000"}, "webShift": ["#0000FF"]});
|
||||
shift(&mut t, red, [0x12, 0x34, 0x56]).unwrap();
|
||||
assert_eq!(t["shifted"], json!({"#ff0000": "#123456", "nope": "#000000"}));
|
||||
shift(&mut t, blue, [0x65, 0x43, 0x21]).unwrap();
|
||||
assert_eq!(t["webShift"], json!([]));
|
||||
// Lock leaves a colour shifted under another spelling alone.
|
||||
let mut t = json!({"shifted": {"#F00": "#00ff00"}});
|
||||
run(&mut t, ColorTableEdit::Lock, &[red], &shown).unwrap();
|
||||
assert_eq!(t.get("locked"), None);
|
||||
// Each list's button takes out an entry written another way, as Unlock, Restore and Unshift do.
|
||||
for (list, edit) in [("locked", ColorTableEdit::Lock), ("transparent", ColorTableEdit::Transparent), ("webShift", ColorTableEdit::Unshift)] {
|
||||
let mut t = json!({ list: ["#00F", " #0000FF "] });
|
||||
let m = marks(&t);
|
||||
if list != "webShift" {
|
||||
assert_eq!(if list == "locked" { m.locked } else { m.transparent }, vec![blue], "{list}");
|
||||
}
|
||||
run(&mut t, edit, &[blue], &shown).unwrap();
|
||||
assert_eq!(t[list], json!([]), "{list}");
|
||||
}
|
||||
// Web Shift of a colour in the list under another spelling takes it out.
|
||||
let mut t = json!({"webShift": ["#00f"]});
|
||||
run(&mut t, ColorTableEdit::WebShift, &[blue], &shown).unwrap();
|
||||
assert_eq!(t["webShift"], json!([]));
|
||||
// A spelling with alpha names no colour.
|
||||
let mut t = json!({"locked": ["#0000ff80"]});
|
||||
assert_eq!(marks(&t).locked, Vec::<[u8; 3]>::new());
|
||||
run(&mut t, ColorTableEdit::Lock, &[blue], &shown).unwrap();
|
||||
assert_eq!(t["locked"], json!(["#0000ff80", "#0000ff"]));
|
||||
}
|
||||
|
||||
/// Delete Color compares the lists as colours: with blue mapped to transparent as `#00f`, deleting
|
||||
/// red, the only other colour, is refused with nothing changed, and a deleted colour written
|
||||
/// another way in `locked` (`blue`, ` #0000FF `) is taken out of the list.
|
||||
#[test]
|
||||
fn delete_color_compares_lists_written_another_way() {
|
||||
let (red, blue) = ([0xff, 0, 0], [0, 0, 0xff]);
|
||||
let shown = [blue, red];
|
||||
let mut t = json!({"transparent": ["#00f"]});
|
||||
let before = t.clone();
|
||||
assert_eq!(run(&mut t, ColorTableEdit::Delete, &[red], &shown), Err(webexport::KEEP_ONE.to_string()));
|
||||
assert_eq!(t, before);
|
||||
let mut t = json!({"locked": ["blue", " #0000FF ", "#ff0000"], "deleted": ["#00F"]});
|
||||
run(&mut t, ColorTableEdit::Delete, &[blue], &shown).unwrap();
|
||||
assert_eq!((&t["locked"], &t["deleted"]), (&json!(["#ff0000"]), &json!(["#00f"])));
|
||||
}
|
||||
|
||||
/// One app frame with `events`, a moment after the last.
|
||||
fn app_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec<egui::Event>) {
|
||||
let time = ctx.input(|i| i.time) + 0.05;
|
||||
@@ -188,6 +295,35 @@ fn a_picked_color_becomes_a_shift_and_cancel_shifts_nothing() {
|
||||
assert_eq!(app.web_export.table["shifted"], json!({"#0000ff": "#00ff00"}));
|
||||
}
|
||||
|
||||
/// Done right after the Color Picker's OK, before the dialog draws again, remembers the picked shift.
|
||||
#[test]
|
||||
fn done_right_after_the_color_picker_remembers_the_shift() {
|
||||
let dir = vectorcraft_testkit::temp_dir("sfw-shift-done");
|
||||
let (mut app, _) = app(&dir, false);
|
||||
app.run("shape.rectangle", json!({"x": 40, "y": 0, "width": 20, "height": 40})).unwrap();
|
||||
app.run("paint.setFill", json!({"color": "#0000ff"})).unwrap();
|
||||
app.run("file.saveForWeb", json!({})).unwrap();
|
||||
for (k, v) in [("format", json!("gif")), ("antiAlias", json!("none")), ("dither", json!("none"))] {
|
||||
set(&mut app, k, v);
|
||||
}
|
||||
let ctx = app.ui_ctx.clone().expect("the app has a window");
|
||||
crate::dialogs::host::pump(&mut app, &ctx);
|
||||
let picker = open_cell(&mut app, &ctx, "#0000ff");
|
||||
host(&app).with(|h| h.set_json_field(&ctx, picker, "color", json!("#00ff00"))).unwrap();
|
||||
host(&app).with(|h| h.confirm_by_id(&ctx, picker));
|
||||
// The frame that settles the picker, then Done before the dialog's next pass.
|
||||
app_frame(&mut app, &ctx, vec![]);
|
||||
set(&mut app, "choice", json!("done"));
|
||||
let dialog = id(&app);
|
||||
host(&app).with(|h| h.confirm_by_id(&ctx, dialog));
|
||||
for _ in 0..3 {
|
||||
app_frame(&mut app, &ctx, vec![]);
|
||||
}
|
||||
assert!(host(&app).with(|h| h.get::<craft::ui::patterns::form_dialogs::HostedSaveForWeb>().is_none()), "Done closes the dialog");
|
||||
let remembered = app.session.last_web_settings().color_table.shifted;
|
||||
assert_eq!(remembered.get("#0000ff").map(String::as_str), Some("#00ff00"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn restore_brings_back_a_preview_that_failed() {
|
||||
let dir = vectorcraft_testkit::temp_dir("sfw-restore-table");
|
||||
|
||||
@@ -36,6 +36,8 @@ fn the_print_dialog_saves_and_loads_presets() {
|
||||
set(&mut app, "copies", json!(4));
|
||||
set(&mut app, "media", json!("a4"));
|
||||
super::tests_print::press(&mut app, "New…");
|
||||
// The name field takes the keyboard in the frame after the press.
|
||||
pump(&mut app);
|
||||
call(&mut app, "ui.text", json!({"text": "Proofs"}));
|
||||
call(&mut app, "ui.key", json!({"key": "Enter"}));
|
||||
pump(&mut app);
|
||||
|
||||
@@ -87,6 +87,19 @@ fn strip(ctx: &egui::Context) -> egui::Rect {
|
||||
named(ctx, egui::accesskit::Role::TabList, |name| name == "Documents").expect("the tab strip was drawn")
|
||||
}
|
||||
|
||||
/// The tab strip at the top of the floating window drawn at `window` (it starts at the window's left edge, below its
|
||||
/// title bar), as the last frame drew it.
|
||||
fn window_strip(ctx: &egui::Context, window: egui::Rect) -> egui::Rect {
|
||||
let nodes: std::sync::Arc<Vec<Named>> = ctx.data(|d| d.get_temp(egui::Id::unique(NAMED))).unwrap_or_default();
|
||||
nodes
|
||||
.iter()
|
||||
.find(|(role, name, rect)| {
|
||||
*role == egui::accesskit::Role::TabList && name == "Window" && window.contains(rect.min) && (rect.left() - window.left()).abs() < 0.5
|
||||
})
|
||||
.map(|(_, _, rect)| *rect)
|
||||
.expect("the window's tab strip was drawn")
|
||||
}
|
||||
|
||||
fn button(pos: Pos2, pressed: bool) -> egui::Event {
|
||||
egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }
|
||||
}
|
||||
@@ -324,17 +337,20 @@ fn closing_a_floating_window_closes_its_document_and_asks_to_save_an_unsaved_one
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
// Document 0's window is behind document 1's: its close button is at the top right of its
|
||||
// title bar, clear of document 1's window to the right and below.
|
||||
let close_button = |app: &VectorcraftApp, i: usize| (window_of(app, &ctx, i), body_of(app, i));
|
||||
let (area0, body0) = close_button(&app, 0);
|
||||
assert!(body0.top() > area0.top(), "the window has a title bar");
|
||||
let close_button = |app: &VectorcraftApp, i: usize| {
|
||||
let area = window_of(app, &ctx, i);
|
||||
(area, window_strip(&ctx, area))
|
||||
};
|
||||
let (area0, tabs0) = close_button(&app, 0);
|
||||
assert!(tabs0.top() > area0.top(), "the window has a title bar");
|
||||
// Close document 1 (in front): it is unsaved after an edit, so the app asks first.
|
||||
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 40})).unwrap();
|
||||
assert!(app.session.documents()[1].is_dirty());
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
// The close button sits near the right end of the title bar.
|
||||
let press_close = |app: &mut VectorcraftApp, i: usize| {
|
||||
let (area, body) = close_button(app, i);
|
||||
let bar = (area.top() + body.top()) / 2.0;
|
||||
let (area, tabs) = close_button(app, i);
|
||||
let bar = (area.top() + tabs.top()) / 2.0;
|
||||
let n = app.session.documents().len();
|
||||
for dx in (4..40).step_by(3) {
|
||||
click(app, &ctx, pos2(area.right() - dx as f32, bar));
|
||||
|
||||
@@ -92,7 +92,6 @@ use slots::RECENT_FONT_IDS;
|
||||
pub(crate) use state::why_off;
|
||||
pub use state::{checked, enabled, plugin_revision, shortcut_of, shown_state};
|
||||
pub(crate) use submenus::PATH_EFFECTS;
|
||||
pub(crate) use tree::arrange_documents_items;
|
||||
pub use tree::{Listed, menu_tree, menu_tree_named};
|
||||
pub use ui_commands::UI_COMMANDS;
|
||||
|
||||
|
||||
@@ -86,6 +86,9 @@ pub(crate) fn state_key(app: &VectorcraftApp, input: Option<u64>) -> u64 {
|
||||
let mut h = DefaultHasher::new();
|
||||
input.hash(&mut h);
|
||||
app.run_count.hash(&mut h);
|
||||
// The window's keymap, which the panel rows read their shortcuts from (`Build::decorate`): the framework builds it
|
||||
// after the first frame's menus, and builds a new one when the bindings or the catalog change.
|
||||
app.ui_ctx.as_ref().and_then(craft::ui::runtime::commands::keymap).map(|k| std::sync::Arc::as_ptr(&k).addr()).hash(&mut h);
|
||||
let s = &app.session;
|
||||
(s.journal.len(), s.active_index(), s.clipboard.is_empty(), s.tool_composing()).hash(&mut h);
|
||||
if let Some(d) = s.active() {
|
||||
@@ -473,11 +476,18 @@ impl Build<'_> {
|
||||
item_title(self.app, self.lang, id, params, label)
|
||||
}
|
||||
|
||||
/// The alternates (a modifier held as the row is chosen) and the font sample of a row.
|
||||
/// The alternates (a modifier held as the row is chosen), the font sample and the shortcut of a row.
|
||||
fn decorate(&self, item: Item, id: &str, params: &Value) -> Item {
|
||||
let run_with = |mods: Mods, p: Value| Alternate::new(mods, CommandRef::with_params(id, p));
|
||||
let held = |shift: bool, alt: bool| Mods { cmd: false, ctrl: false, alt, shift };
|
||||
match id {
|
||||
// A panel row shows the chord of the panel's shortcut (`panel:<id>`), which binds `window.panel {panel}`;
|
||||
// a Window row runs it with `toggle: true`, so the framework finds no chord for the row's own command.
|
||||
"window.panel" => {
|
||||
let mut item = item;
|
||||
item.shortcut = super::labels::item_shortcut(self.app, id, params);
|
||||
item
|
||||
}
|
||||
"ui.expandDialog" => item.alternate(run_with(held(false, true), json!({ "immediate": true }))),
|
||||
crate::addons::select::link_status::COMMAND => {
|
||||
item.alternate(run_with(held(true, false), crate::addons::select::link_status::with_shift(params.clone())))
|
||||
|
||||
@@ -838,8 +838,7 @@ pub(super) fn transform_items() -> Vec<Node> {
|
||||
]
|
||||
}
|
||||
|
||||
/// Window → Arrange's Tile layouts, one `window.arrange.tile` `layout` each (also under the
|
||||
/// application bar's Arrange Documents button).
|
||||
/// Window → Arrange's Tile layouts, one `window.arrange.tile` `layout` each.
|
||||
fn tile_items() -> Vec<Node> {
|
||||
vec![
|
||||
c("Tile", "window.arrange.tile"),
|
||||
@@ -852,13 +851,6 @@ fn tile_items() -> Vec<Node> {
|
||||
]
|
||||
}
|
||||
|
||||
/// The application bar's Arrange Documents menu: Consolidate All Windows, then the Tile layouts.
|
||||
pub(crate) fn arrange_documents_items() -> Vec<Node> {
|
||||
let mut items = vec![c("Consolidate All Windows", "window.arrange.consolidateAllWindows"), Sep];
|
||||
items.extend(tile_items());
|
||||
items
|
||||
}
|
||||
|
||||
/// Object → Arrange (also in the canvas context menu).
|
||||
pub(super) fn arrange_items() -> Vec<Node> {
|
||||
vec![
|
||||
|
||||
@@ -790,7 +790,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"window.learn",
|
||||
"Learn",
|
||||
"",
|
||||
"{show?: bool} show (true), hide (false) or toggle (omitted or null) the Learn panel, as Window › Learn and the app bar's Explore tutorials button do; any other value is an error and changes nothing; returns whether the panel shows",
|
||||
"{show?: bool} show (true), hide (false) or toggle (omitted or null) the Learn panel, as Window › Learn does; any other value is an error and changes nothing; returns whether the panel shows",
|
||||
),
|
||||
(
|
||||
"learn.list",
|
||||
|
||||
@@ -22,8 +22,8 @@ use craft::behavior::{Axis, DockSide, IconId};
|
||||
use craft::ui::buttons::IconButton;
|
||||
use craft::ui::contract::{Bind, BodyCx, PlainData, Show as _, Tracked};
|
||||
use craft::ui::docking::{
|
||||
DockCommands, DockConfig, DockEvent, DockGrid, DockPanels, DockScene, DockSizes, DockTo, DragUnit, FloatSpace, GroupAt, HidePanels, PanelKey,
|
||||
PanelSpec, PanelSpecs, actions as command_actions, move_actions, request_actions,
|
||||
ColumnCards, DockCommands, DockConfig, DockEvent, DockGrid, DockPanels, DockScene, DockSizes, DockTo, DragUnit, FloatSpace, GroupAt, HidePanels,
|
||||
PanelKey, PanelSpec, PanelSpecs, actions as command_actions, move_actions, request_actions,
|
||||
};
|
||||
use craft::ui::menu::PanelRow;
|
||||
use craft::ui::patterns::dock::DockArea;
|
||||
@@ -31,6 +31,7 @@ use craft::ui::primitives::IconSpec;
|
||||
use craft::ui::runtime::commands::CommandRef;
|
||||
use craft::ui::runtime::frame::{ChromeToggle, request_chrome_toggle};
|
||||
use craft::ui::shell::chrome_state;
|
||||
use craft::ui::tabs::PanelTabLook;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::VectorcraftApp;
|
||||
@@ -1316,7 +1317,13 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, keeps_tools: boo
|
||||
Bind::bound(&mut workspace),
|
||||
&specs,
|
||||
&mut panels,
|
||||
DockConfig::default().panel_menu_always(true).panel_menu_icon(IconId::new("menu")).rail_cards(true),
|
||||
DockConfig::default()
|
||||
.panel_menu_always(true)
|
||||
.panel_menu_icon(IconId::new("menu"))
|
||||
.floating_rounded_body(true)
|
||||
.tab_look(PanelTabLook::Block)
|
||||
.column_cards(ColumnCards::Stepped)
|
||||
.flush_docks(true),
|
||||
)
|
||||
.hide(hide)
|
||||
.flyout(Bind::bound(&mut flyout));
|
||||
@@ -1355,7 +1362,9 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, keeps_tools: boo
|
||||
// Shift as the frame holds it: the window system sends a file drag no key events, and a second pass of the
|
||||
// frame reads the same state.
|
||||
let shift = ctx.input(|i| i.modifiers.shift);
|
||||
crate::place::os_drop(app, output.window_files, crate::place::DropSpot::Unknown, shift);
|
||||
// The panel each drop landed on is not a target here: every dropped file opens, as before.
|
||||
let files = output.window_files.into_iter().flat_map(|drop| drop.files).collect();
|
||||
crate::place::os_drop(app, files, crate::place::DropSpot::Unknown, shift);
|
||||
}
|
||||
if output.float_space.is_some() {
|
||||
app.dock_rt.space = output.float_space;
|
||||
|
||||
@@ -58,7 +58,7 @@ use std::sync::Arc;
|
||||
|
||||
use craft::behavior::{IconId, Mixed};
|
||||
use craft::color_ui::ui::{ChannelRule, HarmonyCommand};
|
||||
use craft::color_ui::ui::{PaintChip, PairWell, SwatchPair, SwatchPairOutput, SwatchPalette, Well};
|
||||
use craft::color_ui::ui::{PaintChip, PaintChipSize, PairWell, SwatchPair, SwatchPairOutput, SwatchPalette, Well};
|
||||
use craft::keymap::CommandRef;
|
||||
use craft::theme::Srgba;
|
||||
use craft::theme::variant::Tone;
|
||||
@@ -682,8 +682,8 @@ pub struct PaintPopover {
|
||||
mixer: bool,
|
||||
}
|
||||
|
||||
/// The Fill (or `stroke`) chip of the Control bar and the Properties panel: the proxy's paint, "?"
|
||||
/// when the selected objects' paints differ, the stroke as a ring. A click brings that proxy
|
||||
/// The Fill (or `stroke`) chip of the Control bar and the Properties panel: a small square of the proxy's paint, "?"
|
||||
/// when the selected objects' paints differ, the stroke as a ring, as production drew both. A click brings that proxy
|
||||
/// forward and opens a popover with the Swatches panel; Shift-click (or the popover's toggle)
|
||||
/// shows the Color panel's mixer instead.
|
||||
pub(crate) fn paint_chip(app: &mut VectorcraftApp, ui: &mut Ui, stroke: bool) {
|
||||
@@ -696,7 +696,13 @@ pub(crate) fn paint_chip(app: &mut VectorcraftApp, ui: &mut Ui, stroke: bool) {
|
||||
};
|
||||
let shown = if mixed { Mixed::Mixed } else { Mixed::Same(well_paint(&paint, &|_| None)) };
|
||||
let fallback = srgba(&paint.color().unwrap_or(Color::BLACK));
|
||||
let out = PaintChip::new(label, Bind::given(shown), fallback).popover(false).ring(stroke).popup_mark(PopupMark::Menu).tooltip(tip).show(ui);
|
||||
let out = PaintChip::new(label, Bind::given(shown), fallback)
|
||||
.chip_size(PaintChipSize::Compact)
|
||||
.popover(false)
|
||||
.ring(stroke)
|
||||
.popup_mark(PopupMark::Menu)
|
||||
.tooltip(tip)
|
||||
.show(ui);
|
||||
let chip = out.edit.response.id;
|
||||
if let Some(mods) = out.clicked {
|
||||
app.run("paint.toggleActive", json!({ "fill": !stroke })).ok();
|
||||
|
||||
@@ -1241,17 +1241,17 @@ fn show_rows(app: &mut VectorcraftApp, panel: &mut WheelUi, ui: &mut Ui, cx: &Pi
|
||||
}
|
||||
});
|
||||
if set.opacity {
|
||||
ui.add_space(4.0);
|
||||
let (color, tgt) = (cx.color, cx.tgt);
|
||||
let shown = color.unwrap_or(app.session.last_solid);
|
||||
let owner = color.map(|c| Owner::of(app, &tgt, c));
|
||||
opacity_row(app, panel, ui, &tgt, &shown, &cms);
|
||||
let owner = color.map(|c| Owner::of(app, tgt, c));
|
||||
opacity_row(app, panel, ui, tgt, &shown, cx.cms);
|
||||
// An opacity edit of a gradient stop or point changes the gradient its owner holds, and the
|
||||
// HSB picked last stays with the new gradient.
|
||||
if let (Some(c), Some(was)) = (color, owner)
|
||||
&& let Some((remembered, ..)) = &mut panel.hsb
|
||||
&& *remembered == was
|
||||
{
|
||||
*remembered = Owner::of(app, &tgt, c);
|
||||
*remembered = Owner::of(app, tgt, c);
|
||||
}
|
||||
} else {
|
||||
end_opacity_drag(app, panel);
|
||||
|
||||
@@ -27,7 +27,8 @@ use craft::ui::patterns::presets::{
|
||||
PickerField, PresetBrowser, PresetDrop, PresetEvent, PresetFns, PresetPicker, PresetReorder, PresetRow, PresetSource, PresetState, PresetView,
|
||||
};
|
||||
use craft::ui::primitives::{
|
||||
ContentPainterCx, IconSpec, PaintShape, Priority, Revision, ThumbPaint, ThumbRender, ThumbRequest, ThumbSource, ThumbnailOptions, Thumbnails,
|
||||
ContentPainterCx, FacePaint, IconSpec, PaintShape, Priority, Revision, ThumbPaint, ThumbRender, ThumbRequest, ThumbSource, ThumbnailOptions,
|
||||
Thumbnails,
|
||||
};
|
||||
use craft::ui::runtime::commands::{CommandRef, CommandState, CommandStates};
|
||||
use craft::ui::runtime::env::Env;
|
||||
@@ -686,16 +687,20 @@ fn footer_drop(app: &mut VectorcraftApp, index: usize, grabbed: &str, alt: bool)
|
||||
}
|
||||
}
|
||||
|
||||
/// The Control bar's Style picker: the styles in a popover, the field showing the style the selection is
|
||||
/// linked to (blank when it is not); picking one applies it to the selection, with Alt on top of its look.
|
||||
/// The Control bar's Style picker: the styles in a popover, the field a swatch of the style the selection is
|
||||
/// linked to (white when it is not, [`linked_face`]); picking one applies it to the selection, with Alt on top of its
|
||||
/// look.
|
||||
pub(crate) fn style_picker(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let Some(doc) = app.session.active().map(|d| d.doc.clone()) else { return };
|
||||
let mut panel = std::mem::take(&mut app.ui.graphic_styles_panel);
|
||||
let looks = look_hashes(&mut panel, app);
|
||||
let mut linked: Option<StyleKey> = app.session.selection_graphic_style().filter(|(_, linked)| *linked).map(|(g, _)| g.name.clone());
|
||||
let source = style_source(style_thumbs(app, &doc, &looks, panel.preview));
|
||||
let thumbs = style_thumbs(app, &doc, &looks, panel.preview);
|
||||
let face = linked_face(thumbs, &doc, &looks, linked.as_deref());
|
||||
let source = style_source(thumbs);
|
||||
let out = PresetPicker::new(tl!("Graphic Styles").to_string(), Bind::bound(&mut linked), &source, Bind::bound(&mut panel.picker_state))
|
||||
.field(PickerField::Thumbnail)
|
||||
.face_thumb(face)
|
||||
.show(ui);
|
||||
app.ui.graphic_styles_panel = panel;
|
||||
if let Some(name) = out.picked {
|
||||
@@ -703,6 +708,21 @@ pub(crate) fn style_picker(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Style picker's field: the thumbnail of the style `linked` from the panel's thumbnails (`thumbs`, over the
|
||||
/// shared `doc` and `looks`), white while the selection is linked to no style, as production's Style chip showed it.
|
||||
fn linked_face(thumbs: StyleThumbs<'_>, doc: &Arc<Document>, looks: &Arc<Vec<u64>>, linked: Option<&str>) -> FacePaint {
|
||||
use std::hash::{Hash, Hasher};
|
||||
let StyleThumbs { uid, revision, look, .. } = thumbs;
|
||||
let linked = linked.unwrap_or_default().to_owned();
|
||||
let mut hasher = std::collections::hash_map::DefaultHasher::new();
|
||||
(uid, revision, &linked, look.preview, look.override_chars).hash(&mut hasher);
|
||||
let (doc, looks) = (Arc::clone(doc), Arc::clone(looks));
|
||||
FacePaint::new(hasher.finish(), move |cx, rect| {
|
||||
let thumbs = StyleThumbs { uid, revision, d: &doc, looks: &looks, look };
|
||||
paint_thumb(cx, rect, &thumbnails(cx.painter.ctx(), "vc-style-thumbs"), &thumbs, &linked);
|
||||
})
|
||||
}
|
||||
|
||||
/// A new style from the selection, first asking for its name (`ask`) in Graphic Style Options.
|
||||
fn new_style(app: &mut VectorcraftApp, ask: bool) {
|
||||
if ask {
|
||||
|
||||
@@ -24,7 +24,7 @@ use egui::{Color32, CornerRadius, Pos2, Rect, Response, Vec2, vec2};
|
||||
|
||||
use super::model::{DocLayers, RowId};
|
||||
use super::rows::{TARGET_RADIUS, has_styled_target, shows_targeted, target_marks};
|
||||
use super::{NodeId, Value, json};
|
||||
use super::{Node, NodeId, Value, json};
|
||||
use crate::panel_drag::PanelDrag;
|
||||
|
||||
/// The side of the square of a row whose art is selected.
|
||||
@@ -193,8 +193,9 @@ impl Component for TargetCircle {
|
||||
}
|
||||
}
|
||||
|
||||
/// A row's selection square: filled in its layer's colour while the row's art is selected, a small
|
||||
/// square while the row holds selected art. Without `id` it is only a mark (a ruler guide's row, a
|
||||
/// A row's selection square: filled in its layer's colour while the row's art is selected (for a
|
||||
/// layer or sublayer, all of its visible, unlocked art), a small square while the row holds
|
||||
/// selected art. Without `id` it is only a mark (a ruler guide's row, a
|
||||
/// spine's row) and takes no press.
|
||||
#[derive(Component, Props)]
|
||||
#[component(sample = SelectionSquare::sample)]
|
||||
@@ -346,6 +347,19 @@ impl Component for Cells {
|
||||
}
|
||||
}
|
||||
|
||||
/// The marks of node row `n`'s selection square in the panel over `tree`: whether it shows the
|
||||
/// full-sized square (the row is selected, or it is a layer or sublayer whose visible, unlocked art
|
||||
/// is all selected), and whether it shows the small one (it holds selected art otherwise).
|
||||
pub(super) fn square_marks(tree: &DocLayers<'_>, n: &Node) -> (bool, bool) {
|
||||
let full = tree.is_selected(n.id) || tree.is_full(n.id);
|
||||
let holds = !full && {
|
||||
let mut any = false;
|
||||
n.walk(&mut |c| any |= c.id != n.id && tree.is_selected(c.id));
|
||||
any
|
||||
};
|
||||
(full, holds)
|
||||
}
|
||||
|
||||
/// The cells of row `row` (shown as `info`) of the panel over `tree`.
|
||||
pub(super) fn build(tree: &DocLayers<'_>, row: &RowId, info: &LayerInfo) -> Cells {
|
||||
let st = tree.state();
|
||||
@@ -355,15 +369,11 @@ pub(super) fn build(tree: &DocLayers<'_>, row: &RowId, info: &LayerInfo) -> Cell
|
||||
RowId::Node(id) => {
|
||||
let Some(n) = tree.doc().node(id) else { return Cells::new(None, SelectionSquare::new(None, false, false, color, vec![])) };
|
||||
let is_sel = selected(id);
|
||||
let holds = !is_sel && {
|
||||
let mut any = false;
|
||||
n.walk(&mut |c| any |= c.id != id && selected(c.id));
|
||||
any
|
||||
};
|
||||
let art = if is_sel || holds { st.selection.objects.clone() } else { vec![] };
|
||||
let (full, holds) = square_marks(tree, n);
|
||||
let art = if full || holds { st.selection.objects.clone() } else { vec![] };
|
||||
let circle = TargetCircle::new(id, shows_targeted(tree, n, is_sel), has_styled_target(n))
|
||||
.label(crate::i18n::fmt(tl!("Target {row}"), &[("row", info.name.as_str())]));
|
||||
let square = SelectionSquare::new(Some(id), is_sel, holds, color, art)
|
||||
let square = SelectionSquare::new(Some(id), full, holds, color, art)
|
||||
.label(crate::i18n::fmt(tl!("Select art of {row}"), &[("row", info.name.as_str())]));
|
||||
Cells::new(Some(circle), square)
|
||||
}
|
||||
|
||||
@@ -182,6 +182,10 @@ pub(super) struct LayerRows {
|
||||
/// The selected objects.
|
||||
#[plain_data(assume = "node ids are integers")]
|
||||
selected: HashSet<NodeId>,
|
||||
/// The layers and sublayers whose visible, unlocked art ([`Node::layer_art`]) is all selected
|
||||
/// and not empty.
|
||||
#[plain_data(assume = "node ids are integers")]
|
||||
full: HashSet<NodeId>,
|
||||
/// The selected blends, in selection order.
|
||||
#[plain_data(assume = "node ids are integers")]
|
||||
blends: Vec<NodeId>,
|
||||
@@ -228,6 +232,7 @@ impl LayerRows {
|
||||
let ruler = doc.ruler_guides();
|
||||
let guide_rows = ruler.iter().enumerate().filter_map(|(i, g)| Some((g.id?, i))).collect();
|
||||
let blends = st.selection.objects.iter().copied().filter(|id| doc.node(*id).is_some_and(|n| matches!(n.kind, NodeKind::Blend { .. })));
|
||||
let selected: HashSet<NodeId> = st.selection.objects.iter().copied().collect();
|
||||
Self {
|
||||
doc: doc.clone(),
|
||||
opts: app.ui.layers_panel.clone(),
|
||||
@@ -239,7 +244,8 @@ impl LayerRows {
|
||||
guides: vectorcraft_engine::cmd::guide_indexes(doc, &st.selection.guides),
|
||||
ruler,
|
||||
guide_rows,
|
||||
selected: st.selection.objects.iter().copied().collect(),
|
||||
full: super::rows::full_layers(doc, &selected),
|
||||
selected,
|
||||
blends: blends.collect(),
|
||||
root: st.isolation.and_then(|i| isolated_root(doc, i)).map(|(n, ..)| n.id),
|
||||
}
|
||||
@@ -291,6 +297,12 @@ impl LayerRows {
|
||||
self.selected.contains(&id)
|
||||
}
|
||||
|
||||
/// Whether `id` is a layer or sublayer whose visible, unlocked art is all selected and not
|
||||
/// empty.
|
||||
pub(super) fn is_full(&self, id: NodeId) -> bool {
|
||||
self.full.contains(&id)
|
||||
}
|
||||
|
||||
/// The node ids a row menu's command acts on: every highlighted row when the menu's row is one of
|
||||
/// them, else the row's own node.
|
||||
pub(super) fn targets(&self, target: &MenuTarget<RowId>) -> Vec<u64> {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use craft::behavior::{EditEvent, SelectionChange};
|
||||
use craft::keymap::{CommandRef, Mods};
|
||||
use craft::layers::ui::panel::{ActivateOn, LayerColumn, LayerDrop, LayerMove, LayerPosition, LayerSelect, LayerToggle, LayersEvent};
|
||||
@@ -110,17 +112,44 @@ pub(super) fn locate_layer_listed(doc: &Document, root: Option<NodeId>) -> bool
|
||||
pub(super) fn shows_targeted(tree: &DocLayers<'_>, n: &Node, is_sel: bool) -> bool {
|
||||
match tree.state().selection.target {
|
||||
Some(id) => id == n.id,
|
||||
None if n.is_layer() => {
|
||||
if tree.state().selection.objects.is_empty() {
|
||||
return false;
|
||||
}
|
||||
let art = n.layer_art(true);
|
||||
!art.is_empty() && art.iter().all(|id| tree.is_selected(*id))
|
||||
}
|
||||
None if n.is_layer() => tree.is_full(n.id),
|
||||
None => is_sel,
|
||||
}
|
||||
}
|
||||
|
||||
/// The layers and sublayers of `doc` whose [`Node::layer_art`] with `editable` is not empty and
|
||||
/// all in `sel`, found in one pass over the layers and their direct children.
|
||||
pub(super) fn full_layers(doc: &Document, sel: &HashSet<NodeId>) -> HashSet<NodeId> {
|
||||
/// Adds `layer` to `out` when it is full, and returns its art's count and selected count.
|
||||
fn visit(layer: &Node, sel: &HashSet<NodeId>, out: &mut HashSet<NodeId>) -> (usize, usize) {
|
||||
let (mut art, mut selected) = (0, 0);
|
||||
for c in layer.children().into_iter().flatten() {
|
||||
let counts = !(c.is_ruler_guide() || !c.visible || c.locked || c.is_template());
|
||||
if c.is_layer() {
|
||||
let (a, s) = visit(c, sel, out);
|
||||
if counts {
|
||||
art += a;
|
||||
selected += s;
|
||||
}
|
||||
} else if counts {
|
||||
art += 1;
|
||||
selected += usize::from(sel.contains(&c.id));
|
||||
}
|
||||
}
|
||||
if art > 0 && selected == art {
|
||||
out.insert(layer.id);
|
||||
}
|
||||
(art, selected)
|
||||
}
|
||||
let mut out = HashSet::new();
|
||||
if !sel.is_empty() {
|
||||
for layer in doc.layers.iter().filter(|l| l.is_layer()) {
|
||||
visit(layer, sel, &mut out);
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// The `layer.target` of a click with `mods` on the target circle of `id`, by the rules of a row click (#8639): plain
|
||||
/// targets it, Ctrl/Cmd adds it to the selection or takes it out, Shift selects the art of every row `filter` lists
|
||||
/// from `anchor` (the last circle clicked, else the targeted row) to it, and Shift+Ctrl/Cmd adds that art. With it,
|
||||
|
||||
@@ -561,3 +561,98 @@ fn the_target_circle_anchor_does_not_carry_over_to_another_document() {
|
||||
panel.click_with("Target B", egui::Modifiers::SHIFT);
|
||||
assert_eq!(targeted(&panel.app()), (Some(b2), vec![b2]));
|
||||
}
|
||||
|
||||
/// The rows among `rows` whose selection square is full-sized, then those whose square is the
|
||||
/// small one, in the order given.
|
||||
fn squares(app: &VectorcraftApp, rows: &[NodeId]) -> (Vec<NodeId>, Vec<NodeId>) {
|
||||
let st = app.session.active().unwrap();
|
||||
let tree = DocLayers::new(app, st);
|
||||
let (mut full, mut small) = (vec![], vec![]);
|
||||
for &id in rows {
|
||||
match cells::square_marks(&tree, st.doc.node(id).unwrap()) {
|
||||
(true, _) => full.push(id),
|
||||
(false, true) => small.push(id),
|
||||
(false, false) => {}
|
||||
}
|
||||
}
|
||||
(full, small)
|
||||
}
|
||||
|
||||
/// A layer or sublayer whose selectable art is all selected shows the full-sized square; one
|
||||
/// holding some of its art, or a group's member instead of the group, shows the small one.
|
||||
#[test]
|
||||
fn a_layer_with_all_its_art_selected_shows_the_full_square() {
|
||||
use crate::tests::panel_harness::Panel;
|
||||
use egui::Modifiers;
|
||||
let (mut app, [layer, sub, g, b, a, c]) = nested();
|
||||
let rows = [layer, sub, g, b, a, c];
|
||||
name_row(&mut app, layer, "Top");
|
||||
name_row(&mut app, sub, "Sub");
|
||||
name_row(&mut app, a, "A");
|
||||
app.session.execute("select.set", &json!({"ids": [a.0]})).unwrap();
|
||||
assert_eq!(squares(&app, &rows), (vec![a], vec![layer, sub]), "the rectangle's square, small ones on the sublayer and the layer");
|
||||
app.session.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
|
||||
assert_eq!(squares(&app, &rows), (vec![b, a], vec![layer, sub, g]), "a group's member is not the group: the sublayer's square stays small");
|
||||
let mut panel = Panel::new(app, show);
|
||||
panel.click_with("Select art of Sub", Modifiers::NONE);
|
||||
assert_eq!(squares(&panel.app(), &rows), (vec![sub, g, a], vec![layer]), "the sublayer, its group and rectangle full, the layer small");
|
||||
panel.click_with("Select art of Top", Modifiers::NONE);
|
||||
assert_eq!(squares(&panel.app(), &rows), (vec![layer, sub, g, a, c], vec![]), "the layer and the sublayer full, with each row's art");
|
||||
panel.click_with("Select art of A", Modifiers::SHIFT);
|
||||
assert_eq!(squares(&panel.app(), &rows), (vec![g, c], vec![layer, sub]), "one rectangle let go: the layer and the sublayer small again");
|
||||
// Locked art cannot be selected, so it does not keep the layer's square small.
|
||||
panel.app().session.execute("layer.setProps", &json!({"ids": [c.0], "locked": true})).unwrap();
|
||||
panel.click_with("Select art of Sub", Modifiers::NONE);
|
||||
assert_eq!(squares(&panel.app(), &rows), (vec![layer, sub, g, a], vec![]), "the layer, the sublayer, the group and the rectangle");
|
||||
// Hidden art neither.
|
||||
panel.app().session.execute("layer.setProps", &json!({"ids": [c.0], "locked": false, "visible": false})).unwrap();
|
||||
panel.app().session.execute("select.set", &json!({"ids": [a.0, g.0]})).unwrap();
|
||||
assert_eq!(squares(&panel.app(), &rows), (vec![layer, sub, g, a], vec![]), "hidden art is left out");
|
||||
// With nothing targeted, the full layers' target circles show as targeted too.
|
||||
let app = panel.app();
|
||||
let st = app.session.active().unwrap();
|
||||
let tree = DocLayers::new(&app, st);
|
||||
assert!(rows::shows_targeted(&tree, st.doc.node(layer).unwrap(), false), "the layer shows as targeted");
|
||||
}
|
||||
|
||||
/// A layer with no selectable art shows no square, whatever else is selected.
|
||||
#[test]
|
||||
fn a_layer_without_art_shows_no_square() {
|
||||
let (mut app, [layer, sub, g, b, a, c]) = nested();
|
||||
let empty = NodeId(app.session.execute("layer.new", &json!({})).unwrap()["id"].as_u64().unwrap());
|
||||
app.session.execute("select.set", &json!({"ids": [c.0, a.0, g.0]})).unwrap();
|
||||
let rows = [empty, layer, sub, g, b, a, c];
|
||||
assert_eq!(squares(&app, &rows), (vec![layer, sub, g, a, c], vec![]), "the first layer's rows; the new, empty layer's none");
|
||||
}
|
||||
|
||||
/// The panel's set of full layers is the layers and sublayers whose `layer_art(true)` is not empty
|
||||
/// and all selected, for every selection of the document's objects, hidden and locked ones included.
|
||||
#[test]
|
||||
fn full_layers_are_the_layers_with_all_their_art_selected() {
|
||||
let (mut app, [_, _, _, _, _, c]) = nested();
|
||||
let run = |app: &mut VectorcraftApp, id: &str, p: serde_json::Value| app.session.execute(id, &p).unwrap();
|
||||
let id = |v: serde_json::Value| NodeId(v["id"].as_u64().unwrap());
|
||||
let hidden = id(run(&mut app, "layer.newSublayer", json!({"name": "Hidden"})));
|
||||
run(&mut app, "shape.rectangle", json!({"x": 200, "y": 0, "width": 20, "height": 20}));
|
||||
run(&mut app, "layer.setProps", json!({"ids": [hidden.0], "visible": false}));
|
||||
run(&mut app, "layer.setProps", json!({"ids": [c.0], "locked": true}));
|
||||
run(&mut app, "layer.new", json!({}));
|
||||
let doc = app.session.active().unwrap().doc.clone();
|
||||
let (mut layers, mut objects) = (vec![], vec![]);
|
||||
for l in &doc.layers {
|
||||
l.walk(&mut |n| if n.is_layer() { layers.push(n) } else { objects.push(n.id) });
|
||||
}
|
||||
assert_eq!((layers.len(), objects.len()), (4, 5), "the layers, the sublayers and the objects");
|
||||
for bits in 0u32..(1 << objects.len()) {
|
||||
let sel: HashSet<NodeId> = objects.iter().enumerate().filter(|(i, _)| (bits >> i) & 1 == 1).map(|(_, id)| *id).collect();
|
||||
let want: HashSet<NodeId> = layers
|
||||
.iter()
|
||||
.filter(|l| {
|
||||
let art = l.layer_art(true);
|
||||
!art.is_empty() && art.iter().all(|i| sel.contains(i))
|
||||
})
|
||||
.map(|l| l.id)
|
||||
.collect();
|
||||
assert_eq!(rows::full_layers(&doc, &sel), want, "selection {bits:b}");
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Learn panel (Window › Learn, and Explore tutorials at the right end of the app bar): short
|
||||
//! Learn panel (Window › Learn): short
|
||||
//! hands-on tutorials grouped by skill ([`catalog::SKILLS`]). The For you tab holds the Get started
|
||||
//! section with the Quick skill guide card, which opens the Skills tab. The Skills tab lists each
|
||||
//! skill with a progress ring that fills as its tutorials are finished and the count of tutorials
|
||||
@@ -381,8 +381,8 @@ pub(crate) fn visible(app: &VectorcraftApp) -> bool {
|
||||
crate::panel_docking::panels_shown(app) && crate::panel_docking::showing(&app.ui, ID)
|
||||
}
|
||||
|
||||
/// `window.learn {show?}`: show the panel (true), hide it (false) or toggle it (omitted), as the
|
||||
/// app bar's Explore tutorials button and Window › Learn do → whether it shows ([`visible`]).
|
||||
/// `window.learn {show?}`: show the panel (true), hide it (false) or toggle it (omitted), as
|
||||
/// Window › Learn does → whether it shows ([`visible`]).
|
||||
/// Showing it also shows a hidden dock; in a full screen mode it makes the panel the front one.
|
||||
fn toggle(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
|
||||
let shown = visible(app);
|
||||
|
||||
@@ -102,18 +102,6 @@ fn the_catalog_is_valid() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Explore tutorials at the right end of the app bar shows the Learn panel, and hides it again.
|
||||
#[test]
|
||||
fn explore_tutorials_on_the_app_bar_shows_and_hides_the_learn_panel() {
|
||||
let mut app = app();
|
||||
let ctx = app.ui_ctx.clone().expect("a window");
|
||||
assert!(!shown(&app));
|
||||
click_with(&mut app, "Explore tutorials", |app, events| shell_frame(app, &ctx, events));
|
||||
assert!(shown(&app), "{}", app.ui.status);
|
||||
click_with(&mut app, "Explore tutorials", |app, events| shell_frame(app, &ctx, events));
|
||||
assert!(!shown(&app));
|
||||
}
|
||||
|
||||
/// The command and params of Window › Learn.
|
||||
fn window_learn(app: &VectorcraftApp) -> (String, serde_json::Value) {
|
||||
let entry = crate::menus::menu_entries(app).into_iter().find(|e| e.path == ["Window"] && e.label == "Learn").expect("Window › Learn");
|
||||
@@ -138,8 +126,8 @@ fn window_learn_shows_and_hides_the_panel() {
|
||||
assert!(!shown(&app));
|
||||
}
|
||||
|
||||
/// With the dock hidden, Learn as the front panel is not visible: `window.learn`, Window › Learn
|
||||
/// and Explore tutorials show the dock instead of closing the panel.
|
||||
/// With the dock hidden, Learn as the front panel is not visible: `window.learn` and Window › Learn
|
||||
/// show the dock instead of closing the panel.
|
||||
#[test]
|
||||
fn window_learn_shows_a_hidden_dock() {
|
||||
let mut app = app();
|
||||
|
||||
@@ -5,7 +5,7 @@ use craft::behavior::IconId;
|
||||
use craft::keymap::CommandRef;
|
||||
use craft::ui::buttons::{Button, IconButton};
|
||||
use craft::ui::choice::Checkbox;
|
||||
use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _, Sizing, Trigger, clicked};
|
||||
use craft::ui::contract::{Bind, LabelScheme, Props as _, Show as _, ShowContainer as _, Sizing, Trigger, clicked};
|
||||
use craft::ui::display::{Elide, Shade, Text};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::layout_components::Row;
|
||||
@@ -41,7 +41,7 @@ fn panel_button<'a>(icon: &'static str, panel: &str, label: &'static str) -> Ico
|
||||
|
||||
/// The Opacity field, and the icon that shows the Transparency panel.
|
||||
fn opacity_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node) {
|
||||
Row::new().show(ui, |ui, _| {
|
||||
Row::new().labels(LabelScheme::Inspector).show(ui, |ui, _| {
|
||||
let shown = Some(n.opacity as f64 * 100.0);
|
||||
let out = Field::new(tl!("Opacity"))
|
||||
.sizing(Sizing::Content)
|
||||
@@ -118,7 +118,7 @@ pub(super) fn fill_stroke_rows(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
panels::paint_chip(app, ui, false);
|
||||
Text::new(tl!("Fill")).show(ui);
|
||||
});
|
||||
Row::new().show(ui, |ui, _| {
|
||||
Row::new().labels(LabelScheme::Inspector).show(ui, |ui, _| {
|
||||
panels::paint_chip(app, ui, true);
|
||||
stroke::link_field(app, ui, tl!("Stroke"), weight);
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn transform_section(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
groups.size = true;
|
||||
transform::object_fields(app, ui, groups);
|
||||
Row::new().show(ui, |ui, _| {
|
||||
transform::rotate_field(app, ui);
|
||||
transform::rotate_field(app, ui, &[]);
|
||||
// The icons are named for their mirror line: `flip-vertical-2` draws a vertical line, the
|
||||
// left-right flip, which the Properties panel calls Flip Along Horizontal Axis (#1910).
|
||||
IconButton::command(IconId::new("flip-vertical-2"), "ui.transform.flipHorizontal").label(tl!("Flip Along Horizontal Axis")).show(ui);
|
||||
|
||||
@@ -349,7 +349,7 @@ pub(crate) fn apply_weight(app: &mut VectorcraftApp, out: &NumberOutput, target:
|
||||
/// The weight field in a row labelled `label` with the side label `side`: the output of the number field, none when
|
||||
/// the row's body did not run.
|
||||
fn weight_row(app: &VectorcraftApp, ui: &mut Ui, label: &'static str, side: SideLabel, weight: Option<f64>) -> Option<NumberOutput> {
|
||||
Field::new(label).side(side).id_salt("weight").show(ui, |ui, _| weight_number(app, weight).show(ui)).inner
|
||||
Field::new(label).side(side).id_salt("weight").sizing(Sizing::Content).show(ui, |ui, _| weight_number(app, weight).show(ui)).inner
|
||||
}
|
||||
|
||||
/// The weight field whose link side label (`label`: the Control bar's "Stroke:", the Properties panel's "Stroke")
|
||||
|
||||
@@ -112,16 +112,17 @@ pub(super) enum FooterTarget {
|
||||
/// the button does. Other drags are left to their own targets.
|
||||
pub(super) fn on_footer_drop(app: &mut VectorcraftApp, target: FooterTarget, drag: &PanelDrag) {
|
||||
let PanelDrag::Paint { rows: Some(r), .. } = drag else { return };
|
||||
let rows = footer_rows(app, r);
|
||||
match target {
|
||||
FooterTarget::Delete => {
|
||||
let names = super::actions::deletable(app, &r.names);
|
||||
let names = super::actions::deletable(app, &rows);
|
||||
if !names.is_empty() {
|
||||
super::actions::delete(app, names, false);
|
||||
}
|
||||
}
|
||||
FooterTarget::New => {
|
||||
let Some(st) = app.session.active() else { return };
|
||||
let names: Vec<String> = r.names.iter().filter(|n| st.doc.swatch(n).is_some_and(|w| !w.is_reserved())).cloned().collect();
|
||||
let names: Vec<String> = rows.iter().filter(|n| st.doc.swatch(n).is_some_and(|w| !w.is_reserved())).cloned().collect();
|
||||
if !names.is_empty() {
|
||||
super::actions::duplicate(app, &names);
|
||||
}
|
||||
@@ -129,6 +130,22 @@ pub(super) fn on_footer_drop(app: &mut VectorcraftApp, target: FooterTarget, dra
|
||||
}
|
||||
}
|
||||
|
||||
/// The rows a drop on a footer button takes. A grabbed row that is part of the panel's selection
|
||||
/// carries every selected row of its kind (swatches or color groups), also those that the find
|
||||
/// field or the kind filter hides, in panel order, as a click on the button takes the whole
|
||||
/// selection. Any other grabbed row carries the rows `r` holds.
|
||||
fn footer_rows(app: &VectorcraftApp, r: &SwatchRows) -> Vec<String> {
|
||||
let sel = super::selected(app);
|
||||
if !sel.contains(&r.grabbed) {
|
||||
return r.names.clone();
|
||||
}
|
||||
super::shown_keys(&super::groups(app, super::Kind::All, ""))
|
||||
.iter()
|
||||
.filter(|k| matches!(k, SwatchKey::Group(_)) == r.groups && sel.iter().any(|s| s == name_of(k)))
|
||||
.map(|k| name_of(k).to_string())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The colour group `name` is, or the one swatch `name` belongs to.
|
||||
pub(super) fn group_of(d: &Document, name: &str) -> Option<String> {
|
||||
if d.swatch_groups.iter().any(|g| g.name == name) {
|
||||
|
||||
@@ -551,6 +551,44 @@ fn drops_on_the_buttons_and_the_panel_run_their_commands() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A selected swatch dragged onto New Swatch or Delete Swatch carries the selected swatches that
|
||||
/// the find field hides, which the browser leaves out of the drag, as a click on Delete Swatch
|
||||
/// takes them too. The copies are selected in panel order. A grabbed swatch outside the selection
|
||||
/// carries only itself.
|
||||
#[test]
|
||||
fn footer_drops_carry_selected_swatches_that_find_hides() {
|
||||
let mut app = app();
|
||||
let key = crate::dialogs::confirm::KIND;
|
||||
app.ui.swatches_panel.show_find = true;
|
||||
app.ui.swatches_panel.state.browser.filter = "Orange".into();
|
||||
let order = names_of(&app, None);
|
||||
let at = |n: &str| order.iter().position(|x| x == n).unwrap_or_else(|| panic!("no swatch {n}"));
|
||||
let mut copies = vec![("Lime", "Lime copy"), ("Orange", "Orange copy")];
|
||||
copies.sort_by_key(|(n, _)| at(n));
|
||||
let copies: Vec<String> = copies.into_iter().map(|(_, c)| c.to_string()).collect();
|
||||
// With Find set to Orange, the browser's drag holds only the selected row it shows.
|
||||
let drag = rows_drag(&app, "Orange", &["Orange"]);
|
||||
select_rows(&mut app, &["Lime", "Orange"]);
|
||||
let undo = undo_steps(&app);
|
||||
dnd::on_footer_drop(&mut app, dnd::FooterTarget::New, &drag);
|
||||
let d = doc(&app);
|
||||
assert!(d.swatch("Orange copy").is_some() && d.swatch("Lime copy").is_some(), "the hidden selected swatch is duplicated too");
|
||||
assert_eq!(selected(&app), copies, "both copies are selected, in panel order");
|
||||
assert_eq!(undo_steps(&app), undo + 1, "one undo step for both");
|
||||
select_rows(&mut app, &["Lime", "Orange"]);
|
||||
dnd::on_footer_drop(&mut app, dnd::FooterTarget::Delete, &drag);
|
||||
assert!(dialog_open(&app, key), "Delete asks first");
|
||||
confirm(&mut app, key);
|
||||
let d = doc(&app);
|
||||
assert!(d.swatch("Orange").is_none() && d.swatch("Lime").is_none(), "the hidden selected swatch is deleted too");
|
||||
// A grabbed swatch outside the selection carries only itself.
|
||||
let drag = rows_drag(&app, "Orange copy", &["Orange copy"]);
|
||||
select_rows(&mut app, &["Lime copy"]);
|
||||
dnd::on_footer_drop(&mut app, dnd::FooterTarget::New, &drag);
|
||||
let d = doc(&app);
|
||||
assert!(d.swatch("Orange copy copy").is_some() && d.swatch("Lime copy copy").is_none(), "only the grabbed swatch is duplicated");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn art_dropped_on_the_panel_becomes_a_pattern_swatch() {
|
||||
let mut app = app();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Tabs panel: tab-stop alignment, X position (Y in vertical type), leader and "align on", and the
|
||||
//! Tabs panel: tab-stop alignment, X position (Y in vertical type; a position typed there for a
|
||||
//! paragraph with no stops adds a stop at it), leader and "align on", and the
|
||||
//! framework's text ruler numbered in the General unit, on which a click adds a stop, dragging moves
|
||||
//! one and dragging it off the ruler deletes it. Ctrl-dragging a stop (Command on macOS) moves all the
|
||||
//! stops by the same distance. A stop lands on the ruler's step, or free with Alt held. While a stop is
|
||||
@@ -677,8 +678,10 @@ pub(crate) fn apply_ruler_edit(app: &mut VectorcraftApp, node: &Node, para: &Par
|
||||
}
|
||||
|
||||
/// The X (Y in vertical type) field's `value`: a picked marker moves to it, else the picked stop
|
||||
/// does and stays picked after the stops are sorted. A position past [`MAX_STOP`] is refused by
|
||||
/// `text.tabs.set` and nothing changes. `picked`: the stop and the marker of [`TabsPanel`].
|
||||
/// does and stays picked after the stops are sorted. A paragraph with no stops and no picked marker
|
||||
/// gets a stop there with the panel's alignment, which is then picked, as a click on the ruler adds
|
||||
/// one. A position past [`MAX_STOP`] is refused by `text.tabs.set` and nothing changes. `picked`:
|
||||
/// the stop and the marker of [`TabsPanel`].
|
||||
pub(crate) fn set_position(app: &mut VectorcraftApp, node: &Node, para: &ParaStyle, span: f64, picked: (usize, Option<RulerItem>), value: f64) {
|
||||
let (stop, marker) = picked;
|
||||
match marker {
|
||||
@@ -692,6 +695,13 @@ pub(crate) fn set_position(app: &mut VectorcraftApp, node: &Node, para: &ParaSty
|
||||
set_marker(app, marker, value, para, span, &targets, false);
|
||||
}
|
||||
}
|
||||
None if para.tabs.is_empty() => {
|
||||
let align = app.ui.tabs_panel.align;
|
||||
let added = TabStop { position: value.max(0.0), align, leader: String::new(), align_on: '.' };
|
||||
if apply(app, std::slice::from_ref(&added)) {
|
||||
app.ui.tabs_panel.stop = 0;
|
||||
}
|
||||
}
|
||||
None => {
|
||||
let mut stops = para.tabs.clone();
|
||||
if let Some(i) = apply_moved(app, &mut stops, stop, value.max(0.0)) {
|
||||
|
||||
@@ -759,6 +759,80 @@ fn an_x_typed_past_the_next_stop_keeps_the_stop_selected() {
|
||||
assert_eq!(app.ui.tabs_panel.stop, 0);
|
||||
}
|
||||
|
||||
/// The undo steps of the active document.
|
||||
fn undo_steps(app: &VectorcraftApp) -> usize {
|
||||
app.session.active().unwrap().history.undo.len()
|
||||
}
|
||||
|
||||
/// A position typed in the X field of a paragraph with no stops adds a stop there with the chosen
|
||||
/// alignment, keeps its hundredths of a point, picks it, and is one undo step.
|
||||
#[test]
|
||||
fn typing_x_into_a_paragraph_without_stops_adds_and_selects_a_stop() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
app.run("text.create", json!({"x": 10, "y": 20, "text": "a\tb", "area": {"width": 300, "height": 100}})).unwrap();
|
||||
assert!(current(&app).unwrap().1.is_empty());
|
||||
app.ui.tabs_panel.align = TabAlign::Right;
|
||||
app.ui.tabs_panel.stop = 3;
|
||||
let before = undo_steps(&app);
|
||||
type_position(&mut app, 36.47);
|
||||
let stops = current(&app).unwrap().1;
|
||||
assert_eq!(stops.iter().map(|s| (s.position, s.align)).collect::<Vec<_>>(), [(36.47, TabAlign::Right)]);
|
||||
assert_eq!(app.ui.tabs_panel.stop, 0);
|
||||
assert_eq!(undo_steps(&app), before + 1);
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
assert!(current(&app).unwrap().1.is_empty());
|
||||
}
|
||||
|
||||
/// In vertical type the position field is Y, and a position typed there for a paragraph with no
|
||||
/// stops adds a stop.
|
||||
#[test]
|
||||
fn typing_y_into_vertical_type_without_stops_adds_a_stop() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
app.run("text.create", json!({"x": 10, "y": 20, "text": "a\tb", "vertical": true})).unwrap();
|
||||
type_position(&mut app, 48.0);
|
||||
let stops = current(&app).unwrap().1;
|
||||
assert_eq!(stops.iter().map(|s| (s.position, s.align)).collect::<Vec<_>>(), [(48.0, TabAlign::Left)]);
|
||||
}
|
||||
|
||||
/// A first stop past 100,000 pt adds no stop and records no undo step. A negative position adds
|
||||
/// the stop at 0 pt.
|
||||
#[test]
|
||||
fn a_refused_first_stop_adds_nothing_and_records_no_undo() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
app.run("text.create", json!({"x": 10, "y": 20, "text": "a\tb", "area": {"width": 300, "height": 100}})).unwrap();
|
||||
let before = undo_steps(&app);
|
||||
type_position(&mut app, 200000.0);
|
||||
assert!(current(&app).unwrap().1.is_empty());
|
||||
assert_eq!(undo_steps(&app), before);
|
||||
type_position(&mut app, -5.0);
|
||||
assert_eq!(stop_positions(&app), [0.0]);
|
||||
assert_eq!(undo_steps(&app), before + 1);
|
||||
}
|
||||
|
||||
/// With the Selection tool on two texts, a first stop typed for the shown text, which has no
|
||||
/// stops, becomes every selected text's stops in one undo step, replacing the other text's stop.
|
||||
#[test]
|
||||
fn typing_the_first_stop_over_mixed_paragraphs_uses_the_displayed_list() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
let id = |v: serde_json::Value| v["id"].as_u64().unwrap();
|
||||
let a = id(app.run("text.create", json!({"x": 10, "y": 20, "text": "a\tb", "area": {"width": 300, "height": 60}})).unwrap());
|
||||
let b = id(app.run("text.create", json!({"x": 10, "y": 100, "text": "c\td", "area": {"width": 250, "height": 60}})).unwrap());
|
||||
app.run("select.set", json!({"ids": [b]})).unwrap();
|
||||
app.run("text.tabs.set", json!({"stops": [{"position": 90}]})).unwrap();
|
||||
app.run("select.set", json!({"ids": [a, b]})).unwrap();
|
||||
assert_eq!(current(&app).unwrap().0.id.0, a);
|
||||
let before = undo_steps(&app);
|
||||
type_position(&mut app, 25.0);
|
||||
for text in [a, b] {
|
||||
assert_eq!(text_of(&app, text).para_at(0).tabs.iter().map(|s| s.position).collect::<Vec<_>>(), [25.0], "text {text}");
|
||||
}
|
||||
assert_eq!(undo_steps(&app), before + 1);
|
||||
}
|
||||
|
||||
/// The panel menu's Repeat Tab, Delete Tab and Clear All Tabs can be chosen while the text has
|
||||
/// tab stops and show no check mark. Repeat Tab and Delete Tab act on the stop selected on the
|
||||
/// ruler, and Clear All Tabs removes every stop.
|
||||
|
||||
@@ -436,24 +436,23 @@ fn angle_field(
|
||||
.side(SideLabel::new().kind(LabelKind::Glyph(GlyphLabel::icon(IconId::new(icon)))).tooltip(label).scrub(true))
|
||||
.enabled(enabled)
|
||||
.show(ui, |ui, _| {
|
||||
NumberField::new(label, Bind::given(Some(shown)))
|
||||
.unit("°")
|
||||
.commit_decimals(2)
|
||||
.range(range.clone())
|
||||
.step_arrows(StepArrows::Leading)
|
||||
.presets(&entries)
|
||||
.stepper(stops_stepper(15.0, presets, |v| format!("{v:.2}")))
|
||||
.show(ui)
|
||||
let field = NumberField::new(label, Bind::given(Some(shown))).unit("°").commit_decimals(2).range(range.clone());
|
||||
// No presets: the plain field production's Properties panel shows.
|
||||
if presets.is_empty() {
|
||||
field.show(ui)
|
||||
} else {
|
||||
field.step_arrows(StepArrows::Leading).presets(&entries).stepper(stops_stepper(15.0, presets, |v| format!("{v:.2}"))).show(ui)
|
||||
}
|
||||
})
|
||||
.inner
|
||||
}
|
||||
|
||||
/// Rotate: the bounding box's angle, and a new value turns the selection to it about the reference point
|
||||
/// (Alt+Enter turns a copy).
|
||||
pub(crate) fn rotate_field(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
/// (Alt+Enter turns a copy). With no `presets` the field is plain: no step arrows and no preset list.
|
||||
pub(crate) fn rotate_field(app: &mut VectorcraftApp, ui: &mut Ui, presets: &[f64]) {
|
||||
let bx = app.selection_box();
|
||||
let angle = bx.as_ref().map_or(0.0, |b| b.angle);
|
||||
let Some(out) = angle_field(ui, tl!("Rotate"), "rotate-ccw", angle, -360.0..=f64::INFINITY, &ANGLE_PRESETS, bx.is_some()) else { return };
|
||||
let Some(out) = angle_field(ui, tl!("Rotate"), "rotate-ccw", angle, -360.0..=f64::INFINITY, presets, bx.is_some()) else { return };
|
||||
let copy = out.edit.submit_mods.alt && app.session.active().is_some_and(|st| st.selection.anchors.is_empty());
|
||||
apply_edits(app, &out.edit, EditPath::Preview, |app, v, live| {
|
||||
// The angle shown is the preview's while the gesture runs: its release keeps it.
|
||||
@@ -568,7 +567,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
}
|
||||
object_fields(app, ui, panel_groups());
|
||||
Row::new().show(ui, |ui, _| {
|
||||
rotate_field(app, ui);
|
||||
rotate_field(app, ui, &ANGLE_PRESETS);
|
||||
shear_field(app, ui);
|
||||
});
|
||||
// Lucide's flip icons are named for their mirror line: flip-vertical-2 draws a vertical
|
||||
|
||||
@@ -42,6 +42,7 @@ pub(crate) const DESCRIPTIONS: &[(&str, &str)] = &[
|
||||
("trackpadRotateView", "A two-finger rotate gesture on a trackpad rotates the canvas view."),
|
||||
("interpolateControlPoints", "When you move anchor points, each curve with one moved end keeps its shape relative to its ends."),
|
||||
("deleteKeepsPathsJoined", "Delete removes the selected anchor points and refits the curve around each one, instead of opening the path there."),
|
||||
("doubleClickAddsAnchorPoints", "Double-clicking a path segment with the Direct Selection tool adds an anchor point there."),
|
||||
("holdToolKeys", "Holding a tool's shortcut key chooses the tool until you let go, and then the previous tool is chosen again."),
|
||||
("holdShortcuts", "Holding a key runs the tool or command in its Hold column in Keyboard Shortcuts; a quick press runs its usual shortcut."),
|
||||
("keyHoldDelay", "How long, in seconds, a key must be held before its hold shortcut runs instead of its usual shortcut."),
|
||||
|
||||
@@ -78,7 +78,9 @@ fn a_tool_key_let_go_behind_the_update_prompt_returns_after_it() {
|
||||
keys.release_s(&mut app, 1.0);
|
||||
assert_eq!(app.session.tool_id(), "scale", "Scale stays behind the prompt");
|
||||
crate::updates_ui::close_dialogs_for_test(&mut app);
|
||||
// The prompt's layer is gone in the first frame after it closes, and the held tool returns in the next.
|
||||
keys.frame(&mut app, 1.1, vec![]);
|
||||
keys.frame(&mut app, 1.15, vec![]);
|
||||
assert_eq!(app.session.tool_id(), "pen", "the Pen is back after the prompt");
|
||||
}
|
||||
|
||||
|
||||
@@ -246,6 +246,79 @@ fn named_panel_default_chords_toggle_their_panels() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Each Window menu row that shows a panel shows the chord of that panel's shortcut, as production's did, and the
|
||||
/// rows of the panels with a default key show one. The first frame builds the keymap after its menus, so the menus of
|
||||
/// the next frame show the chords.
|
||||
#[test]
|
||||
fn window_menu_panel_rows_show_their_panels_shortcuts() {
|
||||
let mut app = new_app();
|
||||
let ctx = ready(&mut app);
|
||||
key_frame(&mut app, &ctx, vec![]);
|
||||
let rows: Vec<(craft::keymap::CommandRef, Option<craft::keymap::Chord>)> = app
|
||||
.menus
|
||||
.bar
|
||||
.items()
|
||||
.into_iter()
|
||||
.filter(|it| it.command.id == "window.panel" && it.command.params["toggle"] == true)
|
||||
.map(|it| (it.command.clone(), it.shortcut))
|
||||
.collect();
|
||||
assert!(!rows.is_empty(), "the Window menu lists panels");
|
||||
let mut with_keys = 0;
|
||||
for (row, chord) in rows {
|
||||
let panel = row.params["panel"].as_str().expect("a panel row names its panel");
|
||||
let entry = crate::keymap::command_of(&format!("panel:{panel}"));
|
||||
assert_eq!(chord, craft::ui::runtime::commands::chord(&ctx, &entry), "{panel}: the row shows its shortcut's chord");
|
||||
if crate::shortcut_editor::PANEL_SHORTCUTS.iter().any(|(p, _)| *p == panel) {
|
||||
assert!(chord.is_some(), "{panel} has a default key, and its row shows it");
|
||||
with_keys += 1;
|
||||
}
|
||||
}
|
||||
assert!(with_keys > 0, "some listed panels have a default key");
|
||||
}
|
||||
|
||||
/// A click on a Window menu row toggles its panel: it puts a showing panel away and shows it again. Libraries is
|
||||
/// docked in front with no function key, so neither its flyout nor its shortcut toggles it.
|
||||
#[test]
|
||||
fn a_window_menu_click_toggles_its_panel() {
|
||||
use craft::ui::runtime::commands::{FirePhase, FireSource, Fired};
|
||||
let mut app = new_app();
|
||||
let ctx = ready(&mut app);
|
||||
let row = app
|
||||
.menus
|
||||
.bar
|
||||
.items()
|
||||
.into_iter()
|
||||
.find(|it| it.command.id == "window.panel" && it.command.params["panel"] == "libraries")
|
||||
.map(|it| it.command.clone());
|
||||
let row = row.expect("a Window › Libraries row");
|
||||
let before = crate::panel_docking::showing(&app.ui, "libraries");
|
||||
let click = |app: &mut VectorcraftApp| {
|
||||
crate::shortcuts::run_fired(app, &ctx, &Fired::new(row.clone(), FireSource::Menu, FirePhase::Press, 0.0));
|
||||
key_frame(app, &ctx, vec![]);
|
||||
crate::panel_docking::showing(&app.ui, "libraries")
|
||||
};
|
||||
let once = click(&mut app);
|
||||
assert_ne!(once, before, "the first click toggles Libraries");
|
||||
assert_eq!(click(&mut app), before, "the second click toggles it back");
|
||||
}
|
||||
|
||||
/// A click on the task bar's More Options › Show Properties Panel, a menu row that runs `window.panel {panel:
|
||||
/// "properties"}`, leaves a showing docked Properties panel showing: it does not take the toggle of Window › Properties.
|
||||
#[test]
|
||||
fn the_task_bar_show_properties_row_keeps_properties_showing() {
|
||||
use craft::ui::runtime::commands::{FirePhase, FireSource, Fired};
|
||||
let mut app = new_app();
|
||||
let ctx = ready(&mut app);
|
||||
let row = craft::keymap::CommandRef::with_params("window.panel", json!({ "panel": "properties" }));
|
||||
let click = |app: &mut VectorcraftApp| {
|
||||
crate::shortcuts::run_fired(app, &ctx, &Fired::new(row.clone(), FireSource::Menu, FirePhase::Press, 0.0));
|
||||
key_frame(app, &ctx, vec![]);
|
||||
crate::panel_docking::showing(&app.ui, "properties")
|
||||
};
|
||||
assert!(click(&mut app), "the first click shows Properties");
|
||||
assert!(click(&mut app), "a second click leaves Properties showing");
|
||||
}
|
||||
|
||||
/// A shortcut on a panel without a function key of its own runs `window.panel` with the params it has: no toggle is
|
||||
/// added, as production checked.
|
||||
#[test]
|
||||
@@ -1482,9 +1555,11 @@ fn enter_opens_the_tools_dialog_and_leaves_it_open() {
|
||||
key_frame(&mut app, &ctx, vec![]);
|
||||
assert_eq!(dialog_kind(&app).as_deref(), Some(dialog), "{tool}: and it stays open");
|
||||
assert_eq!(steps(&app), before, "{tool}: the Enter that opened it didn't confirm it");
|
||||
// With its default values only Reflect changes the art. A held OK closes its dialog on the window's next pass.
|
||||
// With its default values only Reflect changes the art. A held OK closes its dialog on the window's next pass,
|
||||
// and its field gives up the keyboard in the frame after that.
|
||||
key_frame(&mut app, &ctx, enter());
|
||||
key_frame(&mut app, &ctx, vec![]);
|
||||
key_frame(&mut app, &ctx, vec![]);
|
||||
let after = (before.0 + usize::from(dialog == "object.reflect"), before.1 + 1);
|
||||
assert_eq!((dialog_kind(&app), steps(&app)), (None, after), "{tool}: Enter confirms");
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ mod contextmenu;
|
||||
mod cut;
|
||||
mod distortkeys;
|
||||
mod document_drag;
|
||||
mod drag_commands;
|
||||
pub(super) mod folder;
|
||||
mod font_menu;
|
||||
mod fonts;
|
||||
|
||||
@@ -196,7 +196,8 @@ fn a_cmd_drag_held_during_a_merge_activates_another_tab() {
|
||||
Event::PointerButton { pos: grab, button: PointerButton::Primary, pressed: true, modifiers },
|
||||
],
|
||||
);
|
||||
assert_eq!(app.session.tool_id(), "shapeBuilder", "the press waits for the merge");
|
||||
// A merge done in the press frame changes the layout, so the frame runs again and that pass already makes the press.
|
||||
assert!(app.session.tool_id() == "shapeBuilder" || !app.session.tool_editing(), "the press waits for the merge");
|
||||
let r = app.session.tool_poll(view, true);
|
||||
canvas::apply_requests(&mut app, r);
|
||||
frame(&mut app, &ctx, 0.08, vec![]);
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//! A command sent through the control channel (`engine.execute`, which MCP's `run_command` sends)
|
||||
//! or run as a menu item while a tool's drag is in progress is a step of its own, before the drag's.
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_engine::Session;
|
||||
|
||||
use crate::VectorcraftApp;
|
||||
|
||||
/// Send a control request → its reply.
|
||||
fn control(app: &mut VectorcraftApp, ctx: &egui::Context, method: &str, params: Value) -> Value {
|
||||
let (request, _) = craft::automation::ControlRequest::new(method, params);
|
||||
let craft::automation::Reply::Done(reply) = crate::control::handle(app, ctx, &request) else { panic!("{method}: not done") };
|
||||
reply
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_command_from_the_control_channel_or_a_menu_during_a_drag_is_a_step_of_its_own() {
|
||||
for through_control in [true, false] {
|
||||
let at = format!("control channel {through_control}");
|
||||
let mut app = VectorcraftApp::new(Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({"width": 400, "height": 400})).unwrap();
|
||||
let other = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap();
|
||||
app.run("select.none", json!({})).unwrap();
|
||||
app.select_tool("rectangle");
|
||||
let ctx = egui::Context::default();
|
||||
let objects = |app: &VectorcraftApp| app.session.doc().unwrap().doc.layers[0].children().map_or(0, Vec::len);
|
||||
let hidden = |app: &VectorcraftApp| !app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(other)).unwrap().visible;
|
||||
let steps = app.session.doc().unwrap().history.undo.len();
|
||||
let down = json!({"events": [{"kind": "down", "x": 100, "y": 100}, {"kind": "drag", "x": 150, "y": 150}]});
|
||||
assert_eq!(control(&mut app, &ctx, "ui.pointer", down)["ok"], true, "{at}");
|
||||
if through_control {
|
||||
let r = control(&mut app, &ctx, "engine.execute", json!({"command": "object.hide", "params": {"ids": [other]}}));
|
||||
assert_eq!(r["ok"], true, "{at}: {r}");
|
||||
} else {
|
||||
app.run("object.hide", json!({"ids": [other]})).unwrap();
|
||||
}
|
||||
let up = json!({"events": [{"kind": "drag", "x": 200, "y": 180}, {"kind": "up", "x": 200, "y": 180}]});
|
||||
assert_eq!(control(&mut app, &ctx, "ui.pointer", up)["ok"], true, "{at}");
|
||||
assert!(hidden(&app), "{at}: the drag keeps the command's edit");
|
||||
assert_eq!(objects(&app), 2, "{at}: the drag draws its rectangle");
|
||||
assert_eq!(app.session.doc().unwrap().history.undo.len(), steps + 2, "{at}: a step each");
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(objects(&app), 1, "{at}: Undo takes back the drag first");
|
||||
assert!(hidden(&app), "{at}");
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
assert!(!hidden(&app), "{at}: then the command");
|
||||
}
|
||||
}
|
||||
@@ -133,10 +133,12 @@ fn home_lists_recent_files_and_a_click_opens_one() {
|
||||
let missing = dir.join("Gone.svg").to_string_lossy().into_owned();
|
||||
app.ui.recent_files = (0..9).map(|i| dir.join(format!("Drawing {i}.svg")).to_string_lossy().into_owned()).collect();
|
||||
app.ui.recent_files.insert(0, missing);
|
||||
// Each row reads its name and then its folder.
|
||||
let row = |name: &str| format!("{name}, {}", dir.display());
|
||||
let mut home = home_screen(app);
|
||||
assert!(home.shows("Gone.svg") && home.shows("Drawing 4.svg"), "the first recent files are listed");
|
||||
assert!(!home.shows("Drawing 5.svg"), "the first six only");
|
||||
home.double_click("Gone.svg");
|
||||
assert!(home.shows(&row("Gone.svg")) && home.shows(&row("Drawing 4.svg")), "the first recent files are listed");
|
||||
assert!(!home.shows(&row("Drawing 5.svg")), "the first six only");
|
||||
home.double_click(&row("Gone.svg"));
|
||||
let app = home.app();
|
||||
assert!(app.session.documents().is_empty());
|
||||
assert!(!app.ui.status.is_empty(), "a file that can't be opened says so");
|
||||
|
||||
@@ -86,6 +86,27 @@ fn a_discarded_rerun_runs_a_duplicate_once() {
|
||||
assert_eq!(undo(&app), before_undo + 1, "one undo step");
|
||||
}
|
||||
|
||||
/// While the selection moves every frame, as in a drag, each frame runs its UI once: the canvas's overlays are placed
|
||||
/// over the canvas and keep the layout its measuring run recorded, so no frame is discarded and run again.
|
||||
#[test]
|
||||
fn a_moving_selection_runs_each_frame_once() {
|
||||
let mut app = app();
|
||||
let ctx = crate::testing::ui_context();
|
||||
for _ in 0..3 {
|
||||
run_frame(&mut app, &ctx, vec![], |_| {}, false);
|
||||
}
|
||||
let frames = 8;
|
||||
let passes: usize = (0..frames)
|
||||
.map(|_| {
|
||||
let step = |app: &mut VectorcraftApp| {
|
||||
app.session.execute("object.move", &json!({"dx": 2, "dy": 1})).unwrap();
|
||||
};
|
||||
run_frame(&mut app, &ctx, vec![], step, false).0
|
||||
})
|
||||
.sum();
|
||||
assert_eq!(passes, frames, "{passes} passes for {frames} frames");
|
||||
}
|
||||
|
||||
/// One frame with an optional command applied between the tick and the draw (as a control request drained by `tick`
|
||||
/// does); returns the IME descriptor of the last pass.
|
||||
fn ime_frame(
|
||||
|
||||
@@ -315,7 +315,9 @@ fn applying_a_dialog_preview_reads_the_menus() {
|
||||
let read = m.angles(4);
|
||||
let synced = m.fake.synced();
|
||||
crate::tests_synthetic::control(&mut m.app, &m.ctx, "ui.dialog.confirm", json!({}));
|
||||
// OK applies in the dialog's pass, and its layer is gone from the next one.
|
||||
// The OK enters the next frame's pass and applies there; the dialog's layer and the preview's interaction are
|
||||
// gone two frames later.
|
||||
m.frame(vec![]);
|
||||
m.frame(vec![]);
|
||||
m.frame(vec![]);
|
||||
(read, synced, !m.app.session.in_interaction() && !m.app.any_dialog_open(), m.fake.synced())
|
||||
|
||||
@@ -677,6 +677,19 @@ fn the_preserve_checkboxes_open_as_they_were_last_confirmed() {
|
||||
assert_eq!(preserve(&r), [json!(false), json!(false), json!(true)], "Cancel keeps what OK left");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_every_color_preserved_the_colors_table_says_so_in_its_body() {
|
||||
let mut app = app();
|
||||
art(&mut app, &["#ffffff", "#000000"]);
|
||||
let mut r = assign(app, json!({}));
|
||||
assert!(r.rows().is_empty(), "White and Black are preserved");
|
||||
let note = "No colors to recolor (preserved colors are left out).";
|
||||
let inside = |r: &Recolor| rect(r, "Colors").contains_rect(rect(r, note));
|
||||
assert!(inside(&r), "the note is drawn inside the Colors table, not above its empty rows");
|
||||
r.frame();
|
||||
assert!(inside(&r), "and stays there on the next frame");
|
||||
}
|
||||
|
||||
fn new_hsb(r: &Recolor) -> Vec<[f32; 3]> {
|
||||
field(r, "rows").as_array().unwrap().iter().map(|row| vectorcraft_engine::cmd::color_value(&row["to"]).unwrap().to_hsb()).collect()
|
||||
}
|
||||
|
||||
@@ -478,11 +478,12 @@ fn panel_text_copied_before_the_art_formats_are_written_stays_on_the_clipboard()
|
||||
a.focused = false;
|
||||
let copy = a.menu(id);
|
||||
a.focused = true;
|
||||
copy
|
||||
// A fired command reaches the field in the next pass.
|
||||
[copied(©), copied(&a.frame(vec![]))].concat()
|
||||
} else {
|
||||
clipboard_chord(&mut a, event).0
|
||||
copied(&clipboard_chord(&mut a, event).0)
|
||||
};
|
||||
assert_eq!(copied(©), [length], "{id} copies the selected value (menu: {menu})");
|
||||
assert_eq!(copy, [length], "{id} copies the selected value (menu: {menu})");
|
||||
assert_eq!(a.selected(), 1, "{id} leaves the art (menu: {menu})");
|
||||
drop(hold);
|
||||
crate::background::wait_all(&mut a.app);
|
||||
|
||||
@@ -1387,6 +1387,8 @@ fn the_shape_properties_popup_changes_a_rectangle_corner_type() {
|
||||
assert_eq!(rig.count_text("Chamfer"), 2);
|
||||
assert!(rig.has_text("Inverted Round"));
|
||||
rig.click_text("Chamfer", true);
|
||||
// The closed list fades out on the clock.
|
||||
rig.fx.advance(1.0);
|
||||
assert!(!rig.has_text("Inverted Round"), "the pick closes the list");
|
||||
assert_eq!(steps(&rig.app()), before + 1, "the same kind adds no undo step");
|
||||
|
||||
|
||||
@@ -146,14 +146,30 @@ pub fn root_theme(prefs: &Prefs) -> (ThemeId, ModeChoice, Option<Rgba>) {
|
||||
}
|
||||
|
||||
/// The app's sizes over the framework's size sets (`sizes.json`): push buttons have the app's 4-point corners
|
||||
/// where the sets give pills, and the compact set takes the reference app's metrics: 26-point fields and spinners,
|
||||
/// 10 points inside panels, 5 between rows, 13-point body type with 12.5-point labels and 11-point captions, 5-point
|
||||
/// control corners, 8-point menus and 10-point windows, and 33-point panel tabs.
|
||||
/// where the sets give pills, the Home title is 26-point under 60 points of page margin with a 36-point call to
|
||||
/// action, and the compact set takes the reference app's metrics:
|
||||
/// 26-point fields and spinners, 24-point push buttons, 10 points inside panels, 5 between rows, 13-point body type
|
||||
/// with 12.5-point labels and 11-point captions, 16-point glyphs in icon buttons, 5-point control corners, 8-point
|
||||
/// menus and 10-point windows, 33-point panel tabs, 310-point dock columns with 14-point column bars and 38-point
|
||||
/// icon columns.
|
||||
const SIZES: &[u8] = br#"{
|
||||
"all": {"radius.button": 4},
|
||||
"all": {
|
||||
"radius.button": 4,
|
||||
"typography.display.size": 26,
|
||||
"typography.display.line_height": 32,
|
||||
"size.page.margin": 60,
|
||||
"size.page.action": 36
|
||||
},
|
||||
"compact": {
|
||||
"size.control.md": 26,
|
||||
"size.button": 24,
|
||||
"size.icon.glyph_md": 16,
|
||||
"size.rail.width": 38,
|
||||
"size.dock.column": 310,
|
||||
"size.bar.column": 14,
|
||||
"size.panel_header": 33,
|
||||
"size.bar.tab": 35,
|
||||
"size.bar.tab_large": 44,
|
||||
"space.pad.regular": 10,
|
||||
"space.gap.row": 5,
|
||||
"radius.control": 5,
|
||||
|
||||
+27
-11
@@ -763,7 +763,7 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions
|
||||
| `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. `rotate` is in degrees counter-clockwise; a positive `shear` moves the top to the right. With `copy`, the first step duplicates. A `scale`, `reflect` or `shear` that its command would refuse returns that error before any step runs; nothing changes and no undo step is recorded. The same holds for a step that is neither a number nor null, a `reflect` that is not a string, a `copy` that is not true or false, and an `origin` that is not two numbers. A null `rotate`, `scale`, `scaleX`, `scaleY`, `shear`, `reflect`, `copy` or `origin` is left out; a null `dx` or `dy` counts as 0, so it still runs the move. |
|
||||
| `create_graph` | `{type?, x, y, width, height, csv? \| series?, categories?, rows?}` | The nine Illustrator graph types: column, stacked column, bar, stacked bar, line, area, scatter, pie and radar. An empty CSV cell or a `null` in `rows` is a blank value; a number in straight quotes is a label. Edit later with `graph.setData` / `graph.setType` via `run_command`. `graph.column {design, columnType: vertical\|uniform\|repeating\|sliding, each, fractions: chop\|scale}` draws the columns or bars of the series picked with Group Selection (or `seriesIndexes`, or all of them) with a graph design saved by `graph.design`; with no `design` it returns the series' current design and options. Type in the design that holds a `%` followed by two digits shows each column's value, with at least the first digit's places before the decimal point and the second digit's places after it. |
|
||||
| `text_wrap` | `{ids?, offset?, invert?, release?}` | Area type below the objects (same layer) flows around them. `offset` is in points, from -1000 to 1000 (default 6). An offset outside that range or not a number, or an `invert` or `release` that is not true or false, is an error and changes nothing; `object.textWrap.make` and `object.textWrap.options` refuse the same values. |
|
||||
| `undo` / `redo` | `{}` | Many calls that change nothing record no undo step, for example `object.align` with nothing to move, `object.move` by 0 without `copy` and `object.showAll` with nothing hidden. `undo` (`edit.undo`) after such a call undoes the step before it. Settings that change without an undo step stay as they are when `undo` or `redo` brings back a step that did not change them: the perspective grid's view options and active plane, the grid preferences (`gridlineEvery`, `gridSubdivisions`), the export settings (`assets.settings.set`), and the current brush and symbol. A step that changed one of them, such as a perspective grid preset that shows the grid, takes that change back. The point Automatic Plane Positioning holds comes back with the step, and is let go when the active plane kept is another one. `inspect_document` lists the undo steps as `history`. `run_command` with `edit.clearHistory` removes every undo and redo step of the active document and returns `{cleared}`, the number of steps removed; the document stays as it is, and the command records no undo step. `run_command` with `edit.newDocumentFromState` and `{index?, created?}` makes a new document holding the art as it was at that state and makes it the active document, and returns `{index, title}`. `index` is a row of the History panel, with 0 the oldest state kept, and an omitted or null `index` uses the current state. An `index` that names no state fails with `no history state N`, one that is not a whole number with `` `index` must be a whole number ``, and either changes nothing. `created` is File Info's created date in Unix seconds or null, and defaults to now. The new document takes the next `Untitled-N` name, is marked unsaved, has nothing selected and has no steps to undo or redo. It is out of symbol, opacity-mask and pattern editing, and the art drawn in a pattern's tile is stored in the pattern, as `object.pattern.done` stores it. The source document and its steps stay as they are, except that typing or a drag in progress is first kept as a step. When a command keeps a drag whose preview Real-time Drawing off had not applied yet (`edit.undo`, `edit.redo`, `edit.clearHistory`, `edit.newDocumentFromState` and the other commands that end a drag first), and applying that preview gives a warning, the command's result carries it as `previewWarning`, and as `warning` too when the command gives no warning of its own; the app's status bar shows `warning`. While the Type tool edits type, `undo` and `redo` put its caret, with no characters selected, at the end of the text the step changed: after the text it puts back or retypes, or where the text it takes out was. A step that changes no characters, such as a formatting change, leaves the caret and the selection where they are. |
|
||||
| `undo` / `redo` | `{}` | Many calls that change nothing record no undo step, for example `object.align` with nothing to move, `object.move` by 0 without `copy` and `object.showAll` with nothing hidden. `undo` (`edit.undo`) after such a call undoes the step before it. Settings that change without an undo step stay as they are when `undo` or `redo` brings back a step that did not change them: the perspective grid's view options and active plane, the grid preferences (`gridlineEvery`, `gridSubdivisions`), the export settings (`assets.settings.set`), and the current brush and symbol. A step that changed one of them, such as a perspective grid preset that shows the grid, takes that change back. The point Automatic Plane Positioning holds comes back with the step, and is let go when the active plane kept is another one. `inspect_document` lists the undo steps as `history`. `run_command` with `edit.clearHistory` removes every undo and redo step of the active document and returns `{cleared}`, the number of steps removed; the document stays as it is, and the command records no undo step. `run_command` with `edit.newDocumentFromState` and `{index?, created?}` makes a new document holding the art as it was at that state and makes it the active document, and returns `{index, title}`. `index` is a row of the History panel, with 0 the oldest state kept, and an omitted or null `index` uses the current state. An `index` that names no state fails with `no history state N`, one that is not a whole number with `` `index` must be a whole number ``, and either changes nothing. `created` is File Info's created date in Unix seconds or null, and defaults to now. The new document takes the next `Untitled-N` name, is marked unsaved, has nothing selected and has no steps to undo or redo. It is out of symbol, opacity-mask and pattern editing, and the art drawn in a pattern's tile is stored in the pattern, as `object.pattern.done` stores it. The source document and its steps stay as they are, except that typing or a drag in progress is first kept as a step. When a command keeps a drag whose preview Real-time Drawing off had not applied yet (`edit.undo`, `edit.redo`, `edit.clearHistory`, `edit.newDocumentFromState` and the other commands that end a drag first), and applying that preview gives a warning, the command's result carries it as `previewWarning`, and as `warning` too when the command gives no warning of its own; the app's status bar shows `warning`. Any other command that changes the document during a tool's drag, from `run_command`, a panel or a menu, records its own undo step before the drag's. The command acts on the document without the drag's preview, and the drag then continues from the command's result: with Real-time Drawing on, the drag's preview is applied again at once, and with it off, the release applies it as before. The release records the drag's step after the command's, `undo` takes back the drag first and the command next, and Escape cancels only the drag. The drag acts on the objects it started with, so a selection the command makes (`select.all`, `edit.duplicate`) does not change what the drag moves, and the drag's release and Escape set the selection as they do without the command (with Real-time Drawing on, so does each move of the drag); a command that records no undo step, such as `select.none`, adds no step. When the command deletes or changes the art being dragged, the drag continues with the art the command left, and a drag left with nothing to change records no step. A warning or an error from the drag's preview applied again after the command is in the command's result as `previewWarning`. Typing in progress is kept as a step of its own before the command. Two cases run the command inside the drag, which then keeps the command's edit as part of its own step: a press of the Quick Pen (an edit to its path ends the path), and `object.transform` with `copy` during an Alt-drag, which copies the art as the drag's move left it. A command run while a dialog's or a panel's preview is open runs inside that preview. While the Type tool edits type, `undo` and `redo` put its caret, with no characters selected, at the end of the text the step changed: after the text it puts back or retypes, or where the text it takes out was. A step that changes no characters, such as a formatting change, leaves the caret and the selection where they are. |
|
||||
|
||||
For example, create editable Japanese area type with the engine's vertical writing mode:
|
||||
|
||||
@@ -3941,13 +3941,12 @@ not included.
|
||||
|
||||
## Learn panel
|
||||
|
||||
Window › Learn and the Explore tutorials button beside the search field at the right end of the app bar show and hide
|
||||
the Learn panel. Its For you tab holds a Get started section with a Quick skill guide card; choosing the card opens
|
||||
Window › Learn shows and hides the Learn panel. Its For you tab holds a Get started section with a Quick skill guide card; choosing the card opens
|
||||
the Skills tab. The Skills tab lists VectorCraft's own skills, each with a progress ring and the count of its tutorials
|
||||
finished of all its tutorials. Choosing a skill lists its tutorials, choosing a tutorial shows its numbered steps, and
|
||||
Back goes up one level.
|
||||
The tutorial text is English. `window.learn {show?}` shows the panel (`show: true`), hides it (`show: false`) or
|
||||
toggles it (`show` omitted or null), and answers whether it shows; Window › Learn and Explore tutorials run it.
|
||||
toggles it (`show` omitted or null), and answers whether it shows; Window › Learn runs it.
|
||||
The panel counts as hidden while the dock is hidden or a full screen mode hides the panels. Showing it shows a hidden
|
||||
dock; in a full screen mode it makes Learn the front panel, which shows when the mode ends, and answers false. Any
|
||||
other value of `show` is an error and changes nothing. `learn.list {}` →
|
||||
@@ -7273,7 +7272,8 @@ same way for a blend's spine point; without `handle` it is refused. These rules
|
||||
`path.insertAnchor` keeps the direct-selected anchors and selected segments of the path on the same points: those
|
||||
after the new anchor on its subpath are numbered one higher, and a selected segment that the new anchor splits stays
|
||||
selected as its two halves, with the new anchor as an end of both that moves with them. Undo restores the path and
|
||||
the selection in one step.
|
||||
the selection in one step. With `selectAnchor: true` the path becomes the selection with only the new anchor
|
||||
direct-selected, also when the path was selected; a `selectAnchor` value that is not a boolean is an error.
|
||||
`path.close {id, subpath?, at?, in?, out?, independent?}` closes an open subpath (by default the last open one). `at`
|
||||
moves the first anchor to `[x, y]`, its handles with it, before `in` and `out` are placed. `in` places
|
||||
the first anchor's incoming handle as `path.setHandle` places a handle: a smooth anchor turns its outgoing handle to
|
||||
@@ -8664,9 +8664,18 @@ The Selection & Anchor Display and General preferences apply to `pointer_gesture
|
||||
- `deleteKeepsPathsJoined` (General › Delete Removes Anchor Points and Keeps Paths Joined, off by default): the
|
||||
default of the `keepJoined` param of `edit.clear` (Delete, Backspace, Edit › Clear, and the Layers panel's Delete
|
||||
button while no row is highlighted). On, Delete removes the direct-selected anchors of a path as `path.removeAnchors` does, refitting the curve
|
||||
around each one, so a closed path stays closed and an open path stays in one piece; a path left with fewer than two
|
||||
anchors is deleted. The next anchor along (the one before at an open path's end) is then selected, so the next
|
||||
Delete goes on along the path. Off, Delete deletes the anchors with their segments and opens the path there.
|
||||
around each one, so a closed path stays closed and an open path stays in one piece. The next anchor along (the one
|
||||
before at an open path's end) is then selected, so the next Delete goes on along the path. When no subpath that lost
|
||||
an anchor keeps two anchors, the path stays selected whole, and the next Delete removes it. Off, Delete deletes the anchors with their segments and opens the path there.
|
||||
- `doubleClickAddsAnchorPoints` (General › Double-Click Adds Anchor Points, off by default): on, a double-click
|
||||
without modifier keys on a path segment with Direct Selection adds an anchor at the
|
||||
clicked point (`path.insertAnchor` with `selectAnchor: true`): the curve keeps its shape, the new anchor alone is
|
||||
selected, and the change is one undo step. The double-click takes the path whose stroke or outline is under the
|
||||
pointer, selected or not, in a group or in isolation mode, a clipping path included, and the path's own line must
|
||||
pass within the Selection & Anchor Display tolerance of the pointer. A double-click on an anchor, a direction
|
||||
handle, a center point, a mesh point or a blend's spine point, on a fill, or on a wide stroke or an effect's outline
|
||||
farther from the path, adds nothing and does what it did before. Group Selection is unchanged. Off, a Direct
|
||||
Selection double-click on a segment adds nothing.
|
||||
- `hideCornerWidgetAbove` (177° by default): corners wider than this show no Live Corners widget (a rectangle's right
|
||||
angles hide below 90°).
|
||||
- `transformPatternTiles` (off by default): the default of the transforms' `patterns` param (`object.transform`,
|
||||
@@ -9256,7 +9265,7 @@ area, in a grid of as many columns as the square root of the number of windows,
|
||||
its pane. Each view of a document counts as a window (see `window.newWindow` below). With fewer than two windows open it
|
||||
leaves the view, `tiled` and the layout as they are. It returns
|
||||
`{tiled, panes, layout}`. `window.arrange.tile {layout}` picks another layout, as the other Tile items of Window ›
|
||||
Arrange and of the application bar's Arrange Documents button do: `grid` (the default), `vertical` (Tile All
|
||||
Arrange do: `grid` (the default), `vertical` (Tile All
|
||||
Vertically: side by side in one row), `horizontal` (Tile All Horizontally: stacked in one column), and `2up`, `3up`,
|
||||
`4up` and `6up`, which show at most that many windows (2-Up and 3-Up side by side, 4-Up two by two, 6-Up three by
|
||||
two) and leave the others under their tabs. Those layouts show the first windows in tab order, and the current
|
||||
@@ -11063,7 +11072,11 @@ of a color shifted by hand. More than 256 entries, a key or value that is not a
|
||||
included), and two keys that name one color are errors. Presets and `webExport.settings` keep the map. In the dialog a double-click on an
|
||||
opaque swatch opens the Color Picker on the color shown (on the source color for a color already shifted; an agent
|
||||
sets `__editColor: "#source"`). Its OK shifts the color (picking the source color takes the shift away), and Cancel
|
||||
leaves the table as it was. A shifted swatch shows the source color at its upper left and the new color at its lower
|
||||
leaves the table as it was. An OK that would shift a 257th color changes nothing, and the status bar shows the
|
||||
limit; a key shifted to itself or a deleted color does not count, and a new shift writes `shifted` without them. A key
|
||||
written another way (`#F00`) still names its color, so a new shift or Unshift replaces it. A list entry written another
|
||||
way also names its color: the table marks it, Lock, Transparent, Web Shift and Delete Color act on it, and new entries
|
||||
are written as lowercase `#rrggbb`. A `#rrggbbaa` spelling names no table color. A shifted swatch shows the source color at its upper left and the new color at its lower
|
||||
right, with the lock mark, and Lock stays on until the color is unshifted. Web Shift replaces a shift by hand, and
|
||||
Unshift All Colors in the table's menu clears `shifted` and `webShift`. Only Web Colors in the picker starts off.
|
||||
|
||||
@@ -13503,7 +13516,10 @@ dialog exposes `name`, `font_family`, `font_style`, `size`, `leading`, `kerning`
|
||||
`tcyLeftRight`, `rotation`, `akiLeft`, `akiRight`, `tsume`, `diacriticHorizontal`, `diacriticVertical`, `language`, `fill`, `fill_tint`, `stroke`, `stroke_tint`, `stroke_width`, `overprint_fill`, `overprint_stroke`,
|
||||
`ot_figure`, `ot_position`, `ot_liga`, `ot_calt`, `ot_dlig`, `ot_swsh`, `ot_salt`, `ot_titl`, `ot_ordn`, `ot_frac`,
|
||||
`ot_sets`, `section` (`general`, `basic`, `advanced`, `color` or `opentype`), and `preview`. An empty field leaves its
|
||||
attribute unset. `leading` and `kerning` also accept `Auto` to store an explicit automatic value.
|
||||
attribute unset. `leading` and `kerning` also accept `Auto` to store an explicit automatic value. A number field
|
||||
given as text takes the arithmetic of the app's number fields (`"6x2"`, `"10+4"`) and a decimal comma; `size`, `leading`,
|
||||
`baseline_shift`, `tcyUpDown`, `tcyLeftRight` and `stroke_width` also read a unit (`"1 in"`), a final `%` is read only
|
||||
in `h_scale`, `v_scale`, `tsume`, `fill_tint` and `stroke_tint`, and a final `°` only in `rotation`.
|
||||
Advanced Character Formats holds `h_scale` and `v_scale` (percent, 1 to 10000),
|
||||
`baseline_shift` (points, -1296 to 1296), the Tate-chu-yoko Settings `tcyUpDown` and `tcyLeftRight` (points,
|
||||
-1296 to 1296, as `text.setRangeStyle` takes them; an explicit 0 stays distinct from unset), `rotation` (degrees, stored from -180 to 180), Insert Aki Left and Right `akiLeft` and `akiRight` (thousandths of
|
||||
|
||||
@@ -322,7 +322,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de
|
||||
| Export for Screens, Asset Export, slices, Save for Web | 3 | 85% | anti-aliasing ghost borders (#983); TIFF choices and settings are implemented | 2–4 | estimated |
|
||||
| Print, colour management, separations, flattener | 3 | 80% | Production Preflight available; print preview fidelity remains | 2–4 | estimated |
|
||||
| Automation (Actions, Variables, scripting, batch) | 3 | 60% | a scripting surface (Illustrator: JavaScript/ExtendScript), Batch, image and graph variables, dataset import/export | 8–14 | estimated; MCP `add_text` exposes existing vertical type; score and hours unchanged |
|
||||
| UI chrome (panels, Properties, workspaces, preferences) | 6 | 80% | Asset Export item context menus implemented (G12); Properties per context, 2 Preferences options stored but unused (#394, audited 2026-10-30: Scratch Disks, legacy vector clipboard), context menus in the panels that have none, accessibility | 13–20 | estimated; floating panels in OS windows of their own on the desktop (#4135), score and hours unchanged; macOS save Format menu implemented (#866), score and hours unchanged; Eyedropper cursor and precise setting checked (#1269), OS visual QA unverified; the line under the Preferences fields describes each General, Selection & Anchor Display, Guides & Grid, Smart Guides, Slices, Hyphenation, Plug-ins & Scratch Disks, User Interface, Performance, File Handling, Clipboard Handling, Appearance of Black and Devices setting on hover and keyboard focus (#8199, #8223, #8248, #8264, #8360, #8376, #8402, #8429, #8453, #8475, #8483, #8498), score and hours unchanged; numeric-field focus and normal text drags regression-tested (#1326); a focus click released more than 1 pt from its press keeps the caret and a tap within 1 pt selects all (#6659); artboard navigation synchronizes the tool selection before destructive actions; status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates (sample widths cached by language/unit/DPI; regression and contributor original-file evidence below; scores/hours unchanged); effect dialogs' colour fields show a swatch that opens the Color Picker (#5365), score and hours unchanged; icon-strip flyouts retain user sizes (#5713); floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), scores and hours unchanged ; interim macOS cursor delivery (#2292), headless coverage only; native validation pending, score and hours unchanged; Swatches item context menus have focused regressions and rendered-layout evidence below; Character Styles and Paragraph Styles item context menus have focused regressions (panels::text_styles::tests::right_click_context_menu_*); scores and estimates unchanged |
|
||||
| UI chrome (panels, Properties, workspaces, preferences) | 6 | 80% | Asset Export item context menus implemented (G12); Properties per context, 2 Preferences options stored but unused (#394, audited 2026-10-30: Scratch Disks, legacy vector clipboard), context menus in the panels that have none, accessibility | 13–20 | estimated; floating panels in OS windows of their own on the desktop (#4135), score and hours unchanged; macOS save Format menu implemented (#866), score and hours unchanged; Eyedropper cursor and precise setting checked (#1269), OS visual QA unverified; the line under the Preferences fields describes each General, Selection & Anchor Display, Guides & Grid, Smart Guides, Slices, Hyphenation, Plug-ins & Scratch Disks, User Interface, Performance, File Handling, Clipboard Handling, Appearance of Black and Devices setting on hover and keyboard focus (#8199, #8223, #8248, #8264, #8360, #8376, #8402, #8429, #8453, #8475, #8483, #8498), score and hours unchanged; numeric-field focus and normal text drags regression-tested (#1326); a focus click released more than 1 pt from its press keeps the caret and a tap within 1 pt selects all (#6659); artboard navigation synchronizes the tool selection before destructive actions; status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates (sample widths cached by language/unit/DPI; regression and contributor original-file evidence below; scores/hours unchanged); effect dialogs' colour fields show a swatch that opens the Color Picker (#5365), score and hours unchanged; icon-strip flyouts retain user sizes (#5713); floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), scores and hours unchanged ; interim macOS cursor delivery (#2292), headless coverage only; native validation pending, score and hours unchanged; Swatches item context menus have focused regressions and rendered-layout evidence below; Character Styles and Paragraph Styles item context menus have focused regressions (panels::text_styles::tests::right_click_context_menu_*); swatches dropped on New Swatch or Delete Swatch carry the selected swatches the find field or kind filter hides (#8620); scores and estimates unchanged |
|
||||
| Libraries, Links, Package | 2 | 82% | shared libraries, linked graphics, gradients and patterns as library items (no cloud by design) | 2–3 | estimated; #5804: private native-picked raster editor (scores unchanged) |
|
||||
| Generative AI (Text to Vector, Generative Recolor, Shape Fill, Concept to Vector, Prompt to Edit, Rewrite Text) | 2 | 0% | a pluggable provider and the panels; needs an owner decision on models | 30–60 | measured (absent) |
|
||||
| **Feature depth** | **105** | **~75%** | | **~250–420** | |
|
||||
@@ -769,6 +769,7 @@ since 2026-10-01.
|
||||
- **Mirrored handles in a Direct Selection drag (#7842):** Cmd/Ctrl added after a handle drag begins puts the anchor's other handle opposite the dragged one at the same length, on paths, type on a path and blend spines, and the anchor keeps its kind; Shift constrains the dragged handle first, and Alt keeps the handles independent. At an open end, where no segment leaves the anchor on the other side, the handle moves as it does without Cmd/Ctrl. When Cmd/Ctrl lends Direct Selection for the gesture while another tool, such as the Pen, is chosen, that press does not mirror; letting it go and pressing it again during the drag does. This is VectorCraft's own behavior. Regression tests: `crates/engine/tests/direct_handle_mirror.rs`.
|
||||
- **Cut of picked anchors (#6361):** Edit › Cut removes direct-selected anchors from their path and from a compound path's member, with the segments attached to them, as Clear does. Picked segments still lose only those segments. When a path also has a picked segment, Cut removes and copies only its picked segments and ignores its picked anchors, on every contour, as Clear does; an anchor left without a surviving segment is removed with them. Regression tests: `cut_*_anchors_*` and `cut_of_an_anchor_with_a_segment_on_another_contour_leaves_the_source_as_clear_does` in `crates/engine/tests/it/copy_direct_selection.rs`.
|
||||
- **Escape in Selection tool drags:** Escape during a Selection tool move or Alt-drag copy, a bounding-box scale or rotation, a marquee, or a corner widget, pie widget or bracket drag cancels it: the art returns to its state at the press, no copy is left, no undo step is added, the release does nothing, and the tool stays chosen. This is VectorCraft's own behavior. Regression tests: `escape_cancels_*` in `select/tests.rs` and `pie.rs`, and `escape_cancels_a_selection_tool_move_copy_scale_or_rotation` in `tests/selectescape.rs`.
|
||||
- **Commands run during a tool drag:** by VectorCraft's own rule, a command that changes the document while a tool drag is in progress (from a panel, a menu or `run_command`) records its own undo step before the drag's. The drag goes on with the art the command left, Escape cancels only the drag, and Undo takes back the drag first and the command next, with Real-time Drawing on or off. A selection the command makes does not change which objects the drag moves. Commands that keep the drag as a step first (Undo, Redo, `command.batch` and others), a Quick Pen press, and a copy made with `object.transform` during an Alt-drag work as before. Regression tests: `crates/engine/src/tests/interaction_commands.rs` and `tests::drag_commands` in `crates/ui-egui`.
|
||||
- **Large Shift-marquee selections and Select › Inverse:** `select.toggle` and `select.add` with many ids (a Shift-drag marquee sends them together) go through the selection once instead of once per id, and Select › Inverse looks each object up in a set of the selected ones. The resulting selection, its order and the reply are the same as before. With 50,000 objects the selection step of toggling every object off took 528 to 655 ms before and 2.5 to 4.6 ms after in 7 runs, wall clock on a machine that was running other builds (`cargo run --release -p vectorcraft-engine --example selection_bench`). Regression tests: `add_all_does_what_adding_each_does` and `toggle_all_does_what_toggling_each_does` in `crates/doc/src/selection/tests.rs`, and `toggle_and_add_handle_each_listed_id_in_order` in `crates/engine/tests/it/selection_commands.rs`.
|
||||
- **Shift-click in the Layers panel's selection column on a large layer:** `layer.selectAll {id, add: true}` checks whether the row's art is all selected with a set of the selected objects, and removes or adds that art in one pass instead of once per object. The resulting selection, its order, the reply and the highlighted rows are the same as before. On a layer of 50,000 objects the whole command took a median of 733 ms before and 6.9 ms after when all of the layer's art was selected, and 369 ms before and 24 ms after when every other object was, in 7 runs each, wall clock on Linux while other builds were running (`cargo run --release -p vectorcraft-engine --example layer_select_bench`). Regression test: `a_shift_click_in_the_selection_column_matches_adding_or_removing_each_id` in `crates/engine/src/tests/layers.rs`.
|
||||
- **Ctrl/Cmd-click and Shift-click on Layers panel target circles (#8639):** the target circles follow the same modifier rules as the row names, as the help page describes for selecting objects in the Layers panel: Shift for adjacent objects, Ctrl or Command for non-adjacent ones ([Move objects to different layers](https://helpx.adobe.com/illustrator/desktop/manage-layers/create-and-organize-layers/move-objects-to-different-layers.html)). Ctrl/Cmd-click adds the item (a layer: its art) to the selection or takes it out, which Shift-click did before (#913); Shift-click selects the art of every row from the last circle clicked (else the targeted row) to this one, and Shift+Ctrl/Cmd-click adds it (`layer.target {range, add?}`). Hidden or locked art and art outside the isolated group in the range is left out, and nothing stays targeted. Regression tests: `clicking_a_target_circle_targets_the_layer` and `shift_clicking_a_target_circle_selects_a_range_of_rows` in `crates/ui-egui/src/panels/layers/tests.rs`.
|
||||
@@ -880,7 +881,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Fade Region Outside Artboard:** Artboard Options' Global checkboxes Fade Region Outside Artboard and Update While Dragging ([user guide, Artboard options](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf)) are application preferences (`fadeRegionOutsideArtboard`, `artboardUpdateWhileDragging`), both on by default. While the Artboard tool is active the canvas draws everything outside the artboards, the pasteboard and the art on it, with each color channel at 60% of its value (VectorCraft's own amount), or only outside the box around all the artboards when crossing artboards would leave more than 4,096 rectangles in view; with Update While Dragging off it draws as usual during an artboard move or resize. Presentation Mode, exports and print do not change. Regression tests: `canvas::tests` (`the_artboard_tool_fades_the_pasteboard`, `presentation_mode_draws_no_fade`, `the_fade_darkens_art_on_the_pasteboard_and_not_on_the_artboard`, `outside_rects_cover_the_bounds_minus_the_boards`, `outside_rects_of_a_row_of_boards_stay_few`, `the_fade_of_crossing_boards_stays_bounded`, `update_while_dragging_keeps_or_drops_the_fade_during_an_artboard_drag`, `the_pasteboard_fade_leaves_exports_unchanged`), `dialogs/tests.rs` (`artboard_options_global_checkboxes_set_the_preferences`, `artboard_options_error_leaves_the_global_preferences_unchanged`).
|
||||
- **Saved views (G7):** View › New View… and Edit Views… ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html): up to 25 views per document, saved with it, renamed or deleted in Edit Views, chosen from the bottom of the View menu). Each view keeps the zoom, centre and rotation; the View menu lists all 25 (`view.goto1`–`view.goto25`), and Edit Views… lists them to rename or delete, applied together as one undo step. A file's views are checked when it opens (at most 25, unique names up to 255 characters, a finite centre and a positive zoom). Tests: `saved_views_round_trip_and_from_a_file_are_tidied` (`crates/format/tests/prop_format.rs`), `crates/engine/src/cmd/views.rs`, `crates/ui-egui/src/dialogs/edit_views.rs` and `every_saved_view_is_listed_at_the_bottom_of_the_view_menu` (`crates/ui-egui/src/menus.rs`).
|
||||
- **Window › Arrange › Tile (G7):** Tile (`window.arrange.tile`) shows every open document at once, edge to edge in the document area ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)), one pane each in a grid of as many columns as the square root of the number of documents, rounded up, each fitted to its pane. The current document's pane is the canvas; the other panes draw their documents with their artboards, guides and selected objects, and a press in one makes its document the current one. Consolidate All Windows (`window.arrange.consolidateAllWindows`) shows one document under its tab again. The grid and when the two items are enabled (Tile with two documents or more, Consolidate All Windows while they are tiled) are VectorCraft's own. Tests: `crates/ui-egui/src/canvas/panes/tests.rs`.
|
||||
- **Arrange Documents (G7):** the application bar's Arrange Documents button arranges the open documents in grid and tile layouts ([public source](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/workspace-overview.html)). Its menu, and Window › Arrange, have Consolidate All Windows, Tile (the grid), Tile All Vertically (side by side), Tile All Horizontally (stacked) and the 2-Up, 3-Up, 4-Up and 6-Up layouts, which show that many documents and leave the others under their tabs, the current one in the last pane (`window.arrange.tile {layout}`). The set of layouts and how each places the panes are VectorCraft's own. Tests: `crates/ui-egui/src/canvas/panes/tests.rs`.
|
||||
- **Arrange Documents (G7):** Window › Arrange arranges the open documents in grid and tile layouts ([public source](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/workspace-overview.html)). It has Consolidate All Windows, Tile (the grid), Tile All Vertically (side by side), Tile All Horizontally (stacked) and the 2-Up, 3-Up, 4-Up and 6-Up layouts, which show that many documents and leave the others under their tabs, the current one in the last pane (`window.arrange.tile {layout}`). The set of layouts and how each places the panes are VectorCraft's own. Tests: `crates/ui-egui/src/canvas/panes/tests.rs`.
|
||||
- **Window › Arrange › Float in Window, Float All in Windows and Cascade (G7):** documents float in windows of their own, out of the tab strip ([public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html)). Float in Window (`window.arrange.floatInWindow`) floats the current document, Float All in Windows (`window.arrange.floatAllInWindows`) every tabbed one, and Cascade (`window.arrange.cascade`) floats every document and stacks the windows from the upper left to the lower right ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). On the desktop each window is an OS window; on the web and on Wayland it is a window inside the app's window. The window of the current document holds the canvas; the others draw their documents as Tile's panes do, and a press in one makes its document the current one. Closing a window closes its document, asking to save unsaved changes. Consolidate All Windows brings every document back under the tabs, and Tile brings them back into its grid. The cascade's 30 pt step, the windows' size and when the items are enabled (Cascade with two documents or more, Float in Window for a tabbed current document, Float All in Windows while a document is tabbed, Consolidate All Windows while documents are tiled or floating) are VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`.
|
||||
- **Dragging a document tab out and a document window back (G7):** a document tab dragged more than 24 pt above or below the tab strip floats its document in a window under the pointer, and a document window dragged onto the tab strip goes back under the tabs ([public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html)). A window inside the app's window is dragged by its title bar; an OS window by the document's tab at its top, and the window follows the pointer. The 24 pt distance and the tab at the top of an OS window are VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`.
|
||||
- **Reordering document tabs (G7, #5663):** a document tab dragged along the tab strip moves its document among the others ([public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html)); a line marks the gap it goes in. The current document stays current, each document keeps its own zoom, centre and artboard, the views Window › New Window opened move with their document, and Window › Next/Previous Document follow the new order. `document.move` (`{from?, to}`) does the same from MCP, the control channel and recordings. `crates/ui-egui/src/tests/tab_reorder.rs`, `crates/engine/src/tests/document_move.rs`.
|
||||
@@ -1107,6 +1108,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- Numeric fields keep the pointer's pressed character as the text-drag start when movement exceeds the click threshold (#1326); a completed focus click selects the unit too. Pixel/point, plain and optional fields are regression-tested in both directions, before/after focus, with replacement text; keyboard focus, double-click, arrows and wheel keep their prior behavior. Native egui input confirms partial replacement gives 17 px instead of 700 px, one Undo/Redo, window captures and an exact saved-document read in a separate CLI process. A focus click released more than 1 pt from its press keeps the caret, and a tap within 1 pt still selects all (#6659; short-drag and jitter-tap regressions in `tests/numfields.rs`).
|
||||
- Unit fields and length strings take `%` in arithmetic: `3cm*50%` reads as 1.5 cm, and `50pt+25%` reads as 62.5 pt.
|
||||
- Value fields and length strings read `x` as a multiplication sign, as they read `*` (#8435; the help's "Calculate values in a panel or dialog box" lists `x` for multiplication: [help PDF, archived](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf)). `X` and `×` also multiply; that is VectorCraft's own choice. `10x2` reads as 20 and `2x3 mm` as 6 mm. A lowercase `x` right after a `p` stays the `px` unit (`2px x 3` is 6 px, and `2px3` is not read). Tests: `x_is_a_multiplication_sign` in `crates/doc/src/tests/units.rs`.
|
||||
- The number fields of Character Style Options read typed text with the same arithmetic and a decimal comma (`6x2` is 12, `200/2%` is 100%); the length fields also read a unit (`1 in` is 72 pt). A final `%` is read only in the percent fields and a final `°` only in Character Rotation, and an exponent (`1e3`) is not read. Tests: `number_fields_take_field_arithmetic` and `tsume_field_shows_sets_resets_and_commits` in `crates/ui-egui/src/dialogs/char_style_options/tests.rs`.
|
||||
- The contextual task bar's handle drags it anywhere on the canvas (kept whole on it as the window resizes); unpinned it keeps that offset as it follows the selection, and its More Options menu hides it, pins its position across selection changes (`window.taskBar.pin`), resets it under the selection (`window.taskBar.reset`) and shows the Properties panel. As in Illustrator the position isn't kept across launches. Not done: the bar's variants for other tools (only the selection tools, the Type tools, the basic shape tools, the Smooth tool and the Artboard tool show it).
|
||||
- A click on another object moves the contextual task bar under it without hiding it for the press; it gives way only to a drag (#4681).
|
||||
- With one image selected, the contextual task bar offers Image Trace, which traces the image at once with the Default preset (the Image Trace panel is left as it was), and Crop Image; with an Image Trace object it offers Expand, which keeps only the traced paths. This follows Illustrator's bar: for a selected image it includes Image Trace, Retype and Crop Image, and traced artwork can be expanded from it ([Contextual Task Bar announcement](https://community.adobe.com/announcements-651/contextual-task-bar-in-illustrator-2025-quick-actions-when-you-need-them-1546580)). Offset Path and Simplify, which don't apply to an image, aren't offered for one. Not done: Retype, which the app doesn't have.
|
||||
@@ -1222,7 +1224,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- A Recent Commands button beside the Help › Search Commands field lists the last eight commands, tools, panels and effects picked from the palette, most recent first, with a command picked again moved to the top. A pick is recorded when it runs or opens a dialog, even if the dialog is then canceled; a pick that is refused because its menu item is dimmed, its tool can't be chosen or its panel can't be shown is not recorded, unless it opened a dialog. Choosing a row closes the palette and runs it as a pick of the same result does; with no picks yet the list shows a dimmed No recent commands row, and a command that is not available now, such as a filter of a plug-in that is not loaded, is left out until it comes back. The ids are saved with the UI state. While the list is open, Up and Down move through its rows, wrapping at the ends, and Escape closes the list before the palette. This is VectorCraft's own addition and does not raise a score (#6376; `palette` tests `recent_commands_*`, `a_recent_command_runs_what_its_pick_runs`, `the_keys_wrap_within_recent_commands`, `escape_closes_recent_commands_before_the_palette`).
|
||||
- With an empty search, or one of spaces only, the Help › Search Commands field lists the picks of the Recent Commands list (at most eight, leaving out a filter of a plug-in that is not loaded) under a Recent heading, most recent first, with the first highlighted and no result count, so opening the palette and pressing Enter picks the last pick again; when no callout can point at the highlighted pick's home, the line under the list still says where it is. A pick that is dimmed now shows why in the status line, as from a search, and keeps its place in the list. With no picks yet it lists no results and shows a dimmed Type to search commands, tools, panels and effects line. A pick of Search Commands… itself is not recorded. The palette opens with its first result highlighted and its list scrolled to the top. This is VectorCraft's own behavior (`palette` tests `an_empty_search_lists_the_recent_picks_most_recent_first`, `an_empty_search_without_picks_says_what_to_type`, `enter_on_an_empty_search_runs_the_last_pick_again`, `the_palette_opens_again_with_its_first_row_highlighted`, `the_palette_toggle_is_not_a_recent_pick`, `a_click_on_a_recent_pick_runs_it_and_moves_it_first`, `a_pick_says_whether_it_ran_opened_a_dialog_or_was_refused`, `a_refused_pick_is_not_recorded`, `a_pick_that_opens_a_dialog_is_recorded_even_when_canceled`, `under_the_recent_picks_the_footer_names_a_home_out_of_view`).
|
||||
- The app bar's search control is a field showing a magnifier, "Search commands" and the Help › Search Commands… shortcut. The field shows no shortcut when the shortcut is cleared or too long to fit beside the text; the tooltip and the screen-reader name still give it. A click on the field, or Enter or Space while it has the keyboard focus, toggles the command palette as the shortcut does, and the palette's popup holds the text field. While the field has the focus, the app's existing rule for a focused control keeps the app's own keys off, so Enter does not open Move and Tab moves the focus on. While a dialog is open the field and the icon are drawn disabled and do nothing, as the shortcut does. Screen readers name the field and the icon Search commands, with the shortcut. As the bar narrows, the community button goes first, then Explore tutorials, then the field becomes the magnifier icon, then the workspace switcher narrows to 64 points, then the icon goes; Safe Mode's label keeps its room first. The field is wider than the icon, so the community button and Explore tutorials go at wider bars than they did beside the icon. This is VectorCraft's own addition and does not raise a score (`chrome::tests`: `the_app_bar_gives_up_its_right_hand_controls_in_order`, `a_wide_app_bar_shows_a_search_field_with_the_palette_shortcut`, `the_search_field_follows_the_palettes_shortcut`, `a_long_shortcut_leaves_the_search_hint_readable`, `a_click_on_the_search_field_opens_the_palette`, `the_search_icon_has_the_fields_name_and_both_are_disabled_under_a_dialog`, `the_keyboard_opens_the_palette_from_the_search_field`, `a_narrowing_app_bar_turns_the_search_field_into_the_icon`).
|
||||
- The Learn panel (Window › Learn, or Explore tutorials beside the search field on the app bar) has a For you tab with a Get started section and a Quick skill guide card, and a Skills tab that lists VectorCraft's own skills with their progress rings and counts of tutorials finished; a skill lists its tutorials, a tutorial shows its numbered steps, and Back goes up a level; `learn.list`, `learn.tab {tab}`, `learn.skill {skill}`, `learn.show {tutorial}` and `learn.back` script it, and the tab buttons, the rows and Back run them ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`).
|
||||
- The Learn panel (Window › Learn) has a For you tab with a Get started section and a Quick skill guide card, and a Skills tab that lists VectorCraft's own skills with their progress rings and counts of tutorials finished; a skill lists its tutorials, a tutorial shows its numbered steps, and Back goes up a level; `learn.list`, `learn.tab {tab}`, `learn.skill {skill}`, `learn.show {tutorial}` and `learn.back` script it, and the tab buttons, the rows and Back run them ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`).
|
||||
- **Windows/Linux menu access keys (#6596):** Alt+letter opens any of the nine in-window menu roots, with access letters underlined in the current language; letters and arrow keys reach visible nested and dynamic menus. Alt+O, P, Right, O opens Offset Path; in English, Alt+S, S opens Save Selection and Alt+S, E opens Edit Selection. Disabled items stay unavailable, colliding letters cycle choices for Enter, and changed menus discard stale choices. Escape and focus loss dismiss menu access while text editing, IME/AltGr input, custom shortcuts and active tool/pointer gestures keep their normal ownership. Keyboard focus reveals rows in long menus and wheel scrolling returns control to the pointer (`crates/ui-egui/tests/menu_access_keys.rs`).
|
||||
- A tool's name in a Learn tutorial step is a blue link that shows where the tool is without choosing it (`learn.locateTool {tool}`): its toolbar button is marked, a collapsed group's flyout opens with the tool's row marked, a torn-off strip comes to the front, and a tool no shown toolbar holds is marked in the All Tools drawer. The mark, its 3 seconds and the hidden-toolbar cases are VectorCraft's own rules ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`, the `a_learn_link_*` tests in `toolbar::tests`).
|
||||
- Under a tutorial's steps, View more opens the tutorial's own practice sample as a new untitled document, and once the tutorial is finished, Next Up moves to the next tutorial in the same skill, as the help page describes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html)). The samples are VectorCraft's own drawings. A Finish tutorial button that shows once the sample is open, the untitled copy, Back to skills in place of Next Up after a skill's last tutorial, and Next Up showing the next tutorial without opening its sample are VectorCraft's own rules. `learn.openSample`, `learn.finish`, `learn.next` and `learn.skills` (Back to skills) script them. Not done: the help page's short video. Regression tests: `view_more_opens_the_tutorial_s_sample_as_a_new_untitled_document`, `finishing_a_tutorial_offers_next_up_in_its_skill`, `the_practice_controls_work_from_the_keyboard`, `the_last_tutorial_of_a_skill_offers_back_to_skills`, `learn_finish_and_learn_next_follow_the_practice`, `learn_skills_shows_the_list_of_skills`, `the_practice_commands_reject_a_missing_or_unknown_tutorial`, `every_tutorial_has_its_own_readable_sample` and `the_next_tutorial_is_the_next_one_in_the_same_skill` in `crates/ui-egui/src/panels/learn/tests.rs`.
|
||||
@@ -1498,6 +1500,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
With Direct Selection and Group Selection, a drag that starts on an object while the selection also holds direct-selected anchors or segments moves those anchors and the objects selected whole in one undo step (`path.moveAnchors`), as a drag of a selected anchor does, and the other anchors of a partly selected path stay in place. While Alt is held during the drag, it copies the selected objects instead (`object.transform`). When direct-selected anchors are moved or transformed together with objects selected whole (such a drag, an anchor drag, an arrow key, or Move, Rotate, Scale, Reflect and Shear without a copy), a path inside a selected group is transformed once, with the group.
|
||||
VectorCraft's own preference General › Interpolate Control Points When Moving Anchors (`interpolateControlPoints`, off by default, fixes #7832): on, a Direct Selection drag, an arrow-key nudge, a Move or a Transform Again of selected anchors re-maps both handles of each segment with one moved end by the turn, uniform scale and move that take its old ends to its new ends, so a segment between corner anchors keeps its shape; a segment with both ends moved, or with its ends at the same place before or after the move, moves rigidly, and a smooth anchor keeps its handles in line. The commands take an `interpolate` param that defaults to the preference, and the value used joins the journal and Transform Again. Each drag or nudge is one undo step (`a_nudge_with_the_preference_on_re_maps_both_handles_of_the_segment`, `a_direct_selection_drag_with_the_preference_on_re_maps_the_handles_in_one_undo_step`, `a_smooth_anchor_keeps_its_handles_in_line`).
|
||||
VectorCraft's own preference General › Delete Removes Anchor Points and Keeps Paths Joined (`deleteKeepsPathsJoined`, off by default, part of #8326): on, Delete, Backspace and Edit › Clear remove the direct-selected anchors of each path as Remove Anchor Points does, refitting the curve around each one, so a closed path stays closed and an open path stays in one piece; the next anchor along (the one before at an open path's end) is selected, so the next Delete goes on along the path. Paths with a selected segment are still cut there, objects selected whole are still deleted, and a path left with fewer than two anchors goes, in one undo step. `edit.clear` takes a `keepJoined` param that defaults to the preference, and the value used joins the journal (`with_the_preference_on_delete_keeps_a_closed_path_closed_and_selects_the_next_anchor`, `several_paths_and_an_object_selected_whole_change_in_one_undo_step`, `with_the_preference_on_delete_and_backspace_keep_the_path_joined`).
|
||||
VectorCraft's own preference General › Double-Click Adds Anchor Points (`doubleClickAddsAnchorPoints`, off by default, part of #8326): on, a double-click without modifier keys on a path segment with Direct Selection adds an anchor at the clicked point, keeping the curve's shape, with only the new anchor selected, in one undo step (`path.insertAnchor` with `selectAnchor`); on an anchor, a handle, a center point, a blend's spine point or a fill the double-click does what it did before, and a clipping path's segment gets the anchor (`with_the_preference_on_a_double_click_on_a_segment_adds_an_anchor_there`, `with_the_preference_on_a_double_click_in_a_group_adds_only_on_a_segment`, `with_the_preference_on_a_double_click_gives_way_to_spine_points_and_reaches_clipping_paths`, `with_the_preference_on_a_double_click_on_a_segment_adds_an_anchor_in_one_undo_step`, `the_double_click_and_delete_preferences_are_separate`).
|
||||
A path segment with a control point whose x or y is infinite or larger in size than `f64::MAX / 16` is measured by its control points, so its bounds hold the whole curve and the canvas check refuses an edit that leaves such a path selected (`path.create` included).
|
||||
With Direct Selection, the Pen and the anchor tools, a group, compound path or clip group selected whole shows the anchors of its paths filled, as a path selected whole does; the direction handles still show only on a path that is selected itself. Public references: [Adjust anchor point, handle, and bounding box display size](https://web.archive.org/web/20251114182206/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/adjust-anchor-point-handle-and-bounding-box-display-size.html) and [Drawing basics](https://web.archive.org/web/20231130064834/https://helpx.adobe.com/illustrator/using/drawing-basics.html) (archived copies).
|
||||
When the Add Anchor Point tool, the Pen's Auto Add, the Smart Pen's Alt-click on a segment or Alt-click with the Scissors adds an anchor to a path with direct-selected anchors or segments (`path.insertAnchor`), the same points stay selected: the anchors and segments after the new anchor are numbered one higher, and a selected segment that the new anchor splits stays selected as its two halves.
|
||||
@@ -1627,6 +1630,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
Ctrl/Cmd+Alt-clicking an eye switches the other layers to Outline and the row's layer to Preview, or switches all layers back to Preview when the others are in Outline (`layer.outlineOthers`, `layer.previewAll`).
|
||||
Ctrl/Cmd+Alt-clicking New Layer adds a layer directly below the current layer, at its level (`layer.new {below: true}`), and Ctrl/Cmd+Alt-clicking New Sublayer adds a sublayer under the contents of the layer it goes into (`layer.newSublayer {bottom: true}`), each in one undo step. The reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists these clicks for placing a layer below the selected layer and a new sublayer at the bottom of the layer list.
|
||||
Alt-clicking a layer's or sublayer's name makes it the current layer, as a click does, and selects its visible, unlocked art, as its selection square does (`layer.selectAll`, then `layer.setCurrent`); on a hidden or locked layer it clears the selection. The reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists Alt-click on the layer name for selecting all objects on the layer.
|
||||
A layer or sublayer whose selectable art is all selected shows the full-sized selection square instead of the small one, as the [help page](https://helpx.adobe.com/illustrator/desktop/manage-layers/create-and-organize-layers/layers-overview.html) describes for a layer with every item selected. As VectorCraft's own rules, sublayers follow the same rule, "all" means the visible, unlocked art its selection square selects (hidden or locked art does not keep the square small, and a selected member of a group is not the group), and a layer with no such art shows no square. A group row keeps the small square while only its members are selected (`panels::layers` tests `a_layer_with_all_its_art_selected_shows_the_full_square`, `a_layer_without_art_shows_no_square` and `full_layers_are_the_layers_with_all_their_art_selected`).
|
||||
Object › Arrange › Send to Current Layer returns the error "the target layer is locked or hidden" and leaves the selected objects where they are when the current layer is hidden or locked, or is inside a hidden or locked layer.
|
||||
Selected objects are deselected, the key object included, when a row drag moves them into a hidden layer or group, when `node.move` moves them into a hidden or locked layer or group, when Merge Selected moves them into a hidden or locked layer, when Collect in New Layer moves them into a new layer inside a hidden or locked layer, when Flatten Artwork moves them into a locked layer, and when applying a data set hides them.
|
||||
Layer Options for several highlighted rows shows the first row's settings, and OK changes only the settings set in the dialog: each row keeps its own color, Template, Lock, Show, Print, Preview and Dim Images otherwise (`crates/ui-egui/src/dialogs/layer_options.rs` tests).
|
||||
@@ -1860,7 +1864,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
The Character panel menu's Character Direction (with the Indic options; `text.setFormat {charDirection}`, `text.setRangeStyle {charDirection}`) sets the selected characters left to right or right to left inside their paragraph, as a Unicode bidi embedding: a date set Left to Right keeps its order in right-to-left text, and a word set Right to Left keeps the punctuation after it on its left. Default (the default) leaves the characters to the bidi algorithm; character styles and the native file keep the setting.
|
||||
In vertical type, the Tabs panel names its alignment buttons Top-Justified Tab, Center-Justified Tab, Bottom-Justified Tab and Decimal-Justified Tab, in their tool tips and for screen readers, and labels the position field Y. In horizontal type the buttons keep the names Left-Justified Tab and Right-Justified Tab, and the field keeps the label X.
|
||||
The Tabs panel's ruler is numbered in the General unit with the canvas rulers' label steps and a tick every tenth of a step. With the panel menu's Snap to Unit on, or Shift held, a tab stop placed by a click on the ruler or dragged on it lands on the nearest tick (`text.tabs.set`).
|
||||
With Snap to Unit off and Shift not held, a tab stop placed by a click on the Tabs panel's ruler or dragged on it lands on the nearest whole point. A position typed in the X or Y field keeps its hundredths of a point.
|
||||
With Snap to Unit off and Shift not held, a tab stop placed by a click on the Tabs panel's ruler or dragged on it lands on the nearest whole point. A position typed in the X or Y field keeps its hundredths of a point. When the shown paragraph has no tab stops and no indent marker is selected, a position typed in the X or Y field and committed adds a stop there with the chosen alignment and selects it, in one undo step, as a click on the ruler does; the [archived user guide](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=521) gives typing a position as another way to set a new stop. The field holds a typed position to 0 to 100,000 pt (VectorCraft's own limits). Tests `panels::tabs::tests::typing_x_into_a_paragraph_without_stops_adds_and_selects_a_stop`, `typing_y_into_vertical_type_without_stops_adds_a_stop`, `a_refused_first_stop_adds_nothing_and_records_no_undo` and `typing_the_first_stop_over_mixed_paragraphs_uses_the_displayed_list`.
|
||||
The Tabs ruler's upper first-line marker and lower left-indent marker show absolute positions and set paragraph indents (`text.setFormat`). Dragging the lower marker keeps the upper position, while Ctrl-dragging it (Command on macOS) moves both; marker drags snap like tab stops, and each release is one undo step. With differing left indents, only the upper marker is shown and its absolute target applies to every touched paragraph.
|
||||
When a drag on the Tabs panel's ruler or a value typed in its X field moves a tab stop past another stop, the moved stop stays selected.
|
||||
With the Selection tool, the Tabs panel shows the ruler and stops of the first paragraph of the first selected text object, also when the text is inside a selected group or a shape is selected before it; a selection without text shows "No text selected". A stop set on that ruler is set on every selected text object and the text in selected groups, and other objects are left as they were. This is VectorCraft's own rule. Tests `panels::tabs::tests::the_ruler_shows_text_selected_after_an_object_that_is_not_text`, `the_ruler_shows_text_inside_a_selected_group`, `a_stop_added_on_a_mixed_selection_sets_every_selected_text` and `a_selection_without_text_shows_no_ruler`.
|
||||
@@ -2003,8 +2007,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
Validation on 2026-11-15: native Windows formatting, workspace Clippy and all 39 focused Swatches tests passed. Windows full CI stopped at unchanged engine tests `tests::package::a_confined_package_names_files_outside_the_read_root_by_name` (slash-sensitive report assertion) and `tests::plugins::plugin_storage_behind_a_link_is_left_alone` (storage-link setup returned AlreadyExists). Both cases pass in the Linux/WSL full CI run, which passed all 13 gates. No engine or CI workflow changes are included.
|
||||
The Swatches panel menu has Add Selected Colors, on while art is selected: it adds a swatch for each color of the selected art that the panel does not hold yet, as global swatches the art's matching paints link to, in one undo step ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/use-swatches/add-colors-to-swatches.html) describes the panel menu command that adds the selected artwork's colors). The swatch names and the colors it reads (fills, strokes, text, gradient stops, mesh points) are VectorCraft's own, as for Add Used Colors. Add Used Colors and Add Selected Colors record no undo step when there is no new color, and still end typing in progress as its own step. With Global Edit on, the members the command does not read keep their colors. Evidence: `add_selected_colors_adds_the_selection_colors_as_global_swatches` in `crates/ui-egui/src/panels/swatches/tests.rs`; `add_used_colors_with_no_new_color_records_no_undo_step`, `add_used_colors_with_no_new_color_ends_the_typing` and `add_selected_colors_in_global_edit_keeps_the_other_members_colors` in `crates/engine/src/tests/swatchcmds.rs`.
|
||||
The panel's Delete Swatch and Swatch Options (footer buttons and panel menu), New Color Group and Save Swatch Library treat only None and [Registration] as reserved, so a user swatch or color group whose name starts with `[` can be deleted, edited, grouped and saved; selected names the document no longer holds are left out (`panels::swatches::tests::bracketed_user_swatches_and_groups_can_be_deleted_and_edited`).
|
||||
Dragging swatches onto Delete Swatch deletes them ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=136), Replace, merge, or delete swatches section, lists this drag as one of the ways to delete the selected swatches): a swatch or color group dragged from the Swatches panel, in any view, and released on the Delete Swatch button is deleted through `swatch.delete`, even while nothing was selected and the button is disabled for clicks. A swatch that is part of the selection carries the other selected swatches of its kind with it. VectorCraft's own rules: the drop asks first as a plain click does, and Alt does not skip the question; Cancel keeps everything, and OK deletes them in one undo step; None and [Registration] are never taken; the button is enabled while swatches are selected or while a swatch or group of the active document is being dragged, and it is outlined only while such a swatch or group is held over it, so a paint from another panel, art and a swatch dragged from another document delete nothing. Tests: `panels::swatches::tests::swatches_dropped_on_delete_swatch_are_deleted_after_asking`, `delete_swatch_ignores_other_drags`.
|
||||
Dragging swatches onto New Swatch duplicates them ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/use-swatches/duplicate-swatches.html) gives this drag as another way to duplicate the selected swatches): a swatch dragged from the Swatches panel, in any view, and released on the New Swatch button is copied through `swatch.duplicate` without opening the New Swatch dialog. A swatch that is part of the selection carries the other selected swatches with it. VectorCraft's own rules: each copy goes just after its swatch and in its color group, named `<name> copy` and then `<name> copy 2`; the copies of one drop are one undo step and are selected; modifiers held on release do not change the drop; color groups, None and [Registration] are not duplicated; the button is outlined only while such a swatch of the active document is held over it, so a paint from another panel, art, a swatch dragged from another document and a swatch deleted during the drag duplicate nothing. Tests: `panels::swatches::tests::swatches_dropped_on_new_swatch_are_duplicated`, `new_swatch_ignores_other_drags`.
|
||||
Dragging swatches onto Delete Swatch deletes them ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=136), Replace, merge, or delete swatches section, lists this drag as one of the ways to delete the selected swatches): a swatch or color group dragged from the Swatches panel, in any view, and released on the Delete Swatch button is deleted through `swatch.delete`, even while nothing was selected and the button is disabled for clicks. A swatch that is part of the selection carries the other selected swatches of its kind with it, also those the find field or the kind filter hides. VectorCraft's own rules: the drop asks first as a plain click does, and Alt does not skip the question; Cancel keeps everything, and OK deletes them in one undo step; None and [Registration] are never taken; the button is enabled while swatches are selected or while a swatch or group of the active document is being dragged, and it is outlined only while such a swatch or group is held over it, so a paint from another panel, art and a swatch dragged from another document delete nothing. Tests: `panels::swatches::tests::swatches_dropped_on_delete_swatch_are_deleted_after_asking`, `delete_swatch_ignores_other_drags`.
|
||||
Dragging swatches onto New Swatch duplicates them ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/use-swatches/duplicate-swatches.html) gives this drag as another way to duplicate the selected swatches): a swatch dragged from the Swatches panel, in any view, and released on the New Swatch button is copied through `swatch.duplicate` without opening the New Swatch dialog. A swatch that is part of the selection carries the other selected swatches with it, also those the find field or the kind filter hides. VectorCraft's own rules: each copy goes just after its swatch and in its color group, named `<name> copy` and then `<name> copy 2`; the copies of one drop are one undo step and are selected in panel order; modifiers held on release do not change the drop; color groups, None and [Registration] are not duplicated; the button is outlined only while such a swatch of the active document is held over it, so a paint from another panel, art, a swatch dragged from another document and a swatch deleted during the drag duplicate nothing. Tests: `panels::swatches::tests::swatches_dropped_on_new_swatch_are_duplicated`, `new_swatch_ignores_other_drags`, `footer_drops_carry_selected_swatches_that_find_hides`.
|
||||
Editing, renaming, deleting or merging a global swatch also changes the colors linked to it in graph designs, the art of brushes and the tile that pattern editing's Cancel puts back, in the same undo step as the rest of the art; Default Swatches with replace unlinks them there too.
|
||||
A swatch step in `command.batch` (Delete, Swatch Options, Merge, Edit Color Group) changes the fill and stroke for new art as the command run on its own does, so art drawn later in the batch or after it takes the same paint; a batch that fails, and a canceled batch preview, put back the paints it started with, and a canceled Swatch Options preview leaves them as they were. These swatch commands also change the fills and strokes of the appearance new art takes, and Undo and Redo of the command or the batch put the paints for new art back with the swatches. Spot Colors options (`swatch.spotOptions`) and Default Swatches with replace (`swatch.resetDefaults {replace: true}`) as `command.batch` steps also change the fill and stroke for new art as each command run on its own does: a fill or stroke linked to a Lab spot swatch keeps its link and tint and takes the Lab values or their CMYK equivalent, and one linked to a swatch the replace removes keeps its color and loses the link. Evidence: `swatch_steps_in_a_batch_change_the_new_art_paints_as_commands_do`, `spot_colors_options_in_a_batch_change_the_new_art_paints_as_the_command_does`, `default_swatches_replace_in_a_batch_unlinks_the_new_art_paints_as_the_command_does`, `undo_and_redo_of_a_swatch_edit_put_back_the_new_art_paints`, `swatch_edits_reach_the_paints_of_the_new_art_template`, `a_failed_batch_puts_back_the_new_art_paints_a_swatch_step_changed` and `canceling_a_swatch_options_preview_keeps_the_new_art_paints` in `crates/engine/src/tests/swatches.rs`.
|
||||
Add Used Colors (`swatch.addUsedColors`) and Select All Unused (`swatch.unused`) look colors, swatch names, links, tints and gradients up in hash sets instead of searching every swatch and color for each color or linked paint (New Color Group from artwork too), and New Swatch with several colors (`swatch.new`), New Color Group (`swatch.newGroup`) and Edit Color Group (`swatch.editGroup`) name their new swatches from one set of the names already taken. The new swatches keep their names, order and links, and Select All Unused lists the same swatches. Evidence: `add_used_colors_adds_each_new_color_once_with_free_names`, `add_used_colors_global_links_every_paint_of_a_new_color`, `unused_matches_links_tints_colors_gradients_and_patterns_exactly`, `new_swatches_from_colors_are_numbered_after_names_already_taken`, `new_color_group_numbers_its_colors_after_the_group_and_its_moved_swatches`, `new_color_group_from_artwork_lists_each_color_once_with_free_names` and `edit_color_group_numbers_extra_colors_after_the_names_it_keeps` in `crates/engine/src/tests/swatchcmds.rs`; `free_swatch_names_match_naming_each_swatch_as_it_is_added` and `free_swatch_names_match_new_swatch_names_as_swatches_are_added` in `crates/doc/src/swatches.rs`.
|
||||
|
||||
+1
-1
@@ -450,7 +450,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| Effect > Warp Options: style previews, orientation choices and percent controls | done | #1760; focused input, mixed-style and history checks passed; original captures reviewed. No geometry or optional Properties changes. |
|
||||
| Command search: Up and Down move through the results, Enter runs the highlighted one | done | #1798 (#1757) |
|
||||
| Help › VectorCraft Help… and F1 show in-app search for tools, menu commands, and built-in tutorials. Tool results mark their toolbar location; command results show their menu path and shortcut without running them; tutorial results show their steps. Home clears the search, Back returns to the results, and Escape in the search field closes the panel. | partial | [Public source](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-with-discover-panel.html); `help.discover`, `help.discover.search`, `help.discover.choose`, `help.discover.back`; `menus::tests::help_f1_opens_discover_without_a_document`. Articles, Quick Actions, and Discover preferences are not implemented. Menu-path text instead of a menu location marker is VectorCraft's current guidance. |
|
||||
| Learn panel: Window › Learn and Explore tutorials on the app bar open it; For you holds a Quick skill guide card, Skills lists VectorCraft's own skills with progress rings that fill and counts of tutorials finished, a tutorial shows its numbered steps with a check box each that marks the step done once its sample is open, a finished tutorial has a check mark, Back goes up a level; a tool's name in a step is a link that marks the tool where the toolbars show it (its button, its group's flyout, a torn-off strip, a toolbar made with New Toolbar or the All Tools drawer) without choosing it; View more opens the tutorial's practice sample as a new untitled document, Finish tutorial then marks it finished with all its steps, and Next Up shows the next tutorial in the same skill; Reset progress clears the progress (no video) | done | [the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `learn.list`, `learn.tab`, `learn.skills`, `learn.skill`, `learn.show`, `learn.back`, `learn.locateTool`, `learn.openSample`, `learn.markStep`, `learn.finish`, `learn.next`, `learn.resetProgress`; the mark's look and 3-second lifetime, marking steps by hand, keeping the progress in the preferences and Reset progress are VectorCraft's own rules; `panels::learn::tests`, `toolbar::tests` |
|
||||
| Learn panel: Window › Learn opens it; For you holds a Quick skill guide card, Skills lists VectorCraft's own skills with progress rings that fill and counts of tutorials finished, a tutorial shows its numbered steps with a check box each that marks the step done once its sample is open, a finished tutorial has a check mark, Back goes up a level; a tool's name in a step is a link that marks the tool where the toolbars show it (its button, its group's flyout, a torn-off strip, a toolbar made with New Toolbar or the All Tools drawer) without choosing it; View more opens the tutorial's practice sample as a new untitled document, Finish tutorial then marks it finished with all its steps, and Next Up shows the next tutorial in the same skill; Reset progress clears the progress (no video) | done | [the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `learn.list`, `learn.tab`, `learn.skills`, `learn.skill`, `learn.show`, `learn.back`, `learn.locateTool`, `learn.openSample`, `learn.markStep`, `learn.finish`, `learn.next`, `learn.resetProgress`; the mark's look and 3-second lifetime, marking steps by hand, keeping the progress in the preferences and Reset progress are VectorCraft's own rules; `panels::learn::tests`, `toolbar::tests` |
|
||||
| Pathfinder panel: a group selected alone counts its nested shapes, so an expanded stroked object keeps the Shape Modes enabled | done | #1642 (#1635) |
|
||||
| Selected Grid Repeat shows row, column and corner handles and spacing sliders; bounding-box handles take priority where they meet | done | #2691, `tools/src/repeat_grid.rs`; [public behavior reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/set-grid-repeat-options.html); drags preview and commit `object.repeat.options` as one undo step, Escape cancels; a selected Radial Repeat shows an instances handle below it (16 px of drag per instance, 1 to 1,000) and a radius handle on its circle the same way (`tools/src/repeat_radial.rs`; [public behavior reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/create-radial-repeats.html)), and a splitter on its circle that hides the instances it is dragged back past while the others keep their places, and shows them again when dragged forward (its place half a step past the last instance shown and its limit of one instance shown are VectorCraft's own rules) |
|
||||
| Grid Repeat Options (Object › Repeat › Options…) has a Preview checkbox: the repeat on the canvas follows the fields while the dialog is open, Cancel puts the original back without a history step, OK keeps the previewed values as one undo step | done | #2651; [public behavior reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/set-grid-repeat-options.html) lists the Preview option for the grid options only, so Radial and Mirror Repeat Options have none; `dialogs/command.rs` tests |
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::process::Command;
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
const REV: &str = "a4b6d3b6ca04a65d5972339b808d1049a14c7167";
|
||||
const REV: &str = "4bed21baaa41d2b47bef90879c04df521f6f6043";
|
||||
const PACKAGES: &[(&str, &str, &str)] = &[
|
||||
("craft-pdf", "0.1.0", REV),
|
||||
("krilla", "0.8.2", REV),
|
||||
|
||||
Reference in new issue
Block a user