This commit is contained in:
bflatastic committed 2026-11-18 23:19:24 +07:00
commit b5ec1c2739
38 files changed
+247 -15

No files matched your search

+1
View File
@@ -323,6 +323,7 @@ fn headless_command_list_includes_ui_commands() {
"app.quit",
"window.arrange.tile",
"align.horizontalLeft",
"align.toKeyObject",
"ui.action.play",
];
for (n, id) in want.iter().enumerate() {
+18
View File
@@ -374,6 +374,24 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{} the Align panel's Horizontal Distribute Space button: object.distributeSpacing {axis: \"horizontal\"} with to: \"key\" while there is a key, else the Align To choice, and spacing: the Distribute Spacing value while there is a key; with the Artboard tool chosen, the artboard command of the same name (artboard.distribute, artboard.distributeSpacing) with the same direction on the artboards the tool has selected, to: \"artboard\" (the active artboard) and spacing: the Distribute Spacing value while Align to Artboard is chosen, else \"selection\"",
),
(
"align.toSelection",
"Align to Selection",
"",
"{} the Align panel's Align to Selection button: Align To becomes Selection (saved with the preferences, ui.inspect › ui.align_to) and the key object, key guide or key anchor is let go → {alignTo: the choice the Align panel then shows: \"selection\", or \"artboard\" while one object is selected, since one object aligns to the artboard}; with the Artboard tool chosen the selected objects keep their key",
),
(
"align.toKeyObject",
"Align to Key Object",
"",
"{} the Align panel's Align to Key Object button: with no key, the topmost of two or more selected objects becomes the key object, or a ruler guide selected with one object the key guide; the stored Selection or Artboard choice stays → {alignTo: \"key\"}; an error (\"no key object\") when there is no key and nothing to make one of, which includes a topmost selected object inside another selected object; an error (\"Align to Key Object isn't available with the Artboard tool\") with the Artboard tool chosen",
),
(
"align.toArtboard",
"Align to Artboard",
"",
"{} the Align panel's Align to Artboard button: Align To becomes Artboard (saved with the preferences, ui.inspect › ui.align_to) and the key object, key guide or key anchor is let go → {alignTo: \"artboard\"}; with the Artboard tool chosen the selected objects keep their key",
),
(
"type.bold",
"Bold",
+1
View File
@@ -4818,6 +4818,7 @@ axis Both И двете
@msg no graphic style `{n}` няма графичен стил `{n}`
@msg no interaction in progress няма текущо взаимодействие
@msg no key object няма основен обект
@msg Align to Key Object isn't available with the Artboard tool „Подравняване спрямо ключов обект“ не е налично с инструмента „Работна област“
@msg no library `{key}` (see {list}) няма библиотека `{key}` (вижте {list})
@msg no native format няма нативен формат
@msg no pages няма страници
Can't render this file because it is too large.
+1
View File
@@ -5231,6 +5231,7 @@ imageTrace Outline Obris
@msg no graphic style `{n}` nema grafičkog stila `{n}`
@msg no interaction in progress nema interakcije u toku
@msg no key object nema ključnog objekta
@msg Align to Key Object isn't available with the Artboard tool „Poravnaj s ključnim objektom“ nije dostupno s alatom radna ploča
@msg no library `{key}` (see {list}) nema biblioteke `{key}` (vidi {list})
@msg no native format nema izvornog formata
@msg no pages nema stranica
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -6396,6 +6396,7 @@ liquify-list-end {0}, {1} {0} i {1}
@msg no history state {v} no hi ha cap estat de l’historial {v}
@msg no interaction in progress no hi ha cap interacció en curs
@msg no key object no hi ha objecte clau
@msg Align to Key Object isn't available with the Artboard tool «Alinea a l’objecte clau» no està disponible amb l’eina de tauler
@msg no library `{id}` no hi ha la biblioteca `{id}`
@msg the library has another item of that kind named `{name}` la biblioteca ja té un altre element d’aquest tipus anomenat `{name}`
@msg no library `{key}` (see {list}) no hi ha la biblioteca `{key}` (vegeu {list})
Can't render this file because it is too large.
+1
View File
@@ -5545,6 +5545,7 @@ liquify-list-end {0}, {1} {0} a {1}
@msg no graphic style `{n}` grafický styl `{n}` neexistuje
@msg no interaction in progress neprobíhá žádná interakce
@msg no key object žádný klíčový objekt
@msg Align to Key Object isn't available with the Artboard tool „Zarovnat ke klíčovému objektu“ není s nástrojem Pracovní plocha k dispozici
@msg no library `{key}` (see {list}) knihovna `{key}` neexistuje (viz {list})
@msg no native format chybí nativní formát
@msg no pages žádné stránky
Can't render this file because it is too large.
+1
View File
@@ -7717,6 +7717,7 @@ imageTrace Outline Kontur
@msg no graphic style `{n}` ingen grafisk stil `{n}`
@msg no interaction in progress ingen interaktion i gang
@msg no key object intet nøgleobjekt
@msg Align to Key Object isn't available with the Artboard tool Juster til nøgleobjekt er ikke tilgængelig med tegnebrætværktøjet
@msg no library `{key}` (see {list}) intet bibliotek `{key}` (se {list})
@msg no native format intet indbygget format
@msg no pages ingen sider
Can't render this file because it is too large.
+1
View File
@@ -5141,6 +5141,7 @@ liquify-list-end {0}, {1} {0} und {1}
@msg no graphic style `{n}` kein Grafikstil `{n}`
@msg no interaction in progress keine Interaktion im Gange
@msg no key object kein Basisobjekt
@msg Align to Key Object isn't available with the Artboard tool „An Basisobjekt ausrichten“ ist mit dem Zeichenflächen-Werkzeug nicht verfügbar
@msg no library `{key}` (see {list}) keine Bibliothek `{key}` (siehe {list})
@msg no native format kein natives Format
@msg no pages keine Seiten
Can't render this file because it is too large.
+1
View File
@@ -5197,6 +5197,7 @@ digits Malayalam Μαλαγιάλαμ
@msg no graphic style `{n}` δεν υπάρχει στυλ γραφικών `{n}`
@msg no interaction in progress δεν υπάρχει αλληλεπίδραση σε εξέλιξη
@msg no key object δεν υπάρχει βασικό αντικείμενο
@msg Align to Key Object isn't available with the Artboard tool η «Στοίχιση ως προς το βασικό αντικείμενο» δεν είναι διαθέσιμη με το εργαλείο πίνακα σχεδίασης
@msg no library `{key}` (see {list}) δεν υπάρχει βιβλιοθήκη `{key}` (δείτε {list})
@msg no native format δεν υπάρχει εγγενής μορφή
@msg no pages δεν υπάρχουν σελίδες
Can't render this file because it is too large.
+1
View File
@@ -5252,6 +5252,7 @@ liquify-list-end {0}, {1} {0}, {1}
@msg no graphic style `{n}` no existe el estilo gráfico `{n}`
@msg no interaction in progress no hay ninguna interacción en curso
@msg no key object no hay objeto clave
@msg Align to Key Object isn't available with the Artboard tool «Alinear con el objeto clave» no está disponible con la herramienta Mesa de trabajo
@msg no library `{key}` (see {list}) no existe la biblioteca `{key}` (consulta {list})
@msg no native format no hay formato nativo
@msg no pages no hay páginas
Can't render this file because it is too large.
+1
View File
@@ -5463,6 +5463,7 @@ liquify-list-end {0}, {1} {0} ja {1}
@msg no graphic style `{n}` ei grafiikkatyyliä `{n}`
@msg no interaction in progress mikään vuorovaikutus ei ole käynnissä
@msg no key object ei avainobjektia
@msg Align to Key Object isn't available with the Artboard tool ”Tasaa avainobjektiin” ei ole käytettävissä piirtoalustatyökalulla
@msg no library `{key}` (see {list}) ei kirjastoa `{key}` (ks. {list})
@msg no native format ei omaa tiedostomuotoa
@msg no pages ei sivuja
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -5211,6 +5211,7 @@ liquify-list-end {0}, {1} {0} et {1}
@msg no graphic style `{n}` aucun style graphique `{n}`
@msg no interaction in progress aucune interaction en cours
@msg no key object aucun objet clé
@msg Align to Key Object isn't available with the Artboard tool L’alignement sur l’objet clé n’est pas disponible avec l’outil Plan de travail
@msg no library `{key}` (see {list}) aucune bibliothèque `{key}` (voir {list})
@msg no native format aucun format natif
@msg no pages aucune page
Can't render this file because it is too large.
+1
View File
@@ -7936,6 +7936,7 @@ liquify-list-end {0}, {1} {0} और {1}
@msg no item at index {from} इंडेक्स {from} पर कोई आइटम नहीं
@msg no item at one of the indices {idx} indices {idx} में से एक पर कोई आइटम नहीं
@msg no key object कोई कुंजी ऑब्जेक्ट नहीं
@msg Align to Key Object isn't available with the Artboard tool आर्टबोर्ड टूल के साथ "मुख्य ऑब्जेक्ट पर संरेखित करें" उपलब्ध नहीं है
@msg no layer कोई लेयर नहीं
@msg no layer {id} (see layer.list) कोई लेयर {id} (layer.list देखें)
@msg no layers to export निर्यात करने के लिए कोई लेयरें नहीं
Can't render this file because it is too large.
+1
View File
@@ -5918,6 +5918,7 @@ liquify-list-end {0}, {1} {0} és {1}
@msg no graphic style `{n}` nincs ilyen grafikai stílus: `{n}`
@msg no interaction in progress nincs folyamatban lévő művelet
@msg no key object nincs kulcsobjektum
@msg Align to Key Object isn't available with the Artboard tool az „Igazítás a kulcsobjektumhoz” nem érhető el a Rajztábla eszközzel
@msg no library `{id}` nincs ilyen könyvtár: `{id}`
@msg the library has another item of that kind named `{name}` a könyvtárban már van egy másik ilyen fajta elem `{name}` néven
@msg no library `{key}` (see {list}) nincs ilyen könyvtár: `{key}` (lásd: {list})
Can't render this file because it is too large.
+1
View File
@@ -4925,6 +4925,7 @@ imageTrace Outline Kontur
@msg no graphic style `{n}` tidak ada gaya grafis `{n}`
@msg no interaction in progress tidak ada interaksi yang berlangsung
@msg no key object tidak ada objek kunci
@msg Align to Key Object isn't available with the Artboard tool Ratakan ke objek kunci tidak tersedia dengan alat artboard
@msg no library `{key}` (see {list}) tidak ada pustaka `{key}` (lihat {list})
@msg no native format tidak ada format asli
@msg no pages tidak ada halaman
Can't render this file because it contains an unexpected character in line 2565 and column 5.
+1
View File
@@ -5278,6 +5278,7 @@ liquify-list-end {0}, {1} {0} e {1}
@msg no graphic style `{n}` nessuno stile grafico `{n}`
@msg no interaction in progress nessuna interazione in corso
@msg no key object nessun oggetto chiave
@msg Align to Key Object isn't available with the Artboard tool «Allinea all'oggetto chiave» non è disponibile con lo strumento Tavola da disegno
@msg no library `{key}` (see {list}) nessuna libreria `{key}` (vedi {list})
@msg no native format nessun formato nativo
@msg no pages nessuna pagina
Can't render this file because it is too large.
+1
View File
@@ -5008,6 +5008,7 @@ variable-list-end {0}, {1} {0}、{1}
@msg no bounds 境界がありません
@msg no current layer 現在のレイヤーがありません
@msg no key object キーオブジェクトが設定されていません
@msg Align to Key Object isn't available with the Artboard tool アートボードツールでは「キーオブジェクトに整列」を使用できません
@msg no previous transform 前回の変形がありません
@msg nothing to align 整列するものがありません
@msg select a clip group クリップグループを選択してください
Can't render this file because it is too large.
+1
View File
@@ -6998,6 +6998,7 @@ font-technology Variable ცვლადი
@msg no graphic style `{n}` გრაფიკული სტილი `{n}` არ არის
@msg no interaction in progress მიმდინარე ურთიერთქმედება არ არის
@msg no key object საკვანძო ობიექტი არ არის
@msg Align to Key Object isn't available with the Artboard tool „საკვანძო ობიექტზე სწორება“ სამუშაო დაფის ხელსაწყოსთან მიუწვდომელია
@msg no library `{key}` (see {list}) ბიბლიოთეკა `{key}` არ არის (იხ. {list})
@msg no native format საკუთარი ფორმატი არ არის
@msg no pages გვერდები არ არის
Can't render this file because it is too large.
+1
View File
@@ -4937,6 +4937,7 @@ variable-list-end {0}, {1} {0} 및 {1}
@msg no bounds 경계가 없습니다
@msg no current layer 현재 레이어가 없습니다
@msg no key object 키 개체가 없습니다
@msg Align to Key Object isn't available with the Artboard tool 아트보드 도구에서는 키 개체에 정렬을 사용할 수 없습니다
@msg no previous transform 이전 변형이 없습니다
@msg nothing to align 정렬할 항목이 없습니다
@msg select a clip group 클립 그룹을 선택하세요
Can't render this file because it is too large.
+1
View File
@@ -5593,6 +5593,7 @@ imageTrace Outline Contour
@msg no graphic style `{n}` geen grafische stijl `{n}`
@msg no interaction in progress geen interactie gaande
@msg no key object geen sleutelobject
@msg Align to Key Object isn't available with the Artboard tool Uitlijnen op sleutelobject is niet beschikbaar met het tekengebied-gereedschap
@msg no library `{key}` (see {list}) geen bibliotheek `{key}` (zie {list})
@msg no native format geen eigen indeling
@msg no pages geen pagina's
Can't render this file because it is too large.
+1
View File
@@ -5362,6 +5362,7 @@ liquify-list-end {0}, {1} {0} i {1}
@msg no graphic style `{n}` brak stylu graficznego `{n}`
@msg no interaction in progress brak trwającej interakcji
@msg no key object brak obiektu kluczowego
@msg Align to Key Object isn't available with the Artboard tool „Wyrównaj do obiektu kluczowego” jest niedostępne z narzędziem Obszar kompozycji
@msg no library `{key}` (see {list}) brak biblioteki `{key}` (patrz {list})
@msg no native format brak formatu natywnego
@msg no pages brak stron
Can't render this file because it is too large.
+1
View File
@@ -4508,6 +4508,7 @@ axis Both Ambos
@msg no graphic style `{n}` nenhum estilo gráfico `{n}`
@msg no interaction in progress nenhuma interação em andamento
@msg no key object nenhum objeto-chave
@msg Align to Key Object isn't available with the Artboard tool Alinhar ao Objeto-Chave não está disponível com a Ferramenta Mesa de Trabalho
@msg no library `{key}` (see {list}) nenhuma biblioteca `{key}` (veja {list})
@msg no native format sem formato nativo
@msg no pages sem páginas
Can't render this file because it is too large.
+1
View File
@@ -5273,6 +5273,7 @@ liquify-list-end {0}, {1} {0} и {1}
@msg no graphic style `{n}` нет графического стиля `{n}`
@msg no interaction in progress нет взаимодействия в процессе
@msg no key object нет ключевого объекта
@msg Align to Key Object isn't available with the Artboard tool «Выровнять по ключевому объекту» недоступно с инструментом «Монтажная область»
@msg no library `{key}` (see {list}) нет библиотеки `{key}` (см. {list})
@msg no native format нет собственного формата
@msg no pages нет страниц
Can't render this file because it is too large.
+1
View File
@@ -5137,6 +5137,7 @@ liquify-list-end {0}, {1} {0} och {1}
@msg no graphic style `{n}` ingen grafisk stil `{n}`
@msg no interaction in progress ingen interaktion pågår
@msg no key object inget nyckelobjekt
@msg Align to Key Object isn't available with the Artboard tool Justera mot nyckelobjekt är inte tillgängligt med ritytsverktyget
@msg no library `{key}` (see {list}) inget bibliotek `{key}` (se {list})
@msg no native format inget eget format
@msg no pages inga sidor
Can't render this file because it is too large.
+1
View File
@@ -4961,6 +4961,7 @@ liquify-list-end {0}, {1} {0} ve {1}
@msg no graphic style `{n}` grafik stili yok `{n}`
@msg no interaction in progress herhangi bir etkileşim devam etmiyor
@msg no key object anahtar nesne yok
@msg Align to Key Object isn't available with the Artboard tool Anahtar Nesneye Hizala, Çalışma Yüzeyi Aracı ile kullanılamaz
@msg no library `{key}` (see {list}) `{key}` kitaplığı yok (bkz. {list})
@msg no native format yerel format yok
@msg no pages sayfa yok
Can't render this file because it is too large.
+1
View File
@@ -5262,6 +5262,7 @@ liquify-list-end {0}, {1} {0} і {1}
@msg no graphic style `{n}` немає графічного стилю `{n}`
@msg no interaction in progress немає взаємодії у процесі
@msg no key object немає ключового об’єкта
@msg Align to Key Object isn't available with the Artboard tool «Вирівняти за ключовим об’єктом» недоступно з інструментом «Монтажна область»
@msg no library `{key}` (see {list}) немає бібліотеки `{key}` (див. {list})
@msg no native format немає власного формату
@msg no pages немає сторінок
Can't render this file because it is too large.
+1
View File
@@ -5611,6 +5611,7 @@ liquify-list-end {0}, {1} {0} và {1}
@msg no graphic style `{n}` không có kiểu đồ họa `{n}`
@msg no interaction in progress không có tương tác nào đang tiến hành
@msg no key object không có đối tượng khóa
@msg Align to Key Object isn't available with the Artboard tool không thể dùng Căn theo đối tượng chính với Công cụ Bảng vẽ
@msg no library `{id}` không có thư viện `{id}`
@msg the library has another item of that kind named `{name}` thư viện đã có một mục khác cùng loại tên là `{name}`
@msg no library `{key}` (see {list}) không có thư viện `{key}` (xem {list})
Can't render this file because it is too large.
+1
View File
@@ -4703,6 +4703,7 @@ imageTrace Outline 轮廓
@msg no bounds 没有边界
@msg no current layer 没有当前图层
@msg no key object 没有关键对象
@msg Align to Key Object isn't available with the Artboard tool 使用画板工具时无法对齐关键对象
@msg no previous transform 没有上一次变换
@msg nothing to align 没有可对齐的内容
@msg select a clip group 请选择一个剪切组
Can't render this file because it is too large.
+1
View File
@@ -2156,6 +2156,7 @@ file-filter Templates 範本
@msg no bounds 沒有邊界
@msg no current layer 沒有目前圖層
@msg no key object 沒有關鍵物件
@msg Align to Key Object isn't available with the Artboard tool 使用工作區域工具時無法對齊關鍵物件
@msg no previous transform 沒有上一次的變形
@msg nothing to align 沒有可對齊的內容
@msg select a clip group 請選取剪裁群組
Can't render this file because it is too large.
+1
View File
@@ -360,6 +360,7 @@ fn run_ui_part4(app: &mut VectorcraftApp, id: &str, _p: &Value) -> Option<Result
let r = match id {
"type.convertListToText" => crate::panels::paragraph::convert_list_to_text(app),
id if let Some(b) = crate::panels::align::button(id) => crate::panels::align::run_button(app, b),
id if let Some(v) = crate::panels::align::align_to_command(id) => crate::panels::align::run_align_to(app, v),
"view.gradientAnnotator" => flag(&mut app.ui.view.gradient_annotator),
"view.livePaintGaps" => flag(&mut app.ui.view.live_paint_gaps),
"effect.last" => match app.last_effect.clone() {
+3
View File
@@ -61,6 +61,8 @@ pub fn checked(app: &VectorcraftApp, id: &str, p: &Value) -> Option<bool> {
// A View › Rotate View item is checked when the active view is turned to its angle; without
// a document no item is checked.
"view.rotate" => app.view().zip(p.get("angle").and_then(Value::as_f64)).is_some_and(|(view, a)| (view.rotation - a).abs() < 1e-9),
// Object › Align's Align To items: the choice the Align panel shows.
id if let Some(v) = crate::panels::align::align_to_command(id) => crate::panels::align::shown_align_to(app) == v,
"window.control" => app.ui.control_bar,
"window.helpBar" => app.ui.help_bar,
"view.statusBarShow" => p.get("show").and_then(Value::as_str) == Some(app.ui.status_bar_show.param()),
@@ -232,6 +234,7 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool {
id if crate::panels::paragraph::ALIGN_COMMANDS.iter().any(|c| c.0 == id) => crate::panels::character::text_style(app).is_some(),
"type.applyBullets" | "type.applyNumbers" | "type.convertListToText" => crate::panels::character::text_style(app).is_some(),
id if let Some(b) = crate::panels::align::button(id) => enabled(app, b.command_now(app)),
id if let Some(v) = crate::panels::align::align_to_command(id) => crate::panels::align::can_choose(app, v),
"file.reveal" => app.services.reveal.is_some() && app.session.active().is_some_and(|d| d.path.is_some()),
"file.cancelExport" | "file.exportInBackground" => app.background.running(crate::background::Kind::Export),
"file.cancelSave" | "file.saveInBackground" => app.background.running(crate::background::Kind::Save),
+5
View File
@@ -164,6 +164,11 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
cp("Vertical Align Top", "object.align", json!({"vertical": "top"})),
cp("Vertical Align Center", "object.align", json!({"vertical": "center"})),
cp("Vertical Align Bottom", "object.align", json!({"vertical": "bottom"})),
Sep,
// The Align panel's Align To choices, checked as the panel shows them.
c("Align to Selection", "align.toSelection"),
c("Align to Key Object", "align.toKeyObject"),
c("Align to Artboard", "align.toArtboard"),
],
),
// The Align panel's Distribute Objects and Distribute Spacing buttons: each item runs
+18
View File
@@ -375,6 +375,24 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{} the Align panel's Horizontal Distribute Space button: object.distributeSpacing {axis: \"horizontal\"} with to: \"key\" while there is a key, else the Align To choice, and spacing: the Distribute Spacing value while there is a key; with the Artboard tool chosen, the artboard command of the same name (artboard.distribute, artboard.distributeSpacing) with the same direction on the artboards the tool has selected, to: \"artboard\" (the active artboard) and spacing: the Distribute Spacing value while Align to Artboard is chosen, else \"selection\"",
),
(
"align.toSelection",
"Align to Selection",
"",
"{} the Align panel's Align to Selection button: Align To becomes Selection (saved with the preferences, ui.inspect › ui.align_to) and the key object, key guide or key anchor is let go → {alignTo: the choice the Align panel then shows: \"selection\", or \"artboard\" while one object is selected, since one object aligns to the artboard}; with the Artboard tool chosen the selected objects keep their key",
),
(
"align.toKeyObject",
"Align to Key Object",
"",
"{} the Align panel's Align to Key Object button: with no key, the topmost of two or more selected objects becomes the key object, or a ruler guide selected with one object the key guide; the stored Selection or Artboard choice stays → {alignTo: \"key\"}; an error (\"no key object\") when there is no key and nothing to make one of, which includes a topmost selected object inside another selected object; an error (\"Align to Key Object isn't available with the Artboard tool\") with the Artboard tool chosen",
),
(
"align.toArtboard",
"Align to Artboard",
"",
"{} the Align panel's Align to Artboard button: Align To becomes Artboard (saved with the preferences, ui.inspect › ui.align_to) and the key object, key guide or key anchor is let go → {alignTo: \"artboard\"}; with the Artboard tool chosen the selected objects keep their key",
),
(
"type.bold",
"Bold",
+55 -15
View File
@@ -329,27 +329,39 @@ fn key_is_anchor(app: &VectorcraftApp) -> bool {
/// The Align To choice that the Align panel and the Control bar show chosen: Artboard while one
/// object is selected (the buttons then align it to the artboard), else [`align_to`]. With the
/// Artboard tool chosen, it is the stored choice, Selection or Artboard.
fn shown_align_to(app: &VectorcraftApp) -> AlignTo {
pub(crate) fn shown_align_to(app: &VectorcraftApp) -> AlignTo {
if on_artboards(app) {
return app.ui.align_to;
}
aligns_to(align_to(app), objects_aligned(app))
}
/// Whether Align To choice `v` can be chosen. Align to Key Object needs a key object or a key
/// guide, or something to make one of: two or more selected objects, or a guide selected with
/// objects. With the Artboard tool chosen it is off: Align to Artboard keeps the active artboard
/// in place.
fn can_choose(app: &VectorcraftApp, v: AlignTo) -> bool {
/// What Align to Key Object makes the key while there is none, as `select.key` params: the topmost
/// of two or more selected objects when no other selected object holds it, or with one object, a
/// ruler guide selected with it. `None`: nothing can be made the key.
fn key_pick(app: &VectorcraftApp) -> Option<Value> {
if selection_len(app) < 2 {
return guide_for_key(app).map(|g| json!({"guide": g}));
}
let id = topmost(app)?;
let st = app.session.active()?;
let inside = st.doc.ancestry(id).unwrap_or_default().into_iter().any(|a| a != id && st.selection.contains(a));
if inside { None } else { Some(json!({"id": id.0})) }
}
/// Whether Align To choice `v` can be chosen. Align to Key Object needs a key object, a key guide
/// or a key anchor, or something to make the key ([`key_pick`]). With the Artboard tool chosen it
/// is off: Align to Artboard keeps the active artboard in place.
pub(crate) fn can_choose(app: &VectorcraftApp, v: AlignTo) -> bool {
if on_artboards(app) {
return v != AlignTo::Key;
}
v != AlignTo::Key || selection_len(app) >= 2 || has_key(app) || guide_for_key(app).is_some()
v != AlignTo::Key || has_key(app) || key_pick(app).is_some()
}
/// Chooses Align To `v`, as the Align panel's Align To buttons and the Control bar's Align To menu
/// do. Align to Key Object makes the topmost selected object the key object, unless there is one
/// already; with one object, a guide selected with it becomes the key. The stored choice stays as
/// do. Align to Key Object makes the key what [`key_pick`] gives, unless there is a key already:
/// the topmost selected object, or with one object, a guide selected with it. The stored choice stays as
/// it was, and Align To shows it again once the key is cleared. Align to Selection and Align to
/// Artboard store the choice and let go of the key object. With the Artboard tool chosen, the
/// choice is stored and the selected objects keep their key.
@@ -362,12 +374,10 @@ pub(crate) fn choose_align_to(app: &mut VectorcraftApp, v: AlignTo) {
return;
}
if v == AlignTo::Key {
if !has_key(app) {
match (topmost(app).filter(|_| selection_len(app) >= 2), guide_for_key(app)) {
(Some(id), _) => app.run("select.key", json!({"id": id.0})).ok(),
(None, Some(g)) => app.run("select.key", json!({"guide": g})).ok(),
(None, None) => None,
};
if !has_key(app)
&& let Some(p) = key_pick(app)
{
app.run("select.key", p).ok();
}
} else {
app.ui.align_to = v;
@@ -377,6 +387,36 @@ pub(crate) fn choose_align_to(app: &mut VectorcraftApp, v: AlignTo) {
}
}
/// The Align To choices as UI commands ([`crate::menus::UI_COMMANDS`]): (command id, choice). Object
/// › Align lists them after its align items, checked as the Align panel shows its choice, and Edit ›
/// Keyboard Shortcuts lists each under Align with no default shortcut.
pub const ALIGN_TO_COMMANDS: [(&str, AlignTo); 3] =
[("align.toSelection", AlignTo::Selection), ("align.toKeyObject", AlignTo::Key), ("align.toArtboard", AlignTo::Artboard)];
/// The Align To choice of UI command `id` ([`ALIGN_TO_COMMANDS`]). `None`: `id` is not one of them.
pub(crate) fn align_to_command(id: &str) -> Option<AlignTo> {
ALIGN_TO_COMMANDS.iter().find(|c| c.0 == id).map(|c| c.1)
}
/// Runs the UI command of Align To choice `v`: chooses it as the Align panel's Align To buttons do
/// ([`choose_align_to`]) → `{alignTo}`, the choice the Align panel then shows. An error when it
/// can't be chosen: Align to Key Object with the Artboard tool chosen, or with no key and nothing
/// to make the key ([`key_pick`]), which includes a topmost selected object inside another
/// selected object.
pub(crate) fn run_align_to(app: &mut VectorcraftApp, v: AlignTo) -> Result<Value, String> {
if v == AlignTo::Key && on_artboards(app) {
return Err("Align to Key Object isn't available with the Artboard tool".into());
}
if !can_choose(app, v) {
return Err("no key object".into());
}
choose_align_to(app, v);
if v == AlignTo::Key && !has_key(app) {
return Err("no key object".into());
}
Ok(json!({"alignTo": shown_align_to(app).param()}))
}
/// The width of the Control bar's Align To menu ([`align_to_menu`]) for buttons `size` points
/// square: the icon of the choice and the arrow after it.
pub(crate) fn align_to_menu_width(size: f32) -> f32 {
+104
View File
@@ -627,6 +627,110 @@ fn object_align_follows_align_to() {
assert_eq!((bounds(&app, &a).x1, bounds(&app, &b).x1), (boards[1].x1, boards[1].x1), "the active artboard's right edge");
}
/// The Align To choices of Object → Align ([`ALIGN_TO_COMMANDS`]), in their order: (command id,
/// label).
const ALIGN_TO_ENTRIES: [(&str, &str); 3] =
[("align.toSelection", "Align to Selection"), ("align.toKeyObject", "Align to Key Object"), ("align.toArtboard", "Align to Artboard")];
/// Which of Object → Align's Align To items are checked, in their order.
fn align_to_checks(app: &VectorcraftApp) -> Vec<Option<bool>> {
ALIGN_TO_ENTRIES.iter().map(|(id, _)| crate::menus::checked(app, id, &json!({}))).collect()
}
/// Object → Align lists the Align To choices after its align items, the one the Align panel shows
/// checked, and a click on one chooses it as the panel's button does. Edit › Keyboard Shortcuts
/// lists each under Align with no default shortcut, and a shortcut chooses it too.
#[test]
fn object_align_lists_the_align_to_choices() {
let (mut app, back, front) = back_and_front();
let items: Vec<(String, Option<String>)> =
crate::menus::menu_entries(&app).into_iter().filter(|e| e.path == ["Object", "Align"]).map(|e| (e.label, e.command)).skip(7).collect();
let expected: Vec<(String, Option<String>)> = ALIGN_TO_ENTRIES.iter().map(|(id, l)| (l.to_string(), Some(id.to_string()))).collect();
assert_eq!(items, expected, "after the seven align items");
assert_eq!(align_to_checks(&app), [Some(true), Some(false), Some(false)]);
object_align(&mut app, "Align to Artboard");
assert_eq!(app.ui.align_to, AlignTo::Artboard);
assert_eq!(align_to_checks(&app), [Some(false), Some(false), Some(true)]);
let list = app.run("shortcuts.list", json!({})).unwrap();
for (id, label) in ALIGN_TO_ENTRIES {
let e = list.as_array().unwrap().iter().find(|e| e["id"] == id).unwrap_or_else(|| panic!("{id} is not listed"));
assert_eq!((e["label"].as_str(), e["group"].as_str(), &e["default"]), (Some(label), Some("Align"), &Value::Null), "{id}");
}
// Align to Key Object by a shortcut: the topmost selected object becomes the key, and the
// stored choice stays.
app.run("shortcuts.set", json!({"id": "align.toKeyObject", "shortcut": CHORD})).unwrap();
press_chord(&mut app);
assert_eq!(app.session.active().unwrap().selection.key.map(|k| k.0), front.as_u64(), "{}", app.ui.status);
assert_eq!(align_to_checks(&app), [Some(false), Some(true), Some(false)]);
assert_eq!(app.ui.align_to, AlignTo::Artboard);
// Align to Selection lets the key go and stores Selection.
assert_eq!(app.run("align.toSelection", json!({})).unwrap(), json!({"alignTo": "selection"}));
assert!(!has_key(&app));
assert_eq!(app.ui.align_to, AlignTo::Selection);
// One object: Align to Key Object is off and fails, and Align To shows Artboard checked.
app.run("select.set", json!({"ids": [back]})).unwrap();
let key_item = crate::menus::menu_entries(&app).into_iter().find(|e| e.command.as_deref() == Some("align.toKeyObject")).unwrap();
assert!(!key_item.enabled, "one object");
assert_eq!(app.run("align.toKeyObject", json!({})).unwrap_err(), "no key object");
assert!(!has_key(&app));
assert_eq!(align_to_checks(&app), [Some(false), Some(false), Some(true)]);
// Align to Selection with one object stores Selection and returns what the panel shows.
assert_eq!(app.run("align.toSelection", json!({})).unwrap(), json!({"alignTo": "artboard"}));
assert_eq!(app.ui.align_to, AlignTo::Selection);
}
/// With the Artboard tool chosen, Align to Key Object is off and fails, and Align to Artboard and
/// Align to Selection store the choice while the selected objects keep their key.
#[test]
fn align_to_commands_with_the_artboard_tool() {
let (mut app, _, front) = back_and_front();
app.run("align.toKeyObject", json!({})).unwrap();
app.select_tool("artboard");
assert!(has_key(&app), "choosing the Artboard tool keeps the key");
let key_item = crate::menus::menu_entries(&app).into_iter().find(|e| e.command.as_deref() == Some("align.toKeyObject")).unwrap();
assert!(!key_item.enabled, "the Artboard tool");
assert_eq!(app.run("align.toKeyObject", json!({})).unwrap_err(), "Align to Key Object isn't available with the Artboard tool");
assert_eq!(app.run("align.toArtboard", json!({})).unwrap(), json!({"alignTo": "artboard"}));
assert_eq!(app.ui.align_to, AlignTo::Artboard);
assert_eq!(align_to_checks(&app), [Some(false), Some(false), Some(true)]);
assert_eq!(app.run("align.toSelection", json!({})).unwrap(), json!({"alignTo": "selection"}));
assert_eq!(app.ui.align_to, AlignTo::Selection);
assert_eq!(align_to_checks(&app), [Some(true), Some(false), Some(false)]);
assert_eq!(app.session.active().unwrap().selection.key.map(|k| k.0), front.as_u64(), "the key stays");
}
/// Align to Key Object is off and fails when the topmost selected object can't be the key: a group
/// selected with an object inside it.
#[test]
fn align_to_key_object_fails_when_the_topmost_object_cannot_be_the_key() {
let (mut app, _, front) = back_and_front();
let group = app.run("object.group", json!({})).unwrap()["id"].clone();
app.run("select.set", json!({"ids": [group, front]})).unwrap();
assert_eq!(app.session.active().unwrap().selection.objects.len(), 2, "the group and its member");
let key_item = crate::menus::menu_entries(&app).into_iter().find(|e| e.command.as_deref() == Some("align.toKeyObject")).unwrap();
assert!(!key_item.enabled, "the topmost object is inside the group");
assert!(!can_choose(&app, AlignTo::Key), "the panel's button is off too");
assert_eq!(app.run("align.toKeyObject", json!({})).unwrap_err(), "no key object");
assert!(!has_key(&app));
}
/// With a key anchor, Object → Align shows Align to Key Object checked under its menu name, and
/// the command keeps the key anchor → `{alignTo: "key"}`.
#[test]
fn align_to_key_object_with_a_key_anchor() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
let id = app.run("path.create", json!({"d": "M100 40 L200 60 L150 160 Z"})).unwrap()["id"].as_u64().unwrap();
app.run("select.anchors", json!({"id": id, "anchors": [[0, 0], [0, 2]], "mode": "set"})).unwrap();
app.run("select.key", json!({"id": id, "anchor": [0, 2]})).unwrap();
assert_eq!(align_to_checks(&app), [Some(false), Some(true), Some(false)]);
let key_item = crate::menus::menu_entries(&app).into_iter().find(|e| e.command.as_deref() == Some("align.toKeyObject")).unwrap();
assert_eq!((key_item.label.as_str(), key_item.enabled), ("Align to Key Object", true));
assert_eq!(app.run("align.toKeyObject", json!({})).unwrap(), json!({"alignTo": "key"}));
let key_anchor = app.session.active().unwrap().selection.key_anchor.map(|(k, a)| (k.0, a));
assert_eq!(key_anchor, Some((id, (0, 2))), "the key anchor stays");
}
/// With anchor points selected, Object → Align sends its params unchanged: two anchor points of
/// one path align to their own bounds with Align to Selection and with Align to Artboard chosen.
#[test]
+13
View File
@@ -7074,6 +7074,19 @@ the Align To choice, and while there is a key object or a key guide they send th
`shortcuts.set {id, shortcut}` gives one a shortcut. The Object › Distribute menu lists the eight Distribute commands,
and each item runs its command.
The Align panel's Align To choices are UI commands too, with no params: `align.toSelection`, `align.toKeyObject` and
`align.toArtboard`. Each chooses what a click on its Align To button chooses and returns `{alignTo}`, the choice the
panel then shows (`align.toSelection` returns `"artboard"` while one object is selected, which aligns to the artboard).
`align.toSelection` and `align.toArtboard` store the choice (`ui.inspect` › `ui.align_to`) and let the key go; with the
Artboard tool chosen they store it and the selected objects keep their key. With no key, `align.toKeyObject` makes the
topmost of two or more selected objects the key object, or a ruler guide selected with one object the key guide, and
keeps the stored choice. It fails with "no key object" when there is nothing to make the key, which includes a topmost
selected object inside another selected object, and with "Align to Key Object isn't available with the Artboard tool"
while the Artboard tool is chosen; its menu item and the panel's button are off in both cases. Object › Align lists the
three after its align items, with the choice the panel shows checked, and Edit › Keyboard Shortcuts lists them under
Align with no default shortcut. While the key is a key anchor, the panel names its choice Align to Key Anchor and the
menu item keeps the name Align to Key Object.
With the Artboard tool chosen, the same buttons and UI commands, and the Control bar's Align and Distribute buttons,
run `artboard.align`, `artboard.distribute` and `artboard.distributeSpacing` on the artboards the tool has selected.
Align To then offers Align to Selection and Align to Artboard. Align to Artboard sends `to: "artboard"`, which keeps the
+1
View File
@@ -1293,6 +1293,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
The Control bar has an Align To menu after its Align buttons. The public documentation offers Align to Selection, Align to Key Object and Align to Artboard in the Control panel (VectorCraft's Control bar) as well as in the Align panel ([Move, align, and distribute objects](https://web.archive.org/web/20250115013546/https://helpx.adobe.com/illustrator/using/moving-aligning-distributing-objects.html)). The menu shows the icon of the choice the Align panel's Align To shows, and a pick sets the same choice as the Align panel's buttons do. Align to Key Object is off while no key object can be made. When the bar runs short of room, it drops the Distribute buttons first, then the Align To menu, then the Align buttons.
Object › Align aligns objects as the align buttons do: it aligns one object to the active artboard whatever Align To is set to, and otherwise it aligns to the key object while there is one, else to the Align To choice, which is saved with the preferences (`ui.inspect` → `ui.align_to`). With direct-selected anchor points, Object › Align aligns the points to their own bounds. While one object is selected, Align To shows Artboard.
Edit › Keyboard Shortcuts lists each of the Align panel's Align Objects, Distribute Objects and Distribute Spacing buttons under Align, with no default shortcut, as the reference app's [release notes](https://web.archive.org/web/20261006170350/https://helpx.adobe.com/illustrator/desktop/new-features/release-notes.html) describe for its Align and Distribute commands. A shortcut set there runs what a click on the button runs, with the Align To choice, the key object and the Distribute Spacing value (`align.horizontalLeft` and the other `align.*` UI commands).
Object › Align lists Align to Selection, Align to Key Object and Align to Artboard after its align items, with the choice the Align panel shows checked, and each sets that choice as the panel's Align To buttons do; Edit › Keyboard Shortcuts lists them under Align with no default shortcut. The public page has shortcuts for the Align commands set under Object › Align ([Align and distribute objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/align-and-distribute-objects.html)); placing the Align To choices there is VectorCraft's own (`align.toSelection`, `align.toKeyObject`, `align.toArtboard`; `panels::align::tests::object_align_lists_the_align_to_choices`).
The command palette lists `select.key` as Cancel Key Object, and a pick cancels the key object (#541).
Agent selection commands validate every object id before changing the selection and report the resulting count and ids (#784).
Commands that act on `id` or else the selection, the highlighted layer row or a new object (`css.export`, `object.isolate`, `layer.locate`, `layer.releaseToLayers`, the graphic, character and paragraph style commands, `image.info`, the `links.*` and `shaper.*` commands that take an `id`, opacity mask editing and viewing, `symbol.edit`, the blend spine commands and `path.curvature`) refuse an `id` that is not an object id (`"abc"`, `"5"`, `true`) and change nothing; `effect.apply` with the effect given as `id` still applies it to the selection.
+1
View File
@@ -233,6 +233,7 @@ tools, never checked side by side) isn't captured row by row.
| Align panel menu › Align to Glyph Bounds › Point Text and Area Text (checked while on): Align and Distribute measure point type or area type by the ink of its glyphs instead of its em box or frame | done | #4231; `alignGlyphBoundsPoint`, `alignGlyphBoundsArea` ([Align text](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/align-text.html)); `tests::glyphbounds`, `panels::align::tests::align_to_glyph_bounds_toggles_point_and_area_text`; the Character and Properties panels' Align to Glyph Bounds controls are not done |
| Align and distribute artboards: with the Artboard tool chosen, the Align panel's Align Objects, Distribute Objects and Distribute Spacing buttons, and the Control bar's, move the selected artboards with the art inside them (Move Artwork with Artboard) | done | `artboard.align`, `artboard.distribute`, `artboard.distributeSpacing` ([Align and distribute artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/align-and-distribute-artboards.html)); VectorCraft's own rules: Align to Artboard keeps the active artboard in place and sends the Distribute Spacing value, Align to Key Object is off, a locked artboard stays where it is; `cmd::artboardalign::tests`, `panels::align::tests::the_align_buttons_align_the_selected_artboards` |
| Object › Distribute, below Object › Align: Horizontal Distribute Left, Center and Right, Vertical Distribute Top, Center and Bottom, Horizontal Distribute Space and Vertical Distribute Space, each running what a click on its Align panel button runs (Align To, the key object, the Distribute Spacing value and, with the Artboard tool chosen, the selected artboards) | done | The `align.distribute*` commands; the public page names Object › Distribute beside Object › Align for the Align and Distribute commands ([Align and distribute objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/align-and-distribute-objects.html)); the items and their order are VectorCraft's own, taken from the Align panel; `menus::tests::object_distribute_runs_the_distribute_buttons` |
| Object › Align's Align to Selection, Align to Key Object and Align to Artboard, after the align items: each sets the Align panel's Align To choice as its button does, the choice the panel shows is checked, and Edit › Keyboard Shortcuts lists them under Align with no default key | done | `align.toSelection`, `align.toKeyObject`, `align.toArtboard`; the public page has shortcuts for the Align commands set under Object › Align ([Align and distribute objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/align-and-distribute-objects.html)); placing the Align To choices there is VectorCraft's own; `panels::align::tests::object_align_lists_the_align_to_choices` |
| A marquee selects the objects whose paths it touches (anchors or segments): drawn inside a filled shape, over a background, it leaves that shape (Preview and Outline) | done | #1103 |
| Click a segment independently of its endpoint anchors; only its direction handles show | done | #1278: hollow endpoint squares, selected edge emphasized; headless egui checked |
| Drag a curved segment to bend it, a straight one to move its anchors | done | |