diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 613d5cd1e3..f182e5229d 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -4165,6 +4165,7 @@ imageTrace Outline Контур to set spacing and orientation за задаване на разстояние и ориентация : : Isolate Selected Group Изолиране на избраната група + Isolate Selected Path Изолиране на избрания път Release Clipping Mask Освобождаване на маска за изрязване Make Compound Path Създаване на съставен път Release Compound Path Освобождаване на съставен път diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index fcc034cd0f..ca6e4c2805 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -880,6 +880,7 @@ Auto Color Automatska boja Automatic Automatski Isolate Selected Group Izoliraj odabranu grupu + Isolate Selected Path Izoliraj odabranu putanju Isolate Selected Object Izoliraj odabrani objekat Exit Isolation Mode Izađi iz načina izolacije Make Clipping Mask Napravi masku isijecanja diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index ac55a78ff4..6745529a76 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -2265,6 +2265,7 @@ digits Malayalam Malaiàlam Isolate Blending Aïlla la fusió Isolate Group Aïlla el grup Isolate Selected Group Aïlla el grup seleccionat + Isolate Selected Path Aïlla el traçat seleccionat Isolate Selected Object Aïlla l’objecte seleccionat Isometric Bottom Isomètrica inferior Isometric Left Isomètrica esquerra diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 69dd46dc23..78fd8a33fe 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -893,6 +893,7 @@ Auto Color Automatická barva Automatic Automaticky Isolate Selected Group Izolovat vybranou skupinu + Isolate Selected Path Izolovat vybranou cestu Isolate Selected Object Izolovat vybraný objekt Exit Isolation Mode Ukončit izolovaný režim Make Clipping Mask Vytvořit ořezovou masku diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 7bc0ed6c94..f118a85fb1 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -3500,6 +3500,7 @@ liquify-list-end {0}, {1} {0} og {1} Auto Color Autofarve Automatic Automatisk Isolate Selected Group Isolér valgt gruppe + Isolate Selected Path Isolér valgt kurve Exit Isolation Mode Afslut isoleringstilstand Make Clipping Mask Opret beskæringsmask Release Clipping Mask Frigør beskæringsmask diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 4b17261bfb..9d419097f5 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -4223,6 +4223,7 @@ imageTrace Outline Kontur to set spacing and orientation legt Abstand und Ausrichtung fest : : Isolate Selected Group Ausgewählte Gruppe isolieren + Isolate Selected Path Ausgewählten Pfad isolieren Isolate Selected Object Ausgewähltes Objekt isolieren Release Clipping Mask Schnittmaske zurückwandeln Make Compound Path Zusammengesetzten Pfad erstellen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index bba8d392ad..a58ed8ffa6 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -4685,6 +4685,7 @@ digits Malayalam Μαλαγιάλαμ “{file}” is protected by a password. Το «{file}» προστατεύεται με κωδικό. ● Recording ● Εγγραφή Isolate Selected Group Απομόνωση επιλεγμένης ομάδας + Isolate Selected Path Απομόνωση επιλεγμένης διαδρομής Make Compound Path Δημιουργία σύνθετης διαδρομής Release Compound Path Αποδέσμευση σύνθετης διαδρομής — substituted by {style} — αντικαταστάθηκε από {style} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 57e7f44e87..141dd029ff 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4310,6 +4310,7 @@ imageTrace Outline Contorno to set spacing and orientation para definir espaciado y orientación : : Isolate Selected Group Aislar grupo seleccionado + Isolate Selected Path Aislar trazado seleccionado Isolate Selected Object Aislar objeto seleccionado Release Clipping Mask Soltar máscara de recorte Make Compound Path Crear trazado compuesto diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 0276e5b6ed..3727e70d0a 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -884,6 +884,7 @@ Auto Color Automaattinen väri Automatic Automaattinen Isolate Selected Group Eristä valittu ryhmä + Isolate Selected Path Eristä valittu polku Exit Isolation Mode Poistu eristystilasta Make Clipping Mask Luo leikkausmaski Release Clipping Mask Vapauta leikkausmaski diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 75f4f14c6f..5dc467965a 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -4295,6 +4295,7 @@ imageTrace Outline Contour to set spacing and orientation pour définir l’espacement et l’orientation :  : Isolate Selected Group Isoler le groupe sélectionné + Isolate Selected Path Isoler le tracé sélectionné Isolate Selected Object Isoler l’objet sélectionné Release Clipping Mask Annuler le masque d’écrêtage Make Compound Path Créer un tracé transparent diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 4eed343e3d..66b0c34756 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -1858,6 +1858,7 @@ Isolate Blending બ્લેન્ડિંગ અલગ કરો Isolate Group ગ્રૂપ અલગ કરો Isolate Selected Group પસંદ કરેલું ગ્રૂપ અલગ કરો + Isolate Selected Path પસંદ કરેલો પાથ અલગ કરો Isolate Selected Object પસંદ કરેલી ઑબ્જેક્ટ અલગ કરો Isometric Bottom આઇસોમેટ્રિક નીચે Isometric Left આઇસોમેટ્રિક ડાબે diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 094d49ce52..8f0fdc050a 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -2508,6 +2508,7 @@ antiAlias Sharp शार्प Isolate Blending ब्लेंडिंग अलग करें Isolate Group अलग समूह Isolate Selected Group सिलेक्टेड समूह अलग करें + Isolate Selected Path सिलेक्टेड पाथ अलग करें Isolate Selected Object सिलेक्टेड ऑब्जेक्ट को अलग करें Isometric Bottom आइसोमेट्रिक बॉटम Isometric Left आइसोमेट्रिक लेफ्ट diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index d5f42ce788..45dfc5ff49 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -2266,6 +2266,7 @@ file-filter Templates Sablonok Isolate Blending Keverés elkülönítése Isolate Group Csoport elkülönítése Isolate Selected Group Kijelölt csoport elkülönítése + Isolate Selected Path Kijelölt útvonal elkülönítése Isolate Selected Object Kijelölt objektum elkülönítése Italian Olasz Italic Dőlt diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index b349f589a5..7fdb069177 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -826,6 +826,7 @@ Auto Color Warna otomatis Automatic Otomatis Isolate Selected Group Isolasi grup terseleksi + Isolate Selected Path Isolasi jalur terseleksi Exit Isolation Mode Keluar dari mode isolasi Make Clipping Mask Buat masker kliping Release Clipping Mask Lepaskan masker kliping diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8bc9d44147..1e53a28a40 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4358,6 +4358,7 @@ imageTrace Outline Contorno to set spacing and orientation per impostare spaziatura e orientamento : : Isolate Selected Group Isola gruppo selezionato + Isolate Selected Path Isola tracciato selezionato Isolate Selected Object Isola oggetto selezionato Release Clipping Mask Rilascia maschera di ritaglio Make Compound Path Crea tracciato composto diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 57c9aee61e..d4d567a7a5 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -950,6 +950,7 @@ digits Malayalam マラヤーラム数字 Auto Color 自動カラー Automatic 自動 Isolate Selected Group 選択したグループを分離 + Isolate Selected Path 選択したパスを分離 Isolate Selected Object 選択したオブジェクトを分離 Exit Isolation Mode 分離モードを終了 Make Clipping Mask クリッピングマスクを作成 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index a661bc0cbb..2c7edbeb3c 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -2874,6 +2874,7 @@ VectorCraft Help… VectorCraft-ის დახმარება… Automatic ავტომატური Isolate Selected Group მონიშნული ჯგუფის იზოლირება + Isolate Selected Path მონიშნული ტრაექტორიის იზოლირება Exit Isolation Mode იზოლაციის რეჟიმიდან გამოსვლა Make Clipping Mask მომჭრელი ნიღბის შექმნა Release Clipping Mask მომჭრელი ნიღბის მოხსნა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 632c2473f8..9dd709e70d 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -943,6 +943,7 @@ digits Malayalam 말라얄람어 Auto Color 자동 색상 Automatic 자동 Isolate Selected Group 선택한 그룹 격리 + Isolate Selected Path 선택한 패스 격리 Isolate Selected Object 선택한 개체 격리 Exit Isolation Mode 격리 모드 종료 Make Clipping Mask 클리핑 마스크 만들기 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 0137b7ac5b..ea154cea46 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1394,6 +1394,7 @@ liquify-list-end {0}, {1} {0} en {1} Auto Color Automatische kleur Automatic Automatisch Isolate Selected Group Geselecteerde groep isoleren + Isolate Selected Path Geselecteerd pad isoleren Exit Isolation Mode Isolatiemodus verlaten Make Clipping Mask Knipmasker maken Release Clipping Mask Knipmasker vrijgeven diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index a2909473c2..83914c9009 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -840,6 +840,7 @@ Auto Color Kolor automatyczny Automatic Automatycznie Isolate Selected Group Izoluj zaznaczoną grupę + Isolate Selected Path Izoluj zaznaczoną ścieżkę Isolate Selected Object Izoluj zaznaczony obiekt Exit Isolation Mode Wyjdź z trybu izolacji Make Clipping Mask Utwórz maskę przycinającą diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 9c7e0fddd5..cbe133e165 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -1573,6 +1573,7 @@ antiAlias Sharp Nítido Isolate Blending Isolar Mesclagem Isolate Group Isolar Grupo Isolate Selected Group Isolar Grupo Selecionado + Isolate Selected Path Isolar Caminho Selecionado Isolate Selected Object Isolar Objeto Selecionado Italian Italiano Join Unir diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 87424a1938..a81dac61aa 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -4343,6 +4343,7 @@ imageTrace Outline Контур to set spacing and orientation для задания интервала и ориентации : : Isolate Selected Group Изолировать выбранную группу + Isolate Selected Path Изолировать выбранный контур Isolate Selected Object Изолировать выбранный объект Release Clipping Mask Освободить маску обрезки Make Compound Path Создать составной контур diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 62ac5b67a8..0edd058df7 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -4227,6 +4227,7 @@ imageTrace Outline Kontur to set spacing and orientation för att ange avstånd och orientering : : Isolate Selected Group Isolera markerad grupp + Isolate Selected Path Isolera markerad bana Release Clipping Mask Släpp klippningsmask Make Compound Path Skapa sammansatt bana Release Compound Path Släpp sammansatt bana diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 9076b8da7c..ec6bb5788f 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -4078,6 +4078,7 @@ imageTrace Outline Kontur to set spacing and orientation aralığı ve yönlendirmeyi ayarlamak için : : Isolate Selected Group Seçili Grubu İzole Et + Isolate Selected Path Seçili Yolu İzole Et Isolate Selected Object Seçili Nesneyi Ayır Release Clipping Mask Kırpma Maskesini Serbest Bırakın Make Compound Path Bileşik Yol Yap diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index c701f1bd5d..ff9f02bd3f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4351,6 +4351,7 @@ imageTrace Outline Контур to set spacing and orientation для завдання інтервалу та орієнтації : : Isolate Selected Group Ізолювати обрану групу + Isolate Selected Path Ізолювати обраний контур Isolate Selected Object Ізолювати обраний об’єкт Release Clipping Mask Звільнити відсічну маску Make Compound Path Створити складений контур diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 7ce09032d1..a067a79ecb 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -2154,6 +2154,7 @@ digits Hindi Hindi Isolate Blending Tách biệt hòa trộn Isolate Group Tách biệt nhóm Isolate Selected Group Tách biệt nhóm đã chọn + Isolate Selected Path Tách biệt đường dẫn đã chọn Isolate Selected Object Tách biệt đối tượng đã chọn Isometric Bottom Đẳng góc dưới Isometric Left Đẳng góc trái diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 86f04f416e..43d8a30a90 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -4188,6 +4188,7 @@ imageTrace Outline 轮廓 to set spacing and orientation 可设置间距与方向 : : Isolate Selected Group 隔离选择的编组 + Isolate Selected Path 隔离选择的路径 Isolate Selected Object 隔离选择的对象 Release Clipping Mask 释放剪切蒙版 Make Compound Path 制作复合路径 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 65e5274812..8aa1e4d676 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5504,6 +5504,7 @@ imageTrace Outline 輪廓 to set spacing and orientation 可設定間距與方向 : : Isolate Selected Group 隔離選取的群組 + Isolate Selected Path 隔離選取的路徑 Isolate Selected Object 隔離選取的物件 Release Clipping Mask 釋放剪裁遮色片 Make Compound Path 製作複合路徑 diff --git a/crates/ui-egui/src/menus/context.rs b/crates/ui-egui/src/menus/context.rs index 68b2a93574..187ce863e4 100644 --- a/crates/ui-egui/src/menus/context.rs +++ b/crates/ui-egui/src/menus/context.rs @@ -55,10 +55,19 @@ pub fn context_items(app: &VectorcraftApp) -> Vec { ]); } else { v.extend([c("Cut", "edit.cut"), c("Copy", "edit.copy"), c("Paste", "edit.paste"), Sep]); + // With one group or compound path selected the menu has Isolate Selected Group, and with + // one path selected (a member of a group or a compound path too) it has Isolate Selected + // Path, as the help page + // (https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=324) + // lists them. Neither shows for an object that `object.isolate` refuses. if let [one] = roots.as_slice() - && one.is_container() + && isolatable(app, &st.doc, one) { - v.push(c("Isolate Selected Group", "object.isolate")); + if one.is_container() { + v.push(c("Isolate Selected Group", "object.isolate")); + } else if matches!(one.kind, NodeKind::Path { .. }) { + v.push(c("Isolate Selected Path", "object.isolate")); + } } if several { v.push(c("Group", "object.group")); @@ -244,6 +253,18 @@ fn artboard_items(app: &VectorcraftApp) -> Vec { v } +/// Does `object.isolate` take `n`? It and every group and layer above it are shown and unlocked +/// (for a Shaper Group, its source group, which is the group isolated), it is not on a locked +/// artboard, it is not a guide path while Lock Guides is on, and while a symbol is edited it is on +/// the symbol's editing layer. A selection set by a command can still hold an object that fails +/// this. +fn isolatable(app: &VectorcraftApp, doc: &vectorcraft_doc::Document, n: &vectorcraft_doc::Node) -> bool { + let target = if n.extras().shaper.is_some() { n.children().and_then(|c| c.first()).map_or(n.id, |c| c.id) } else { n.id }; + doc.is_editable(target) + && !(app.session.guides_locked() && doc.node(target).is_some_and(|t| t.is_guide())) + && doc.symbol_edit.as_ref().is_none_or(|e| doc.ancestry(target).is_some_and(|a| a.contains(&e.layer))) +} + /// `items` without the commands that can't run now (Undo and Redo stay, greyed out), submenus /// left empty, and separators that no longer separate anything. fn prune(app: &VectorcraftApp, items: Vec) -> Vec { diff --git a/crates/ui-egui/src/menus/labels.rs b/crates/ui-egui/src/menus/labels.rs index b8829ac0a2..3fe80167bd 100644 --- a/crates/ui-egui/src/menus/labels.rs +++ b/crates/ui-egui/src/menus/labels.rs @@ -248,6 +248,7 @@ pub const CONTEXT_LABELS: &[&str] = &[ "Add to Dictionary", "No Suggestions", "Isolate Selected Group", + "Isolate Selected Path", "Exit Isolation Mode", "Lock Artboards", "Lock Selected", diff --git a/crates/ui-egui/src/tests/contextmenu.rs b/crates/ui-egui/src/tests/contextmenu.rs index b73bb08dfa..a8a517a03d 100644 --- a/crates/ui-egui/src/tests/contextmenu.rs +++ b/crates/ui-egui/src/tests/contextmenu.rs @@ -248,6 +248,109 @@ fn the_menu_follows_the_selection() { assert!(items.windows(2).all(|w| !matches!(w, [Item::Sep, Item::Sep]))); } +/// The labels of the context menu's isolation items. +fn isolate_labels(app: &VectorcraftApp) -> Vec<&'static str> { + labels(&menus::context_items(app)).into_iter().filter(|l| l.starts_with("Isolate Selected")).collect() +} + +/// One selected path has Isolate Selected Path, which isolates that path. +#[test] +fn single_path_context_item_enters_isolation() { + let mut app = app(); + let a = rect(&mut app, 0.0, 0.0); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + assert_eq!(isolate_labels(&app), ["Isolate Selected Path"]); + let entries = menus::context_entries(&app); + assert!(entries.iter().any(|e| e.command.as_deref() == Some("object.isolate") && e.enabled), "agents see the item"); + menus::invoke(&mut app, "object.isolate", json!({})); + assert_eq!(app.session.active().unwrap().isolation, Some(a), "the path is isolated"); + assert!(labels(&menus::context_items(&app)).contains(&"Exit Isolation Mode")); +} + +/// The isolation item names the kind of the one selected object: a group or a compound path is a +/// group, a path (a group's member too) is a path, and no object or two objects have neither. +#[test] +fn isolation_context_item_follows_selected_kind() { + let mut app = app(); + let (a, b) = (rect(&mut app, 0.0, 0.0), rect(&mut app, 50.0, 50.0)); + app.run("select.none", json!({})).unwrap(); + assert!(isolate_labels(&app).is_empty(), "nothing selected"); + app.run("select.set", json!({"ids": [a.0, b.0]})).unwrap(); + assert!(isolate_labels(&app).is_empty(), "two paths"); + app.run("object.compoundPath.make", json!({})).unwrap(); + assert_eq!(isolate_labels(&app), ["Isolate Selected Group"], "a compound path selected whole"); + let compound = app.session.active().unwrap().selection.objects.clone(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + assert_eq!(app.session.active().unwrap().selection.objects, [a], "a compound path's member selected on its own"); + assert_eq!(isolate_labels(&app), ["Isolate Selected Path"], "a path in a compound path"); + app.run("select.set", json!({"ids": [compound[0].0]})).unwrap(); + app.run("object.compoundPath.release", json!({})).unwrap(); + app.run("select.set", json!({"ids": [a.0, b.0]})).unwrap(); + app.run("object.group", json!({})).unwrap(); + assert_eq!(isolate_labels(&app), ["Isolate Selected Group"], "a group"); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + assert_eq!(app.session.active().unwrap().selection.objects, [a], "a member selected on its own"); + assert_eq!(isolate_labels(&app), ["Isolate Selected Path"], "a path in a group"); + menus::invoke(&mut app, "object.isolate", json!({})); + assert_eq!(app.session.active().unwrap().isolation, Some(a), "the member is isolated"); +} + +/// Neither isolation item shows for an object `object.isolate` refuses, which a selection set by a +/// command can still hold: a hidden or locked object, a path in a locked group, and a guide while +/// guides are locked. +#[test] +fn isolation_context_item_skips_objects_that_cannot_be_isolated() { + let mut app = app(); + let (a, b) = (rect(&mut app, 0.0, 0.0), rect(&mut app, 50.0, 50.0)); + let set = |app: &mut VectorcraftApp, id: NodeId, f: fn(&mut vectorcraft_doc::Node)| { + let st = app.session.doc_mut().unwrap(); + f(std::sync::Arc::make_mut(&mut st.doc).node_mut(id).unwrap()); + st.selection.set([id]); + }; + set(&mut app, a, |n| n.locked = true); + assert!(isolate_labels(&app).is_empty(), "a locked path"); + set(&mut app, a, |n| { + n.locked = false; + n.visible = false; + }); + assert!(isolate_labels(&app).is_empty(), "a hidden path"); + set(&mut app, a, |n| n.visible = true); + assert_eq!(isolate_labels(&app), ["Isolate Selected Path"]); + app.run("select.set", json!({"ids": [a.0, b.0]})).unwrap(); + app.run("object.group", json!({})).unwrap(); + let g = app.session.active().unwrap().selection.objects[0]; + set(&mut app, g, |n| n.locked = true); + assert!(isolate_labels(&app).is_empty(), "a locked group"); + app.session.doc_mut().unwrap().selection.set([a]); + assert!(isolate_labels(&app).is_empty(), "a path in a locked group"); + set(&mut app, g, |n| n.locked = false); + app.run("object.ungroup", json!({})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + app.run("view.guides.make", json!({})).unwrap(); + app.run("view.guides.lock", json!({})).unwrap(); + assert!(app.session.guides_locked()); + app.session.doc_mut().unwrap().selection.set([a]); + assert!(isolate_labels(&app).is_empty(), "a guide while guides are locked"); +} + +/// While a symbol is edited, a path in the symbol's art has Isolate Selected Path, and a path +/// outside it, which a selection set by a command can still hold, has no isolation item. +#[test] +fn isolation_context_item_skips_objects_outside_the_edited_symbol() { + let mut app = app(); + let outside = rect(&mut app, 0.0, 0.0); + rect(&mut app, 200.0, 0.0); + app.run("symbol.new", json!({"name": "Box"})).unwrap(); + app.run("symbol.edit", json!({"name": "Box"})).unwrap(); + assert!(app.session.active().unwrap().doc.symbol_edit.is_some(), "symbol editing mode"); + let inside = rect(&mut app, 100.0, 100.0); + app.session.doc_mut().unwrap().selection.set([inside]); + assert_eq!(isolate_labels(&app), ["Isolate Selected Path"], "a path in the symbol's art"); + app.session.doc_mut().unwrap().selection.set([outside]); + assert!(isolate_labels(&app).is_empty(), "a path outside the symbol's art"); + assert!(app.run("object.isolate", json!({"id": outside.0})).is_err(), "object.isolate refuses it"); +} + /// A closed path of 60 jagged anchors around (150, 150), filled so that a right-click inside it /// hits it, with nothing selected. fn jagged(app: &mut VectorcraftApp) -> NodeId { diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index da8448a72d..11974f800e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1103,6 +1103,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - In the Transform panel, the Properties panel's Transform section and the Control bar, Alt+Enter (Option+Return) applies a value to a copy of the selection and selects the copy, in one undo step. With anchor points selected with Direct Selection it applies the value to them, as Enter does. Ctrl/Cmd+Enter in W or H applies the value and scales the selection proportionally with the link off. With the Artboard tool, it scales the active artboard proportionally. A percentage typed alone in W or H (`50%`) is that share of the size the field shows, and the link and Ctrl/Cmd+Enter keep the proportions as with a length (#2401). - The Control bar's underlined Transform link opens the Transform panel in a popover under it (reference point, X/Y/W/H, Rotate and Shear with their icons and angle presets, flips, shape properties, Scale Corners and Scale Strokes & Effects), as its Stroke link does the Stroke panel; X/Y/W/H also show inline while the bar has room. The reference point locator is nine squares, the outer eight joined around the box. As VectorCraft's own keyboard rule, the locator is one tab stop in the Control bar popover, the Transform panel, the Properties panel and the dialogs, the Arrange Tools dialogs included. While it has the focus it shows an outline, and ←, →, ↑ and ↓ move the reference point one square, stopping at the edges (`the_reference_point_grid_is_one_tab_stop`, `arrow_keys_move_the_reference_point`, `the_reference_point_locator_is_one_tab_stop_and_arrows_move_it`). - In isolation mode the Control bar has an Exit Isolation Mode button (`object.exitIsolation`), except while a pattern is edited. Outside isolation mode, with one group, compound path, path, image, mesh or placed file selected, it has an Isolate Selected Object button (`object.isolate`), which also isolates a path inside a group that Direct Selection selected. + - The canvas context menu has Isolate Selected Path (`object.isolate`) when the selection is one path, a path selected inside a group or a compound path included, as the [help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=324) lists it beside Isolate Selected Group. As VectorCraft's own rule, neither item shows for two or more objects, or for an object `object.isolate` refuses: a hidden or locked object, one in a hidden or locked group or layer, a guide while Lock Guides is on, and, while a symbol is edited, an object outside the symbol's art (`single_path_context_item_enters_isolation`, `isolation_context_item_follows_selected_kind`, `isolation_context_item_skips_objects_that_cannot_be_isolated`). - While an opacity mask is edited, Exit Isolation Mode (Esc, the isolation bar's back arrow, the Control bar's button, and the Layers panel menu's and canvas context menu's Exit Isolation Mode) leaves mask editing as Stop Editing Opacity Mask does, in one undo step: the mask keeps the edits, and the masked object is selected. While a pattern is edited, the Exit Isolation Mode item of the Layers panel menu and of the canvas context menu saves the pattern and leaves pattern editing, as Done does. - A click anywhere on the isolation bar, the isolated object's name included, outside its back arrow, the breadcrumbs of the levels above and its buttons leaves isolation mode altogether, nested isolation included, as Exit Isolation Mode does ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=207)). As VectorCraft's own rules, the click stops editing an opacity mask, leaves symbol editing mode even while a group inside the symbol's art is isolated, together with the isolation the mode was entered from, and does nothing while a pattern is edited; a drag across the bar does not leave (`isolation_bar_background_click_exits_nested_isolation`). - Numeric spinner arrows keep stepping while held with the mouse past the click timeout and stop on release (#6307; `a_held_spinner_arrow_repeats`).