From d04585f6d2e10ea6e77b18e8454f3caf4f265364 Mon Sep 17 00:00:00 2001 From: Zinadin Zidan Date: Fri, 6 Nov 2026 01:34:24 +0600 Subject: [PATCH 01/56] Control bar: Paragraph options while type is selected (#5372) With type selected the Control bar now shows a "Paragraph:" link, which opens the Paragraph panel in a popover as Character: does, and Align left/center/right. The bar now trims strictly from its right end as it narrows: X/Y/W/H, Distribute, object Align, area type's vertical alignment, then the Paragraph buttons, then the link, each group measured. That also stops Align and Distribute running past the bar's edge for other selections. On a 1440 pt bar with one point type object the buttons show. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/chrome/control_bar.rs | 107 +++++++++++--- crates/ui-egui/src/chrome/tests.rs | 47 +++++- crates/ui-egui/src/i18n/bg.tsv | 2 + crates/ui-egui/src/i18n/bs.tsv | 2 + crates/ui-egui/src/i18n/ca.tsv | 2 + crates/ui-egui/src/i18n/cs.tsv | 2 + crates/ui-egui/src/i18n/da.tsv | 2 + crates/ui-egui/src/i18n/de.tsv | 2 + crates/ui-egui/src/i18n/el.tsv | 2 + crates/ui-egui/src/i18n/es.tsv | 2 + crates/ui-egui/src/i18n/fi.tsv | 2 + crates/ui-egui/src/i18n/fr.tsv | 2 + crates/ui-egui/src/i18n/hu.tsv | 2 + crates/ui-egui/src/i18n/id.tsv | 2 + crates/ui-egui/src/i18n/it.tsv | 2 + crates/ui-egui/src/i18n/ja.tsv | 2 + crates/ui-egui/src/i18n/ka.tsv | 2 + crates/ui-egui/src/i18n/ko.tsv | 2 + crates/ui-egui/src/i18n/nl.tsv | 2 + crates/ui-egui/src/i18n/pl.tsv | 2 + crates/ui-egui/src/i18n/pt-br.tsv | 2 + crates/ui-egui/src/i18n/ru.tsv | 2 + crates/ui-egui/src/i18n/sv.tsv | 2 + crates/ui-egui/src/i18n/tr.tsv | 2 + crates/ui-egui/src/i18n/uk.tsv | 2 + crates/ui-egui/src/i18n/vi.tsv | 2 + crates/ui-egui/src/i18n/zh-hans.tsv | 2 + crates/ui-egui/src/i18n/zh-hant.tsv | 2 + crates/ui-egui/src/panels/paragraph.rs | 54 ++++++- crates/ui-egui/src/panels/paragraph/tests.rs | 147 +++++++++++++++++++ crates/ui-egui/src/panels/transform.rs | 13 +- crates/ui-egui/src/widgets.rs | 2 +- crates/ui-egui/src/widgets/labels.rs | 6 + docs/target-app-parity.md | 7 +- docs/ui-parity.md | 4 +- 35 files changed, 410 insertions(+), 29 deletions(-) diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index 018a4e2d94..88cc6dde0b 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -172,13 +172,95 @@ fn inline_label(t: &Tokens, lbl: &str) -> egui::RichText { /// language, the four fields, the W/H link and the item spacing ahead of each of them. With less, /// only the Transform link shows. fn inline_transform_width(ui: &Ui, t: &Tokens) -> f32 { - let measure = |text: egui::WidgetText| text.into_galley(ui, Some(egui::TextWrapMode::Extend), f32::INFINITY, egui::TextStyle::Body).size().x; - let labels: f32 = INLINE_FIELDS.iter().map(|(_, lbl)| measure(inline_label(t, lbl).into())).sum(); + let labels: f32 = INLINE_FIELDS.iter().map(|(_, lbl)| widgets::text_width(ui, inline_label(t, lbl))).sum(); let fields = INLINE_FIELD_WIDTH * INLINE_FIELDS.len() as f32; let items = 2 * INLINE_FIELDS.len() + 1; labels + fields + crate::panels::transform::CONSTRAIN_LINK_SIZE + ui.spacing().item_spacing.x * items as f32 } +/// The size of the Control bar's Align, Distribute and area type vertical alignment buttons. +const BUTTON: f32 = 24.0; + +/// The space ahead of the separator that ends a group of the Control bar's controls. +const GROUP_GAP: f32 = 4.0; + +/// The width of the separators of the Control bar's [`group_end`] and ahead of the Transform link. +const SEPARATOR: f32 = 6.0; + +/// The widths of the Document Setup and Preferences buttons, shown with nothing selected. +const DOCUMENT_SETUP_WIDTH: f32 = 112.0; +const PREFERENCES_WIDTH: f32 = 90.0; + +/// The room `n` of the bar's buttons take, with the spacing after each. +fn buttons_width(ui: &Ui, n: usize) -> f32 { + (BUTTON + ui.spacing().item_spacing.x) * n as f32 +} + +/// The separator that ends a group of the Control bar's controls, as [`group_end_width`] measures it. +fn group_end(ui: &mut Ui) { + ui.add_space(GROUP_GAP); + separator(ui); +} + +fn group_end_width(ui: &Ui) -> f32 { + GROUP_GAP + separator_width(ui) +} + +/// A separator [`SEPARATOR`] wide. +fn separator(ui: &mut Ui) { + ui.add(egui::Separator::default().spacing(SEPARATOR)); +} + +fn separator_width(ui: &Ui) -> f32 { + SEPARATOR + ui.spacing().item_spacing.x +} + +/// The room the controls at the end of the Control bar need: the Transform link, or Document Setup +/// and Preferences with nothing selected. The groups ahead of them (the Paragraph section, area +/// type's vertical alignment, the Align and Distribute buttons) show only while it is left, so +/// the bar trims them from its right end (#5372), after the inline X/Y/W/H fields. +fn end_width(ui: &Ui, nothing_selected: bool) -> f32 { + if nothing_selected { DOCUMENT_SETUP_WIDTH + ui.spacing().item_spacing.x + PREFERENCES_WIDTH } else { crate::panels::transform::link_width(ui) } +} + +/// Draws the Control bar's groups between its Character controls and the Transform link, and +/// returns whether the Transform link and X/Y/W/H follow (false: nothing is selected, and Document +/// Setup and Preferences, drawn here, end the bar). The groups are the Paragraph section and area +/// type's vertical alignment (#3759), then the Align buttons and, for two or more objects, the +/// Distribute buttons (a single object keeps the bar as it was); each shows only while the end of +/// the bar keeps its room. +fn groups_before_transform(app: &mut VectorcraftApp, ui: &mut Ui, objects: usize) -> bool { + let nothing = objects == 0; + if crate::panels::paragraph::control_bar(app, ui, BUTTON, |ui| group_end_width(ui) + end_width(ui, nothing)) { + group_end(ui); + } + if crate::panels::properties::vertical_align::shown(app).is_some() + && ui.available_width() >= buttons_width(ui, 4) + group_end_width(ui) + end_width(ui, nothing) + && crate::panels::properties::vertical_align::buttons(app, ui, BUTTON) + { + group_end(ui); + } + if nothing { + if widgets::flat_button(ui, tl!("Document Setup"), DOCUMENT_SETUP_WIDTH).clicked() { + app.run("file.documentSetup", json!({})).ok(); + } + if widgets::flat_button(ui, tl!("Preferences"), PREFERENCES_WIDTH).clicked() { + app.run("edit.preferences", json!({})).ok(); + } + return false; + } + let end = separator_width(ui) + end_width(ui, false); + if ui.available_width() >= buttons_width(ui, 7) + end { + crate::panels::align::align_buttons(app, ui, BUTTON); + if objects > 1 && ui.available_width() >= GROUP_GAP + buttons_width(ui, 6) + end { + ui.add_space(GROUP_GAP); + crate::panels::align::distribute_buttons(app, ui, BUTTON); + } + separator(ui); + } + true +} + /// The Control bar (Window → Control), context-sensitive like Illustrator's. pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); @@ -283,28 +365,9 @@ pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui) { } ui.separator(); crate::panels::character::control_bar(app, ui); - // Area type: its vertical alignment in the frame (#3759). - if crate::panels::properties::vertical_align::buttons(app, ui, 24.0) { - ui.add_space(4.0); - ui.separator(); - } - if sel.is_empty() { - if widgets::flat_button(ui, tl!("Document Setup"), 112.0).clicked() { - app.run("file.documentSetup", json!({})).ok(); - } - if widgets::flat_button(ui, tl!("Preferences"), 90.0).clicked() { - app.run("edit.preferences", json!({})).ok(); - } + if !groups_before_transform(app, ui, sel.len()) { return; } - crate::panels::align::align_buttons(app, ui, 24.0); - // Two or more objects get the six Distribute Objects buttons too; a single - // object keeps the bar as it was. - if sel.len() > 1 { - ui.add_space(4.0); - crate::panels::align::distribute_buttons(app, ui, 24.0); - } - ui.separator(); // The Transform link opens the whole Transform panel (reference point, rotate, // shear, options) in a popover; X/Y/W/H follow inline while the bar has room. crate::panels::transform::link(app, ui); diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index 710f3ba0c0..86a85699d9 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -1939,7 +1939,8 @@ fn the_control_bar_shows_the_global_edit_options() { /// At any width the Control bar shows the inline X, Y, W and H fields whole inside its right margin, /// or leaves all four out and keeps the Transform link; a wider bar never leaves them out once a -/// narrower one showed them. +/// narrower one showed them. The Align buttons, and for two objects the Distribute buttons, are +/// trimmed the same way ahead of the Transform link (#5372). #[test] fn the_control_bar_shows_the_inline_transform_fields_only_when_they_fit() { crate::i18n::set_current(crate::i18n::Lang::EN); @@ -1954,6 +1955,33 @@ fn the_control_bar_shows_the_inline_transform_fields_only_when_they_fit() { ctx.enable_accesskit(); crate::theme::install_fonts(&ctx); let mut seen = false; + // The Align group, then for two objects the Distribute group (#5372): each by its controls. + let mut groups: Vec<(&str, Vec<&str>)> = vec![( + "Align", + vec![ + "Horizontal Align Left", + "Horizontal Align Center", + "Horizontal Align Right", + "Horizontal & Vertical Align Center", + "Vertical Align Top", + "Vertical Align Center", + "Vertical Align Bottom", + ], + )]; + if count == 2 { + groups.push(( + "Distribute", + vec![ + "Vertical Distribute Top", + "Vertical Distribute Center", + "Vertical Distribute Bottom", + "Horizontal Distribute Left", + "Horizontal Distribute Center", + "Horizontal Distribute Right", + ], + )); + } + let mut groups_seen = vec![false; groups.len()]; for width in (600..=2400).step_by(10) { let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(width as f32, 300.0)); let mut nodes = Vec::new(); @@ -1980,7 +2008,24 @@ fn the_control_bar_shows_the_inline_transform_fields_only_when_they_fit() { } assert!(!seen || fields[3].is_some(), "{count} objects, {width}: left out after a narrower bar showed them"); seen |= fields[3].is_some(); + // The Align and Distribute buttons show whole inside the margin, with the Transform + // link after them, or are left out; once shown, a wider bar keeps them. + let end = |name: &str| nodes.iter().find(|(_, n)| n.label() == Some(name)).and_then(|(_, n)| n.bounds()).map(|b| b.x1); + let inside = |x: f64| x <= f64::from(width) - 10.0; + for ((group, names), was) in groups.iter().zip(groups_seen.iter_mut()) { + let ends: Vec> = names.iter().map(|n| end(n)).collect(); + let shown = ends.iter().all(Option::is_some); + assert!(shown || ends.iter().all(Option::is_none), "{count} objects, {width}: {group} {ends:?}"); + if let Some(Some(last)) = ends.last() { + assert!(inside(*last), "{count} objects, {width}: {group} ends at {last}"); + let transform = end("Transform"); + assert!(transform.is_some_and(inside), "{count} objects, {width}: Transform after {group} ends at {transform:?}"); + } + assert!(!*was || shown, "{count} objects, {width}: {group} left out after a narrower bar showed it"); + *was |= shown; + } } assert!(seen, "{count} objects: a wide bar has room for the fields"); + assert!(groups_seen.iter().all(|s| *s), "{count} objects: a wide bar shows every group: {groups_seen:?}"); } } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index a40240ba42..28bc3eff53 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3207,7 +3207,9 @@ digits Malayalam Малаялам Patterns Мостри Stroke Options Опции на щриха Character: Знак: + Paragraph: Абзац: Character options Опции на знака + Paragraph options Опции за абзац Stroke options Опции на щриха Transform options Опции за трансформации Stroke Weight Дебелина на щриха diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index a2464b8831..eb2b821a35 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -1469,7 +1469,9 @@ digits Malayalam Malajalam Standard Vertical Roman Alignment Standardno okomito latinično poravnanje Strikethrough Precrtano Character: Znak: + Paragraph: Pasus: Character options Opcije znakova + Paragraph options Opcije pasusa Subscript Indeks Subscript (on the roadmap) Indeks (u planu) Superscript Eksponent diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index fe905d5acf..847243b715 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -615,12 +615,14 @@ Character Alignment Alineació de caràcters Character Direction Direcció de caràcters Character options Opcions de caràcter + Paragraph options Opcions de paràgraf Character Rotation Rotació de caràcters Character Set: Joc de caràcters: Character Style Estil de caràcter Character Style Options Opcions de l’estil de caràcter Character Styles Estils de caràcter Character: Caràcter: + Paragraph: Paràgraf: Charcoal Carbó Charcoal… Carbó… Check an artboard to save. Marca un tauler per desar. diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 8231ee0f62..2de11a60c8 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -1493,7 +1493,9 @@ digits Malayalam Malajálamské Standard Vertical Roman Alignment Standardní svislé zarovnání latinky Strikethrough Přeškrtnutí Character: Znak: + Paragraph: Odstavec: Character options Možnosti znaků + Paragraph options Možnosti odstavce Subscript Dolní index Subscript (on the roadmap) Dolní index (v plánu) Superscript Horní index diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 1375be430b..9db09ea0f8 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1403,7 +1403,9 @@ digits Malayalam Malayalam Standard Vertical Roman Alignment Standard lodret romersk justering Strikethrough Gennemstreget Character: Tegn: + Paragraph: Afsnit: Character options Tegnindstillinger + Paragraph options Afsnitsindstillinger Subscript Sænket skrift Subscript (on the roadmap) Sænket skrift (på vejkortet) Superscript Hævet skrift diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index acc8fad4f4..e17e50261b 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3252,7 +3252,9 @@ effect Points Punkte Patterns Muster Stroke Options Konturoptionen Character: Zeichen: + Paragraph: Absatz: Character options Zeichenoptionen + Paragraph options Absatzoptionen Stroke options Konturoptionen Transform options Transformationsoptionen Stroke Weight Konturstärke diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 56467eee23..80a49e899b 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -1991,6 +1991,7 @@ font-technology Variable Μεταβλητές Patterns Μοτίβα Stroke Options Επιλογές περιγράμματος Character: Χαρακτήρας: + Paragraph: Παράγραφος: Stroke: Περίγραμμα: Style Στυλ Style: Στυλ: @@ -3655,6 +3656,7 @@ digits Malayalam Μαλαγιάλαμ Stray Points Μεμονωμένα σημεία Stroke (X), double-click for the Color Picker Περίγραμμα (X), διπλό κλικ για επιλογέα χρώματος Character options Επιλογές χαρακτήρων + Paragraph options Επιλογές παραγράφου Stroke options Επιλογές περιγράμματος Transform options Επιλογές μετασχηματισμού Stroke Weight Πάχος περιγράμματος diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 7f803f4682..bcd4fe12f9 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3291,7 +3291,9 @@ digits Malayalam Malayálam Patterns Motivos Stroke Options Opciones de trazo Character: Carácter: + Paragraph: Párrafo: Character options Opciones de carácter + Paragraph options Opciones de párrafo Stroke options Opciones de trazo Transform options Opciones de transformación Stroke Weight Grosor de trazo diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 899e4b14a5..fde2becd0b 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1466,7 +1466,9 @@ digits Malayalam Malajalam Standard Vertical Roman Alignment Tavallinen pystysuuntainen latinalainen tasaus Strikethrough Yliviivaus Character: Merkki: + Paragraph: Kappale: Character options Merkkiasetukset + Paragraph options Kappaleasetukset Subscript Alaindeksi Subscript (on the roadmap) Alaindeksi (suunnitteilla) Superscript Yläindeksi diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index ba0a972278..4a3eb1ce03 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3283,7 +3283,9 @@ digits Malayalam Malayalam Patterns Motifs Stroke Options Options de contour Character: Caractère : + Paragraph: Paragraphe : Character options Options de caractère + Paragraph options Options de paragraphe Stroke options Options de contour Transform options Options de transformation Stroke Weight Épaisseur du contour diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 9a0724c155..f21ca0d499 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -554,12 +554,14 @@ font-technology Variable Változó Character / Paragraph Karakter / bekezdés Character Alignment Karakterigazítás Character options Karakterbeállítások + Paragraph options Bekezdésbeállítások Character Rotation Karakterforgatás Character Set: Karakterkészlet: Character Style Karakterstílus Character Style Options Karakterstílus beállításai Character Styles Karakterstílusok Character: Karakter: + Paragraph: Bekezdés: Check Links Csatolások ellenőrzése # Check Script (File › Scripts) and the report it shows on a script written for the reference app. Check Script Szkript ellenőrzése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 00fc62d15d..0a6c910fcb 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -1403,7 +1403,9 @@ digits Malayalam Malayalam Standard Vertical Roman Alignment Perataan Romawi vertikal standar Strikethrough Coret Character: Karakter: + Paragraph: Paragraf: Character options Opsi karakter + Paragraph options Opsi paragraf Subscript Subskrip Subscript (on the roadmap) Subskrip (masih dalam roadmap) Superscript Superskrip diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index ccff8235fe..68c1f23fb0 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3327,7 +3327,9 @@ digits Malayalam Malayalam Patterns Motivi Stroke Options Opzioni traccia Character: Carattere: + Paragraph: Paragrafo: Character options Opzioni carattere + Paragraph options Opzioni di paragrafo Stroke options Opzioni traccia Transform options Opzioni di trasformazione Stroke Weight Spessore traccia diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 294240791c..e230d5767a 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3090,7 +3090,9 @@ mark-style Japanese 日本式 Strikethrough 打ち消し線 Stroke Options 線オプション Character: 文字: + Paragraph: 段落: Character options 文字オプション + Paragraph options 段落オプション Stroke options 線オプション Transform options 変形オプション Stroke: 線: diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 9da177b997..32293dd8ec 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1329,7 +1329,9 @@ digits Malayalam მალაიალამური Standard Vertical Roman Alignment სტანდარტული ვერტიკალური ლათინური სწორება Strikethrough გადახაზული Character: სიმბოლო: + Paragraph: აბზაცი: Character options სიმბოლოს პარამეტრები + Paragraph options აბზაცის პარამეტრები Subscript ქვედა ინდექსი Subscript (on the roadmap) ქვედა ინდექსი (სამომავლო გეგმაშია) Superscript ზედა ინდექსი diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 5c215668c5..6279635559 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3079,7 +3079,9 @@ mark-style Japanese 일본식 Strikethrough 취소선 Stroke Options 선 옵션 Character: 문자: + Paragraph: 단락: Character options 문자 옵션 + Paragraph options 단락 옵션 Stroke options 선 옵션 Transform options 변형 옵션 Stroke: 선: diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 300fb3de19..7b670288ee 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -1417,7 +1417,9 @@ digits Malayalam Malayalam Standard Vertical Roman Alignment Standaard verticale Romeinse uitlijning Strikethrough Doorhalen Character: Teken: + Paragraph: Alinea: Character options Tekenopties + Paragraph options Alineaopties Subscript Subscript Subscript (on the roadmap) Subscript (op de roadmap) Superscript Superscript diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 197f6b9d63..759ad22a2e 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -1406,7 +1406,9 @@ digits Malayalam Malajalam Standard Vertical Roman Alignment Standardowe pionowe wyrównanie łacińskie Strikethrough Przekreślenie Character: Znak: + Paragraph: Akapit: Character options Opcje znaków + Paragraph options Opcje akapitu Subscript Indeks dolny Subscript (on the roadmap) Indeks dolny (w planach) Superscript Indeks górny diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 3a9a0c7f85..da5ac46f99 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2748,7 +2748,9 @@ digits Malayalam Malaiala Stroke Options Opções de Traçado Stroke Weight Peso do Traçado Character: Caractere: + Paragraph: Parágrafo: Character options Opções de caractere + Paragraph options Opções de parágrafo Stroke options Opções de traçado Transform options Opções de transformação Stroke: Traçado: diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 3a717f6767..ec85062074 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3322,7 +3322,9 @@ digits Malayalam Малаялам Patterns Узоры Stroke Options Параметры обводки Character: Символ: + Paragraph: Абзац: Character options Параметры символа + Paragraph options Параметры абзаца Stroke options Параметры обводки Transform options Параметры трансформирования Stroke Weight Толщина обводки diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 839596958c..2baf46b448 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3213,7 +3213,9 @@ digits Malayalam Malayalam Patterns Mönster Stroke Options Konturalternativ Character: Tecken: + Paragraph: Stycke: Character options Teckenalternativ + Paragraph options Styckealternativ Stroke options Konturalternativ Transform options Transformeringsalternativ Stroke Weight Konturtjocklek diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f84137f801..312e6163bf 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3115,7 +3115,9 @@ digits Malayalam Malayalam Patterns Desenler Stroke Options Kontur Seçenekleri Character: Karakter: + Paragraph: Paragraf: Character options Karakter seçenekleri + Paragraph options Paragraf seçenekleri Stroke options Kontur seçenekleri Transform options Dönüştürme seçenekleri Stroke Weight Kontur Kalınlığı diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 2577238467..47075bd0e9 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3320,7 +3320,9 @@ effect Points Точки Patterns Візерунки Stroke Options Параметри обведення Character: Символ: + Paragraph: Абзац: Character options Параметри символу + Paragraph options Параметри абзацу Stroke options Параметри обведення Transform options Параметри трансформування Stroke Weight Товщина обведення diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index cad18a0d6f..2e9f19d380 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -468,12 +468,14 @@ font-technology Variable Biến thiên Character / Paragraph Ký tự / Đoạn văn Character Alignment Căn chỉnh ký tự Character options Tùy chọn ký tự + Paragraph options Tùy chọn đoạn văn Character Rotation Xoay ký tự Character Set: Bộ ký tự: Character Style Kiểu ký tự Character Style Options Tùy chọn kiểu ký tự Character Styles Các kiểu ký tự Character: Ký tự: + Paragraph: Đoạn văn: Check Links Kiểm tra liên kết # Check Script (File › Scripts) and the report it shows on a script written for the reference app. Check Script Kiểm tra script diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index e0030aa393..65c01ada87 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3158,7 +3158,9 @@ digits Malayalam 马拉雅拉姆数字 Patterns 图案 Stroke Options 描边选项 Character: 字符: + Paragraph: 段落: Character options 字符选项 + Paragraph options 段落选项 Stroke options 描边选项 Transform options 变换选项 Stroke Weight 描边粗细 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 36e562b2ea..2fe1e1872a 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4185,7 +4185,9 @@ digits Malayalam 馬來亞拉姆數字 Patterns 圖樣 Stroke Options 筆畫選項 Character: 字元: + Paragraph: 段落: Character options 字元選項 + Paragraph options 段落選項 Stroke options 筆畫選項 Transform options 變形選項 Stroke Weight 筆畫寬度 diff --git a/crates/ui-egui/src/panels/paragraph.rs b/crates/ui-egui/src/panels/paragraph.rs index 66f907f92a..8cb29ef305 100644 --- a/crates/ui-egui/src/panels/paragraph.rs +++ b/crates/ui-egui/src/panels/paragraph.rs @@ -380,14 +380,66 @@ fn selected_alignment(app: &VectorcraftApp, fallback: &ParaStyle) -> Option), and +/// its alignment buttons align text as the Paragraph panel's do +/// (). The bar keeps to the three that +/// don't justify, for its room; all seven are in the Paragraph options the link opens. +const CONTROL_BAR_ALIGNMENTS: usize = 3; + +/// The spacing between the Control bar's alignment buttons, as in the Paragraph panel's row. +const CONTROL_BAR_BUTTON_SPACING: f32 = 3.0; + +/// The width of the Paragraph panel in the Control bar's popover, as the Character panel's. +const CONTROL_BAR_POPOVER_WIDTH: f32 = 260.0; + +/// The Control bar's Paragraph link, as it is drawn and measured. +fn control_bar_link_text(ui: &Ui) -> egui::RichText { + egui::RichText::new(tl!("Paragraph:")).size(12.0).color(Tokens::get(ui.ctx()).text).underline() +} + +/// The Control bar's paragraph controls while type is selected or edited (#5372), after its +/// Character controls: the Paragraph link, which opens the Paragraph panel in a popover under it, +/// and the Align left, Align center and Align right buttons, `size` points square as the bar's others. `reserve` gives the room the controls +/// after them keep, asked only when type is selected: short of room, the buttons are left out, +/// then the link too. Returns whether the link shows. +pub(crate) fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui, size: f32, reserve: impl FnOnce(&Ui) -> f32) -> bool { + let Some((_, para)) = text_style(app) else { return false }; + let text = control_bar_link_text(ui); + let link_width = widgets::text_width(ui, text.clone()); + let room = ui.available_width() - reserve(ui); + let link_room = link_width + ui.spacing().item_spacing.x; + if room < link_room { + return false; + } + let link = ui.link(text).on_hover_text(tl!("Paragraph options")); + widgets::popover(&link, link.clicked(), |ui| { + ui.set_width(CONTROL_BAR_POPOVER_WIDTH); + show(app, ui); + }); + if room >= link_room + (size + CONTROL_BAR_BUTTON_SPACING) * CONTROL_BAR_ALIGNMENTS as f32 { + let spacing = ui.spacing().item_spacing.x; + ui.spacing_mut().item_spacing.x = CONTROL_BAR_BUTTON_SPACING; + first_alignment_buttons(app, ui, ¶, size, CONTROL_BAR_ALIGNMENTS); + ui.spacing_mut().item_spacing.x = spacing; + } + true +} + /// Type › Bullets and Numbering › Apply Bullets (`type.applyBullets {bullet?}`): the paragraphs of /// the selected type, or those the Type tool's selection touches, become a bulleted list with /// `bullet`; without it, a list keeps its bullet and other paragraphs take the dot. diff --git a/crates/ui-egui/src/panels/paragraph/tests.rs b/crates/ui-egui/src/panels/paragraph/tests.rs index 163427da5a..0423bc0c95 100644 --- a/crates/ui-egui/src/panels/paragraph/tests.rs +++ b/crates/ui-egui/src/panels/paragraph/tests.rs @@ -543,3 +543,150 @@ fn reset_panel_resets_the_hyphenation_options() { assert_eq!(serde_json::to_value(¶).unwrap().get("justification"), None, "saves no justification options"); } } + +type Nodes = Vec<(egui::accesskit::NodeId, egui::accesskit::Node)>; + +/// An English context for headless Control bar frames, with AccessKit on to find its controls. +fn control_bar_ctx() -> egui::Context { + crate::i18n::set_current(crate::i18n::Lang::EN); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + ctx +} + +/// A document with the type `texts` (`text.create` params) makes, all of it selected. +fn control_bar_app(texts: &[Value]) -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 800, "height": 400})).unwrap(); + let ids: Vec = texts.iter().map(|p| app.run("text.create", p.clone()).unwrap()["id"].clone()).collect(); + app.run("select.set", json!({ "ids": ids })).unwrap(); + app +} + +/// The second of two headless frames of the whole Control bar, `width` wide (the first lays it out). +fn control_bar_nodes(ctx: &egui::Context, app: &mut VectorcraftApp, width: f32, events: Vec) -> Nodes { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, vec2(width, 300.0)); + let mut nodes = Vec::new(); + for events in [events, vec![]] { + let mut out = + ctx.run_ui(egui::RawInput { events, screen_rect: Some(screen), ..Default::default() }, |ui| crate::chrome::control_bar(app, ui)); + out.textures_delta.clear(); + nodes = out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default(); + } + nodes +} + +/// The control named `name` (a button's or link's label, a label's text). +fn control_bar_node(nodes: &Nodes, name: &str) -> Option { + nodes.iter().find(|(_, n)| n.label() == Some(name) || n.value() == Some(name)).map(|(_, n)| n.clone()) +} + +/// Where the control named `name` ends, if it shows. +fn control_bar_end(nodes: &Nodes, name: &str) -> Option { + control_bar_node(nodes, name).and_then(|n| n.bounds()).map(|b| b.x1) +} + +/// The Control bar's Paragraph alignment buttons. +const BAR_ALIGNMENTS: [&str; 3] = ["Align left", "Align center", "Align right"]; + +/// #5372: with type selected, the Control bar shows a Paragraph section after the Character one, as +/// the public documentation's Control panel does: a Paragraph: link that opens the Paragraph panel +/// in a popover under it, and the Align left, Align center and Align right buttons. A click aligns +/// the selected type, and the button of its alignment shows selected. The buttons show on a bar of +/// common window widths. +#[test] +fn the_control_bar_shows_the_paragraph_alignment_of_the_selected_type() { + let ctx = control_bar_ctx(); + let mut app = control_bar_app(&[json!({"x": 20, "y": 50, "text": "Point"})]); + // Pinned, so that the room the buttons need can't creep up past common window widths. + for width in [1440.0, 1920.0] { + let nodes = control_bar_nodes(&ctx, &mut app, width, vec![]); + let ends = BAR_ALIGNMENTS.map(|n| control_bar_end(&nodes, n)); + assert!(ends.iter().all(|e| e.is_some_and(|x| x <= f64::from(width) - 10.0)), "pinned: the buttons show on a {width} pt window: {ends:?}"); + } + let width = 1920.0; + let nodes = control_bar_nodes(&ctx, &mut app, width, vec![]); + let center = |n: &egui::accesskit::Node| { + let b = n.bounds().unwrap_or_else(|| panic!("{n:?}")); + egui::pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32) + }; + let click = |app: &mut VectorcraftApp, at: egui::Pos2| { + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + control_bar_nodes(&ctx, app, width, vec![egui::Event::PointerMoved(at), press(true)]); + control_bar_nodes(&ctx, app, width, vec![press(false)]); + control_bar_nodes(&ctx, app, width, vec![]) + }; + // A selected button shows pressed. + let on = |n: &egui::accesskit::Node| n.toggled() == Some(egui::accesskit::Toggled::True); + let button = control_bar_node(&nodes, "Align center").unwrap_or_else(|| panic!("the Control bar has Align center")); + assert!(!on(&button), "left-aligned type: Align center is not selected"); + assert!(control_bar_node(&nodes, "Align left").is_some_and(|n| on(&n)), "Align left shows selected"); + let undo = app.session.active().unwrap().history.undo.len(); + let nodes = click(&mut app, center(&button)); + assert_eq!(text_style(&app).unwrap().1.justify, Justify::Center, "{}", app.ui.status); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1, "one undo step"); + assert!(control_bar_node(&nodes, "Align center").is_some_and(|n| on(&n)), "Align center shows selected"); + assert!(!control_bar_node(&nodes, "Align left").is_some_and(|n| on(&n)), "Align left no longer selected"); + // The Paragraph: link opens the Paragraph panel in a popover: its justifications show there, + // no panel docks, and a second click closes it. + let link = control_bar_node(&nodes, "Paragraph:").unwrap_or_else(|| panic!("the Paragraph: link")); + assert_eq!(link.description(), Some("Paragraph options")); + assert!(control_bar_node(&nodes, "Justify all lines").is_none(), "closed"); + let nodes = click(&mut app, center(&link)); + assert!(control_bar_node(&nodes, "Justify all lines").is_some(), "the popover shows the Paragraph panel"); + assert_eq!(app.ui.open_panel, None, "no panel docks"); + let nodes = click(&mut app, center(&link)); + assert!(control_bar_node(&nodes, "Justify all lines").is_none(), "a second click closes it"); +} + +/// #5372: at any width the Control bar trims itself from its right end, ending inside its margin. +/// With type selected the inline X/Y/W/H fields go first, then the Distribute and Align buttons, +/// area type's vertical alignment, the Paragraph buttons and last the Paragraph: link, while the +/// Transform link keeps its room; a wider bar never leaves out what a narrower one showed. For one point +/// type object, area type (its vertical alignment) and two objects (the Distribute buttons). +#[test] +fn the_control_bar_trims_its_paragraph_section_after_the_controls_to_its_right() { + let ctx = control_bar_ctx(); + let point = |x: i32| json!({"x": x, "y": 50, "text": "Point"}); + let area = json!({"x": 20, "y": 20, "text": "Area", "area": {"width": 100, "height": 120}}); + const VERTICAL: [&str; 4] = ["Align Top", "Align Center", "Align Bottom", "Justify Vertically"]; + for (case, texts) in [("point type", vec![point(20)]), ("area type", vec![area]), ("two objects", vec![point(20), point(300)])] { + let mut app = control_bar_app(&texts); + // Each group of controls in the bar's order, by its first and last control. + let mut groups: Vec<(&str, Vec<&str>)> = vec![("link", vec!["Paragraph:"]), ("buttons", BAR_ALIGNMENTS.to_vec())]; + if case == "area type" { + groups.push(("vertical alignment", VERTICAL.to_vec())); + } + groups.push(("Align", vec!["Horizontal Align Left", "Vertical Align Bottom"])); + if case == "two objects" { + groups.push(("Distribute", vec!["Vertical Distribute Top", "Horizontal Distribute Right"])); + } + groups.push(("X/Y/W/H", vec!["X:", "H:"])); + let mut seen = vec![false; groups.len()]; + for width in (600..=2400).step_by(10) { + let nodes = control_bar_nodes(&ctx, &mut app, width as f32, vec![]); + let inside = |x: f64| x <= f64::from(width) - 10.0; + let shown: Vec = groups + .iter() + .map(|(group, names)| { + let ends: Vec> = names.iter().map(|n| control_bar_end(&nodes, n)).collect(); + assert!(ends.iter().all(Option::is_some) || ends.iter().all(Option::is_none), "{case}, {width}: {group} {ends:?}"); + if let Some(Some(end)) = ends.last() { + assert!(inside(*end), "{case}, {width}: {group} ends at {end}"); + } + ends.iter().all(Option::is_some) + }) + .collect(); + // Narrower bars are already full before the section (the Character controls). + let transform = control_bar_end(&nodes, "Transform"); + assert!(!shown[0] || transform.is_some_and(inside), "{case}, {width}: Transform ends at {transform:?}"); + for (i, ((group, _), on)) in groups.iter().zip(&shown).enumerate() { + assert!(!seen[i] || *on, "{case}, {width}: {group} left out after a narrower bar showed it"); + assert!(!*on || shown[..i].iter().all(|s| *s), "{case}, {width}: {group} shows while a group before it is left out"); + seen[i] |= on; + } + } + assert!(seen.iter().all(|s| *s), "{case}: a wide bar shows every group: {seen:?}"); + } +} diff --git a/crates/ui-egui/src/panels/transform.rs b/crates/ui-egui/src/panels/transform.rs index 0f1cf3db5f..3cd54cc851 100644 --- a/crates/ui-egui/src/panels/transform.rs +++ b/crates/ui-egui/src/panels/transform.rs @@ -461,14 +461,23 @@ pub(crate) fn polygon_rows(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node, live /// The Control bar's underlined "Transform" link: a click toggles the Transform panel in a /// popover under it, as the Stroke link does with the Stroke panel. pub fn link(app: &mut VectorcraftApp, ui: &mut Ui) { - let t = Tokens::get(ui.ctx()); - let resp = ui.link(egui::RichText::new(tl!("Transform")).size(12.0).color(t.text).underline()).on_hover_text(tl!("Transform options")); + let resp = ui.link(link_text(ui)).on_hover_text(tl!("Transform options")); widgets::popover(&resp, resp.clicked(), |ui| { ui.set_width(300.0); show(app, ui); }); } +/// The Transform link's text, as [`link`] draws it and [`link_width`] measures it. +fn link_text(ui: &Ui) -> egui::RichText { + egui::RichText::new(tl!("Transform")).size(12.0).color(Tokens::get(ui.ctx()).text).underline() +} + +/// The width of the Transform [`link`] in `ui`. +pub fn link_width(ui: &Ui) -> f32 { + widgets::text_width(ui, link_text(ui)) +} + /// The width and height of [`constrain_link`]'s button. pub const CONSTRAIN_LINK_SIZE: f32 = 22.0; diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index b5bc1991bd..5c8a701dd0 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -49,7 +49,7 @@ pub use dropdowns::{ panel_scroll, popover, set_menu_floor, strip_scroll, }; pub use labels::{dim_label, dim_name, divider, field_label, label_row, link_label, section_header, section_toggle, section_toggle_name, subheader}; -pub(crate) use labels::{label_field, take_previous_label}; +pub(crate) use labels::{label_field, take_previous_label, text_width}; pub(crate) use numeric::{ANY, round_to, set_bare_numbers_are_points, typed_unit}; pub use numeric::{ SpinPick, mixed_field, mixed_field_named, num_field, num_field_live, num_field_named, num_field_within, num_field_within_empty, opt_field, diff --git a/crates/ui-egui/src/widgets/labels.rs b/crates/ui-egui/src/widgets/labels.rs index a71a0ec6a5..8c04de54b9 100644 --- a/crates/ui-egui/src/widgets/labels.rs +++ b/crates/ui-egui/src/widgets/labels.rs @@ -1,5 +1,11 @@ use super::{Pos2, Rect, Response, Sense, Stroke, Tokens, Ui, icons, pos2, scrub, theme, vec2}; +/// The width `text` takes on one line, as a label or link in `ui` draws it: its galley, which has +/// no padding around it. +pub(crate) fn text_width(ui: &Ui, text: egui::RichText) -> f32 { + egui::WidgetText::from(text).into_galley(ui, Some(egui::TextWrapMode::Extend), f32::INFINITY, egui::TextStyle::Body).size().x +} + /// Bold section header (Properties panel). pub fn section_header(ui: &mut Ui, text: &str) { let t = Tokens::get(ui.ctx()); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index a820add618..95c2445405 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; Libraries panel colours keep their spot ink in every document, #5812; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Control bar Paragraph section with type selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1672,6 +1672,10 @@ While a corner widget is pressed or dragged with the Selection or Direct Selecti A double-click on a Repeat (Radial, Grid or Mirror) with the Selection tool enters isolation mode on it ([isolate objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html): a double-click with the Selection tool isolates an object; [repeat patterns overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/repeat-patterns-overview.html): every instance follows edits to the original object); there the source art is selected and edited as usual (a double-click on type in it switches to the Type tool on that text) and every copy follows, with the repeat's settings kept (#5054). Test: `tests::repeat_edit::a_double_click_on_a_repeat_isolates_it_to_edit_its_text`. +## Control bar: Paragraph section while type is selected (2026-11-06) + +With type selected, the Control bar shows a Paragraph: link and the Align left, Align center and Align right buttons after its Character controls, as the public documentation has the Control panel format paragraphs while the Type tool is in use, with a way to the Paragraph panel ([Paragraph panel overview](https://helpx.adobe.com/illustrator/using/formatting-paragraphs.html)), and its alignment buttons align text as the Paragraph panel's do ([Align text](https://helpx.adobe.com/illustrator/using/align-text.html)). A button aligns the selected type (`text.setStyle {justify}`, one undo step) and the shared alignment shows selected; the link opens the Paragraph panel in a popover under it, as Character: opens the Character panel. Keeping to the three alignments that don't justify is our choice, for the bar's room; the popover has all seven. Short of room the bar leaves controls out from its right end: the inline X/Y/W/H fields, the Distribute and Align buttons, area type's vertical alignment, then these buttons and last the link, keeping room for the Transform link; on a 1440 pt bar with one point type object, the buttons show (pinned by a headless test, #5372). + ## Area type: vertical alignment in the Properties and Control panels (2026-11-04) With area type selected, the Properties panel's Paragraph section and the Control panel show Align Top, Align Center, Align Bottom and Justify Vertically buttons, as the public documentation places them ([Align text](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/align-text.html)). They set the type's vertical alignment in its frame (`text.areaOptions {verticalAlign}`, as Area Type Options does) on every selected frame in one undo step, each frame keeping its other options; the shared alignment shows selected, none when the frames differ (#3759). As that page limits vertical alignment to area type without rows, columns or threads, the buttons are turned off while a selected frame has rows or columns or is threaded; Area Type Options and `text.areaOptions` still align each row/column cell (a VectorCraft extension, unchanged here). Tests: `panels::properties::tests::vertical_alignment_buttons_align_the_selected_area_type`. @@ -1684,6 +1688,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | Control bar: Paragraph: link and Align left/center/right while type is selected, trimmed from the bar's right end after X/Y/W/H and the Align buttons (#5372); evidence added; scores unchanged. | | 2026-11-04 | minor | Contour add-on (beyond Illustrator): drag away from a selected shape's edge to grow a live copy of it, or toward the inside to shrink it; the copy carries a live Offset Path effect, so it stays editable until Bake (Expand Appearance), a second drag changes the same Contour instead of nesting one, and a floating bar sets the distance and the Sharp, Round or Square corners. `addon.contour.set` is the command behind it. It is a built-in add-on: Object › Plug-ins › Contour, and its own heading in All Tools, with no default shortcut or toolbar slot. A VectorCraft design built on Offset Path; no other application was inspected. Scores and estimates unchanged. | | 2026-11-04 | minor | Contour tool (beyond Illustrator): drag away from a selected shape's edge to grow a live copy of it, or toward the inside to shrink it; the copy carries a live Offset Path effect, so it stays editable until Bake (Expand Appearance), a second drag changes the same Contour instead of nesting one, and a floating bar sets the distance and the Sharp, Round or Square corners. `object.contour` is the command behind it. A VectorCraft design built on Offset Path; no other application was inspected. Scores and estimates unchanged. | | 2026-11-05 | minor | View & navigation: document tabs are reordered by dragging them along the tab strip (`document.move`, #5663); evidence added; scores unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index c090a15394..7bbc9e58c5 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence @@ -359,6 +359,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Select › Start Global Edit / Stop Global Edit; Properties › Quick Actions with the Global Edit Options popover (Match: Appearance, Size; On Artboards: All Artboards or a range, Include Objects On Canvas; Result(s)); Escape stops it; the matched objects are highlighted in their layer colour while it runs; a Shift-click on a highlighted match leaves it out | partial | #3521, `select.globalEdit` / `select.globalEditOptions` / `select.globalEditExclude`, `crates/engine/src/tests/globaledit.rs`; paths, compound paths, symbol instances and groups of them (similar groups, #4939: edits inside one group reach the same object in the others; [public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/edit-groups-with-similar-objects.html)); Shift-click to leave a match out ([public source](https://helpx.adobe.com/ph_fil/illustrator/how-to/global-editing-sensei.html)); the Control bar's Global Edit Options dropdown opens the same options; rotated copies and highlighting matches before the start remain ([public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/edit-similar-objects.html)) | | Contextual task bar | done | | | Control bar with Transform and Stroke popovers | done | | +| Control bar: Paragraph: link and Align left/center/right while type is selected (#5372) | done | After the Character controls, as the public documentation has the Control panel format paragraphs ([Paragraph panel overview](https://helpx.adobe.com/illustrator/using/formatting-paragraphs.html), [Align text](https://helpx.adobe.com/illustrator/using/align-text.html)); the link opens the Paragraph panel in a popover, as Character: does with the Character panel. The bar trims from its right end: X/Y/W/H, Distribute, Align, area type vertical alignment, then these buttons, then the link. The three-button set is our choice for room; all seven alignments are in the popover. `panels/paragraph/tests.rs` headless tests (`the_control_bar_shows_the_paragraph_alignment_of_the_selected_type`, `the_control_bar_trims_its_paragraph_section_after_the_controls_to_its_right`) | | Pathfinder shape results keep their source names and SVG IDs | done | #1293; Minus Front keeps the back name, Minus Back the front name; Unite/Intersect/Exclude use the backmost named input; compound output carries it once; geometry and paint unchanged | | Attributes fill-rule controls with a compound member selected | done | Edits the compound's rule; direction still edits only the member; rendered-hole and Undo/Redo regression tests (#1197) | | Make Compound Path on a group (such as outlined type) keeps its backmost path's paint; compound paths joined into one keep their holes | done | #1537 | @@ -456,6 +457,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | Control bar: with type selected, a Paragraph: link (the Paragraph panel in a popover) and the Align left, Align center and Align right buttons follow the Character controls; the bar leaves them out from its right end when short of room, after X/Y/W/H and the Align buttons (#5372); scores and estimates unchanged | | 2026-11-04 | minor | Contour add-on (beyond Illustrator): drag away from a selected shape's edge to grow a live copy of it, or toward the inside to shrink it; the copy carries a live Offset Path effect, so it stays editable until Bake (Expand Appearance), a second drag changes the same Contour instead of nesting one, and a floating bar sets the distance and the Sharp, Round or Square corners. `addon.contour.set` is the command behind it. It is a built-in add-on: Object › Plug-ins › Contour, and its own heading in All Tools, with no default shortcut or toolbar slot. A VectorCraft design built on Offset Path; no other application was inspected. Scores and estimates unchanged. | | 2026-11-04 | minor | Contour tool (beyond Illustrator): drag away from a selected shape's edge to grow a live copy of it, or toward the inside to shrink it; the copy carries a live Offset Path effect, so it stays editable until Bake (Expand Appearance), a second drag changes the same Contour instead of nesting one, and a floating bar sets the distance and the Sharp, Round or Square corners. `object.contour` is the command behind it. A VectorCraft design built on Offset Path; no other application was inspected. Scores and estimates unchanged. | | 2026-11-05 | minor | Document tabs are reordered by dragging them along the tab strip (`document.move`, #5663). | From af31e1464ca7735a4a567d8ac2fea7d9277b664e Mon Sep 17 00:00:00 2001 From: Simon Hull <5488089+simonhull@users.noreply.github.com> Date: Thu, 5 Nov 2026 15:29:09 -0600 Subject: [PATCH 02/56] Canvas: a document's first frame renders on the render worker (#4155) A document's first frame (opened, or its tab chosen) rendered on the UI thread: only a document with a frame already shown sent its frames to the worker. A heavy file froze the window until it was drawn, 8.7 s for the file of #4155 and 1.4 s for a 50,000-path SVG. The first frame now goes to the worker too, and the window shows the document's paper and artboards until it lands. The UI thread waits for it up to FIRST_FRAME_GRACE (16 ms) when it is queued (`Worker::wait`; `submit` says whether it queued), so a light document's art still shows in the same frame. The longest UI-thread stall opening those files is now 64 ms and 62 ms (M3 Pro, one run each). The web build, which has no worker, is unchanged. --- crates/ui-egui/src/canvas.rs | 75 +++++++++++++++++++---------- crates/ui-egui/src/canvas/tests.rs | 68 ++++++++++++++++++++++++++ crates/ui-egui/src/render_worker.rs | 26 ++++++++-- docs/gaps.md | 10 ++-- docs/target-app-parity.md | 4 +- 5 files changed, 148 insertions(+), 35 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index f99c524f12..8e3315e357 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -550,25 +550,28 @@ fn poll_worker(app: &mut VectorcraftApp, ui: &Ui, key_doc: usize) { app.canvas.fill_worker = crate::render_worker::Worker::spawn(ui.ctx().clone()); } } - // Upload finished background renders whenever they are not older than what is currently - // displayed on screen. This prevents canvas freezes during continuous edits (drags, arrow - // nudges, MCP command bursts) while ensuring obsolete out-of-order frames are dropped. - if let Some(done) = app.canvas.worker.as_mut().and_then(|w| w.poll()) - && done.key.doc == key_doc - { - let not_older = app.canvas.key.as_ref().filter(|k| k.doc == done.key.doc).is_none_or(|k| done.key.revision >= k.revision); - if not_older { - upload(app, ui.ctx(), done.img, done.key.pixel.is_some()); - app.canvas.key = Some(done.key); - app.canvas.shown = Some((done.doc, done.opts)); - app.perf.render_ms = done.ms; - app.canvas.last_ms = done.ms; - app.canvas.moved = done.moved > 0; - app.canvas.from_worker = true; - } + if let Some(done) = app.canvas.worker.as_mut().and_then(|w| w.poll()) { + show_worker_frame(app, ui.ctx(), done, key_doc); } } +/// Upload frame `done` from the render worker when it is of document `key_doc` and not older than +/// the frame shown. This prevents canvas freezes during continuous edits (drags, arrow nudges, MCP +/// command bursts) while ensuring obsolete out-of-order frames are dropped. +fn show_worker_frame(app: &mut VectorcraftApp, ctx: &egui::Context, done: crate::render_worker::Done, key_doc: usize) { + let not_older = app.canvas.key.as_ref().filter(|k| k.doc == done.key.doc).is_none_or(|k| done.key.revision >= k.revision); + if done.key.doc != key_doc || !not_older { + return; + } + upload(app, ctx, done.img, done.key.pixel.is_some()); + app.canvas.key = Some(done.key); + app.canvas.shown = Some((done.doc, done.opts)); + app.perf.render_ms = done.ms; + app.canvas.last_ms = done.ms; + app.canvas.moved = done.moved > 0; + app.canvas.from_worker = true; +} + /// The size and view matrix of the frame to render: the pixel region in Pixel Preview, else the whole canvas. fn frame_view(pixel: Option<[i64; 4]>, (w, h): (u32, u32), v: &View, ppp: f32) -> (u32, u32, Affine) { match pixel { @@ -645,16 +648,26 @@ struct Frame<'a> { pixel: Option<[i64; 4]>, } +/// How long the UI thread waits for a document's first frame from the render worker before it +/// shows the document's paper without the art: about a frame at 60 Hz. +pub(crate) const FIRST_FRAME_GRACE: std::time::Duration = std::time::Duration::from_millis(16); + fn draw_frame(app: &mut VectorcraftApp, ui: &Ui, frame: Frame) { let Frame { key, doc, size: (w, h), view, opts, pixel } = frame; + // Frames that would be slow on this thread (the last one took over 8 ms) go // to the worker. An interaction's frames stay on the worker once it drew the frame shown: // its renderer keeps the rasters of the art's effects that make those frames fast, and this // thread's renderer has none, so a frame fast on the worker would be slow here. let same_doc = app.canvas.key.as_ref().is_some_and(|k| k.doc == key.doc); let settling = app.canvas.moved && !key.interacting; let staying = key.interacting && app.canvas.from_worker; - let heavy = (app.canvas.last_ms > 8.0 || settling || staying) && app.canvas.texture.is_some() && same_doc; + // A document's first frame (opened, or its tab chosen) renders on the worker too: how long it + // takes is not known yet, and a heavy one froze the window for seconds (#4155). Its paper and + // artboards show meanwhile. + let first = app.canvas.texture.is_none() || !same_doc; + let heavy = first || app.canvas.last_ms > 8.0 || settling || staying; let changed = changed_pixels(app, key, doc, &opts, view, w, h); + let mut landed = None; match (&mut app.canvas.worker, heavy, changed) { // Only the document changed since the frame shown, in a part of it: that part is // rendered again, here, into the texture. `last_ms` stays the whole frame's. @@ -671,15 +684,22 @@ fn draw_frame(app: &mut VectorcraftApp, ui: &Ui, frame: Frame) { app.canvas.shown = Some((doc.clone(), opts.clone())); app.perf.render_ms = now_ms() - t0; } - (Some(worker), true, None) => worker.submit(crate::render_worker::Job { - key: key.clone(), - doc: doc.clone(), - w, - h, - view, - opts, - scope: vectorcraft_engine::file_access::ScopeHandle::capture(), - }), + (Some(worker), true, None) => { + let queued = worker.submit(crate::render_worker::Job { + key: key.clone(), + doc: doc.clone(), + w, + h, + view, + opts, + scope: vectorcraft_engine::file_access::ScopeHandle::capture(), + }); + // A light document's first frame is ready within the grace and shows in this frame, + // with no frame of bare paper. Waited for once, when the frame is queued. + if first && queued { + landed = worker.wait(FIRST_FRAME_GRACE); + } + } _ => { let t0 = now_ms(); let img = app.canvas.renderer.render(doc, w, h, view, &opts); @@ -692,6 +712,9 @@ fn draw_frame(app: &mut VectorcraftApp, ui: &Ui, frame: Frame) { app.canvas.from_worker = false; } } + if let Some(done) = landed { + show_worker_frame(app, ui.ctx(), done, key.doc); + } } /// The pasteboard, the artboards' shadows and paper, and the outline mode's white artboards, of diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index cf8d3635ba..a09c626353 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -9198,3 +9198,71 @@ fn the_contour_bar_sets_corners_and_bakes() { click_contour_bar(&mut app, &ctx, "Bake"); assert!(offsets(&app).is_empty(), "baked"); } + +/// A frame the render worker finished for `job`: white pixels of the job's size. +fn finished(job: &crate::render_worker::Job) -> crate::render_worker::Done { + let img = vectorcraft_render::Rendered { width: job.w, height: job.h, pixels: vec![255; job.w as usize * job.h as usize * 4] }; + crate::render_worker::Done { key: job.key.clone(), doc: job.doc.clone(), opts: job.opts.clone(), img, ms: 40.0, moved: 0 } +} + +/// #4155: a document's first frame renders on the render worker, not on the UI thread, where a +/// heavy one froze the window for seconds while it opened. The canvas shows the document's paper +/// meanwhile, does not queue the frame again while it renders, and shows it once it lands. +#[test] +fn a_documents_first_frame_renders_on_the_worker() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + app.canvas.worker_started = true; + let (worker, jobs, done_tx) = crate::render_worker::Worker::test_channel(); + app.canvas.worker = Some(worker); + let ctx = egui::Context::default(); + let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))), ..Default::default() }; + let frame = |app: &mut VectorcraftApp| ctx.run_ui(raw.clone(), |ui| show(app, ui)).textures_delta.clear(); + + frame(&mut app); + let job = jobs.try_recv().expect("the first frame is queued on the worker"); + assert!(app.canvas.texture.is_none(), "not rendered on the UI thread"); + frame(&mut app); + assert!(jobs.try_recv().is_err(), "not queued again while it renders"); + assert!(app.canvas.texture.is_none()); + + done_tx.send(finished(&job)).unwrap(); + frame(&mut app); + assert!(app.canvas.texture.is_some(), "shown once it lands"); + assert_eq!(app.canvas.key.as_ref(), Some(&job.key)); + assert!(app.canvas.from_worker); +} + +/// The canvas waits for a document's first frame only briefly (`FIRST_FRAME_GRACE`): `wait` +/// returns a frame finished before or during the wait, clearing the pending job, and nothing once +/// the time is up. +#[test] +fn the_render_worker_waits_for_a_frame_only_as_long_as_asked() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + app.canvas.worker_started = true; + let (worker, jobs, _) = crate::render_worker::Worker::test_channel(); + app.canvas.worker = Some(worker); + let ctx = egui::Context::default(); + let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(200.0, 150.0))), ..Default::default() }; + ctx.run_ui(raw, |ui| show(&mut app, ui)).textures_delta.clear(); + let job = jobs.try_recv().expect("a job to finish"); + + let (mut w, _, done_tx) = crate::render_worker::Worker::test_channel(); + let t0 = std::time::Instant::now(); + assert!(w.wait(std::time::Duration::from_millis(20)).is_none()); + assert!(t0.elapsed() >= std::time::Duration::from_millis(20), "waited the time asked"); + + w.pending = Some(job.key.clone()); + done_tx.send(finished(&job)).unwrap(); + assert_eq!(w.wait(std::time::Duration::from_secs(5)).map(|d| d.key), Some(job.key.clone()), "finished before the wait"); + assert!(w.pending.is_none()); + + let late = finished(&job); + let sender = std::thread::spawn(move || { + std::thread::sleep(std::time::Duration::from_millis(30)); + done_tx.send(late).unwrap(); + }); + assert!(w.wait(std::time::Duration::from_secs(5)).is_some(), "finished during the wait"); + sender.join().unwrap(); +} diff --git a/crates/ui-egui/src/render_worker.rs b/crates/ui-egui/src/render_worker.rs index 1b28f7d1fb..3a7f5d89ad 100644 --- a/crates/ui-egui/src/render_worker.rs +++ b/crates/ui-egui/src/render_worker.rs @@ -1,7 +1,8 @@ //! Background rendering (native): heavy documents render off the UI thread while the canvas shows //! the previous frame reprojected to the current view. A second worker renders a low-resolution //! frame for the parts that frame does not reach (`canvas::fill_uncovered`). Light documents -//! render synchronously so edits never lag behind overlays. +//! render synchronously so edits never lag behind overlays, after a first frame that renders here +//! too: the UI thread waits for it only briefly (`canvas::FIRST_FRAME_GRACE`). use std::sync::Arc; use std::sync::mpsc::{Receiver, Sender, channel}; @@ -80,16 +81,31 @@ impl Worker { (Self { tx, rx, pending: None }, jobs, done_tx) } - pub fn submit(&mut self, job: Job) { + /// Queue `job`, unless the job pending is the same frame. Whether it was queued. + pub fn submit(&mut self, job: Job) -> bool { if self.pending.as_ref() == Some(&job.key) { - return; + return false; } self.pending = Some(job.key.clone()); - let _ = self.tx.send(job); + // A worker that has stopped renders nothing: the canvas keeps the frame it shows. + self.tx.send(job).is_ok() } + /// The newest finished frame, if any. pub fn poll(&mut self) -> Option { - let mut last = None; + self.newest(None) + } + + /// The newest finished frame, waiting up to `timeout` for one when none has finished yet. + pub fn wait(&mut self, timeout: std::time::Duration) -> Option { + let first = self.rx.try_recv().ok().or_else(|| self.rx.recv_timeout(timeout).ok())?; + self.newest(Some(first)) + } + + /// The newest of `first` and the frames finished since, the pending job cleared when it is + /// the one. + fn newest(&mut self, first: Option) -> Option { + let mut last = first; while let Ok(d) = self.rx.try_recv() { last = Some(d); } diff --git a/docs/gaps.md b/docs/gaps.md index 0f98d7e8b0..2f406c3cbe 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -649,11 +649,14 @@ from G14 and the budget run of G15: **~170–270 h** one agent, ~50–80 h wall ## G15 Performance budgets and a GPU renderer +- **Improved (#4155):** a document's first frame renders on the render worker, not the UI thread: opening the file + of #4155 kept the UI thread busy for 8.7 s at a stretch, now at most 64 ms, and a 50,000-path SVG 1.4 s, now + 62 ms (measured in the app, M3 Pro, one run each). A light document's frame, ready within 16 ms, still shows at once. - **Improved (#4155):** the canvas shrinks a reduced image to the mip it draws before separating it into ink planes, colorizing it or proofing it, so that work is done at the size the image shows, not at its own. On the 141-megapixel image of #4155 the first frame went from 9.2 s to 1.6 s and the sharp frame after a pan from 3.9 s - to 8 ms (measured in the app, M3 Pro, one run each). Still to do: the first frame still renders on the UI thread, - and at 100% zoom or more an image is still separated whole; tiles would bound that by the view. + to 8 ms (measured in the app, M3 Pro, one run each). Still to do: at 100% zoom or more an image is still separated + whole; tiles would bound that by the view. - **Improved (2026-11-02):** the renderer keeps a compound path's assembled path with the node, as it keeps a plain path's, instead of assembling its members again in every frame; the path is assembled into a buffer sized up front. Unused geometry entries are dropped after a few frames however few there are (before, only past 1,024 entries), so @@ -764,6 +767,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| +| 2026-11-05 | minor | G15: a document's first frame renders on the render worker (#4155); the longest UI-thread stall opening that file went from 8.7 s to 64 ms. Estimate unchanged. | | 2026-11-05 | minor | G15: a reduced image is shrunk before it is separated into ink planes (#4155); first frame 9.2 s → 1.6 s, sharp frame after a pan 3.9 s → 8 ms on that file. Estimate unchanged. | | 2026-11-05 | minor | G7: document tabs are dragged along the tab strip to reorder them (`document.move`, #5663). Estimate unchanged. | | 2026-11-02 | minor | G15: the renderer keeps a compound path's assembled path between frames and drops unused geometry entries after a few frames however few there are. Estimate unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 95c2445405..0994d967c2 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Control bar Paragraph section with type selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -31,6 +31,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-05 | minor | Canvas: a document's first frame (opened, or its tab chosen) renders on the render worker instead of the UI thread; the window shows the document's paper and artboards until the art lands, and a frame ready within 16 ms shows at once. Opening the file of #4155 kept the UI thread busy for 8.7 s at a stretch, now at most 64 ms; a 50,000-path SVG 1.4 s, now 62 ms (measured, M3 Pro, one run each). Scores and estimates unchanged. | | 2026-11-05 | minor | Canvas: an image drawn reduced in a CMYK document is shrunk to the size it shows before it is separated into ink planes, not separated at full size and then shrunk (#4155). On the 141-megapixel image of #4155 the first frame went from 9.2 s to 1.6 s, and the sharp frame after a pan from 3.9 s to 8 ms (measured, M3 Pro, one run each). The same pixels show within 5 levels; fine detail such as 1-pixel lines now shows its true average. Scores and estimates unchanged. | | 2026-11-05 | minor | Effect dialogs: a hex colour parameter (Outer Glow's Color, Inner Glow's, Drop Shadow's) shows a swatch beside the field that follows typed hex values; a double-click opens the Color Picker over the dialog on that colour, and its OK fills the field while Cancel comes back unchanged (#5365); scores and estimates unchanged. | | 2026-11-05 | minor | Libraries panel: a spot colour added to a library (from the selection or dragged from the Swatches panel) keeps its ink name, values and tint in the library file; used in any document, also a new one or after the original was closed, it links the paint to that document's spot swatch of the same name, adding it when the document has none of that colour, in one undo step (#5812). Test: `tests::library::a_spot_colour_stays_spot_in_another_document`. Scores and estimates unchanged. | @@ -1365,6 +1366,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Dragging objects with raster effects when zoomed in (#2558):** during a drag with a tool on the canvas, the renderer draws filtered content (Gaussian Blur, Feather and the Photoshop-style filters) within 1,000,000 pixels, at a lower resolution where it would need more, unless it can draw the content from an earlier frame's raster. In the desktop app it does the same for drop shadows, outer glows and inner glows. No raster made that way is kept. The frame after the drag renders them as a still frame does, and a dialog's preview, exports and printing render as before. `zoomed_drag_perf` times a drag's frames at 100% to 6400%. - **Dragging other art over a wide blur (#2558):** an effect raster too large to keep whole (a wide blur, a shadow or glow, or any blur zoomed in) is cropped to what can show in the view, or made at a lower resolution and resampled to the view's pixels, and kept while the view stays the same, so dragging other art over the object draws its effects from the still frame instead of re-rendering them at the drag's lower resolution. A drag stays on the render worker once the worker drew the frame shown, since only that renderer holds the rasters. `tests_viewraster` covers each effect, and `a_drag_over_a_wide_blur_draws_the_blur_from_the_still_frame` the canvas on and off the worker. Not yet: a worker frame shows one display frame after the overlays, and the first frame of an interaction can land on the renderer that has not made the rasters yet (follow-up: render every canvas frame on the worker, waiting briefly for fast ones). +- **Opening a heavy document (#4155):** the canvas renders a document's first frame (when it opens, or its tab is chosen) on the render worker, as it renders the frames of a slow document, instead of on the UI thread, where a heavy one froze the window until it was done. The UI thread waits for it up to 16 ms (`FIRST_FRAME_GRACE`), so a light document's art shows in the same frame as before, without a frame of bare paper; otherwise the document's paper and artboards show, the window stays live, and the art shows when it lands. The web build, which has no worker, renders it as before. Measured on an M3 Pro, one run each, from launch with the file: the file of #4155 kept the UI thread busy for 8.7 s at a stretch, now at most 64 ms (its art lands as before, after about 9 s of rendering); a 50,000-path SVG 1.4 s, now 62 ms. `a_documents_first_frame_renders_on_the_worker` and `the_render_worker_waits_for_a_frame_only_as_long_as_asked` (`crates/ui-egui/src/canvas/tests.rs`). - **Large images in CMYK documents (#4155):** the canvas draws a reduced image from a mip (halved while still at least as fine as the screen) and, in a CMYK document, separates that mip into its ink planes, colorizes it or shows it through Separations Preview's plates, instead of doing that to the full pixels and shrinking the result. A CMYK image's own inks are halved with its pixels, so it still paints them. Exports draw without mips and are unchanged. On the file of #4155 (one 11,339 × 12,424 image), measured on an M3 Pro under load, one run each: first frame 9.2 s → 1.6 s, opening to the first frame 11.7 s → 3.9 s, the sharp frame after a pan 3.9 s → 8 ms and after a zoom 3.5 s → 0.16 s; the fitted view's pixels differ by at most 5 levels (p99 2). `a_reduced_image_is_separated_from_its_mip_not_its_full_pixels`, `a_reduced_cmyk_image_paints_its_own_inks` and `a_reduced_image_on_the_ink_planes_shows_its_average` (`crates/render/src/tests/memory.rs`) cover the order, the inks and the colour: 1-pixel black and white lines show as the mid grey they average to, where separating first showed them 44 levels darker. - **Panning over a cropped effect raster:** when a pan makes a shadow, glow or filtered content raster cropped to the view again at the same zoom and rotation, the renderer makes it over a margin around the view too (up to half the view's longer side, within 8.4 million pixels), and later pans that keep the view inside that margin draw the raster instead of making it again. Zooming and the first frame at a zoom make the raster without the margin. The canvas pans by whole device pixels: the wheel, a trackpad, a touch screen and the scroll bars add the part of a pixel left over to the next scroll of the same view, and Hand tool and scroll bar thumb drags round the distance dragged. A Drop Shadow or Outer Glow raster holds the shadow or glow of group members outside the view, so a pan that shows a member draws its shadow or glow from the raster. `pans_within_a_cropped_rasters_margin_draw_it_kept` covers Drop Shadow, Gaussian Blur and Feather on a large image at 100%. `a_groups_shadow_raster_holds_the_members_outside_the_view` covers a group's members, `fractional_scrolls_moved_in_whole_pixels_draw_a_cropped_raster_kept` covers scrolls by fractions of a pixel, and `scrolls_and_pans_move_the_view_by_whole_device_pixels` covers the canvas. From 887f59c7a3082ba276056ca0437c8fbd36d0553d Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 6 Nov 2026 05:31:56 +0700 Subject: [PATCH 03/56] Tests: the first-frame worker test tolerates another test's placed document The frame key holds the process-wide placed-document generation, so a test running beside this one could make a new frame between the two it compares. --- crates/ui-egui/src/canvas/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index a09c626353..9d5b3e8825 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -9223,7 +9223,9 @@ fn a_documents_first_frame_renders_on_the_worker() { let job = jobs.try_recv().expect("the first frame is queued on the worker"); assert!(app.canvas.texture.is_none(), "not rendered on the UI thread"); frame(&mut app); - assert!(jobs.try_recv().is_err(), "not queued again while it renders"); + // A placed document of a test running beside this one moves the process-wide generation in + // the key: that makes a new frame, not this one again. + assert!(jobs.try_iter().all(|j| j.key.placed != job.key.placed), "not queued again while it renders"); assert!(app.canvas.texture.is_none()); done_tx.send(finished(&job)).unwrap(); From 446c3f071ffe5d06c18ed29d878458f8ffd98f5c Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:12:16 -0500 Subject: [PATCH 04/56] SVG import: a clipPath's children clip to their union, each under its own clip-rule (#5840) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A clipPath with several children was imported as one compound path under the first child's fill rule, so children wound in opposite directions cancelled where they overlapped, and an even-odd child after a non-zero one lost its hole. SVG 1.1 §14.3.5 defines the clip as the union of the children's silhouettes, each computed on its own. A clipPath with several children now comes in as a group of them as the clip group's clipping path, each child keeping its own rule; a group clips to the union of its members. One child imports as before. --- crates/svg/src/import/importer.rs | 36 +++++++++++++++++-------- crates/svg/tests/it/import_details.rs | 39 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/crates/svg/src/import/importer.rs b/crates/svg/src/import/importer.rs index 0a0372e3f4..826fed0994 100644 --- a/crates/svg/src/import/importer.rs +++ b/crates/svg/src/import/importer.rs @@ -7,6 +7,7 @@ use super::{ StrokeLayer, Vec2, fnv1a, fx, shapes, spread, text, vector_effect, }; use crate::SvgError; +use kurbo::BezPath; /// How many clip paths deep (``) an object's clip is read. const MAX_CLIP_NEST: usize = 16; @@ -446,19 +447,32 @@ impl Importer { } fn clip_node(&mut self, cp: &usvg::ClipPath, ts: Affine) -> Option { - let shapes = clip_shapes(cp, ts); - if shapes.is_empty() { + let mut shapes = clip_shapes(cp, ts); + let id = cp.id().to_string(); + if shapes.len() == 1 { + let (bp, r) = shapes.pop()?; + let kind = self.clip_shape(&bp, r, true)?; + return self.named(&id, kind); + } + // SVG 1.1 §14.3.5: the clip is the union of the children's silhouettes, each under its own + // clip-rule, so they don't cancel or share one rule: a group of them, which clips to that + // union (`Node::clip_shapes`). + let mut children = Vec::with_capacity(shapes.len()); + for (bp, r) in &shapes { + let kind = self.clip_shape(bp, *r, false)?; + children.push(Arc::new(Node::new(self.alloc_id()?, kind))); + } + if children.is_empty() { return None; } - let r = shapes[0].1; - let mut subs = Vec::new(); - for (bp, _) in &shapes { - subs.extend(PathData::from_bezpath(bp).subpaths); - } - let id = cp.id().to_string(); + self.named(&id, NodeKind::Group { children, clip: false }) + } + + /// One clip path child: a path, or a compound path of its subpaths when it has several. + fn clip_shape(&mut self, bp: &BezPath, r: FillRule, clipping: bool) -> Option { + let subs = PathData::from_bezpath(bp).subpaths; if subs.len() == 1 { - let path = PathData::new(subs); - return self.named(&id, NodeKind::Path { path, rule: r, live: None, clipping: true, guide: false }); + return Some(NodeKind::Path { path: PathData::new(subs), rule: r, live: None, clipping, guide: false }); } let mut children = Vec::with_capacity(subs.len()); for sp in subs { @@ -466,7 +480,7 @@ impl Importer { children .push(Arc::new(Node::new(nid, NodeKind::Path { path: PathData::single(sp), rule: r, live: None, clipping: false, guide: false }))); } - self.named(&id, NodeKind::Compound { children, rule: r }) + Some(NodeKind::Compound { children, rule: r }) } /// A usvg paint mapped by `m`, for art covering `area` (after `m`: where a reflected or diff --git a/crates/svg/tests/it/import_details.rs b/crates/svg/tests/it/import_details.rs index 8b36458609..967963a6f7 100644 --- a/crates/svg/tests/it/import_details.rs +++ b/crates/svg/tests/it/import_details.rs @@ -213,6 +213,45 @@ fn nested_clips_intersect() { assert_ne!(mine.over_white(90, 60), [255, 255, 255]); } +/// SVG 1.1 §14.3.5: a clip path clips to the union of its children's silhouettes, each under its +/// own `clip-rule` (https://www.w3.org/TR/SVG11/masking.html#EstablishingANewClippingPath). +#[test] +fn clip_path_children_unite_under_their_own_rules() { + // Two squares wound in opposite directions overlap at 60–100: the overlap stays clipped in. + let opposite = r##" + "##; + // A small non-zero square first, then an even-odd ring: the ring's hole stays out. + let ring = r##" + + "##; + let page = |body: &str| format!(r#"{body}"#); + for body in [opposite, ring] { + let (d, w) = import_with_report(&page(body)).unwrap(); + assert!(w.is_empty(), "{w:?}"); + let mine = render_artboard(&d); + assert_similar(&mine, &resvg_render(&page(body), 200, 200), 24.0, 0.003); + // Written back out, the clip is still the union. + let out = vectorcraft_svg::export(&d, &Default::default()); + assert_similar(&render_artboard(&vectorcraft_svg::import(&out).unwrap()), &mine, 24.0, 0.003); + } + let (d, _) = import_with_report(&page(opposite)).unwrap(); + let mine = render_artboard(&d); + assert_eq!(mine.over_white(80, 80), [255, 0, 0], "the overlap is clipped in"); + assert_eq!(mine.over_white(120, 120), [255, 0, 0]); + assert_eq!(mine.over_white(130, 30), [255, 255, 255]); + let (d, _) = import_with_report(&page(ring)).unwrap(); + let mine = render_artboard(&d); + assert_eq!(mine.over_white(100, 80), [255, 255, 255], "the even-odd hole stays out"); + assert_eq!(mine.over_white(50, 80), [255, 0, 0]); + assert_eq!(mine.over_white(5, 5), [255, 0, 0]); + // Each child keeps its own rule in the clipping group, still named after the clip path. + let clip = &art(&d)[1]; + assert_eq!(clip.name.as_deref(), Some("c")); + let NodeKind::Group { children, clip: false } = &clip.kind else { panic!("{clip:?}") }; + assert!(matches!(children[0].kind, NodeKind::Path { rule: vectorcraft_geom::FillRule::NonZero, .. })); + assert!(matches!(children[1].kind, NodeKind::Compound { rule: vectorcraft_geom::FillRule::EvenOdd, .. })); +} + #[test] fn undisplayed_objects_import_hidden() { let body = r##" From b976de560d5c33cff0c46bdf91a20b903346dcfb Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:21:55 -0500 Subject: [PATCH 05/56] Join tool: scrubbing the ends of two crossing paths trims them and joins the paths at the crossing (#5844) The Join tool drew a segment between the open ends of two crossing paths instead of trimming what overhangs the crossing. path.joinScrub now looks for two crossing open subpaths whose overhanging ends the scrub runs over, cuts both at the crossing and joins the kept parts there with a corner, in one undo step. Without a crossing the endpoint join is unchanged. --- crates/engine/src/cmd/draw2/commands.rs | 2 +- crates/engine/src/cmd/draw2/smooth.rs | 116 +++++++++++++++++++++++- crates/engine/src/tests/draw2.rs | 48 ++++++++++ docs/ui-parity.md | 5 +- 4 files changed, 166 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/draw2/commands.rs b/crates/engine/src/cmd/draw2/commands.rs index df1d47600b..0358acddf7 100644 --- a/crates/engine/src/cmd/draw2/commands.rs +++ b/crates/engine/src/cmd/draw2/commands.rs @@ -119,7 +119,7 @@ pub fn specs() -> Vec { "Join", [], None, - "{points: [[x,y]…], tolerance?: pt (12)} join the open-path endpoints scrubbed over → {id}", + "{points: [[x,y]…], tolerance?: pt (12)} join the open-path endpoints scrubbed over, or trim two crossing open paths whose overhanging ends are scrubbed and join them at the crossing → {id}", has_doc, join_scrub ), diff --git a/crates/engine/src/cmd/draw2/smooth.rs b/crates/engine/src/cmd/draw2/smooth.rs index a4aa1f79a8..d63bdaea77 100644 --- a/crates/engine/src/cmd/draw2/smooth.rs +++ b/crates/engine/src/cmd/draw2/smooth.rs @@ -1,4 +1,6 @@ -use super::common::{dist_to_polyline, ids_json, path_mut, path_of, points_param, poly_bounds, target_paths}; +use vectorcraft_pathops::addons::pathtools as pt; + +use super::common::{dist_to_polyline, ids_json, path_mut, path_of, points_param, poly_bounds, subpath_len, target_paths}; use super::{ Anchor, BezPath, CubicBez, NodeId, ParamCurve, ParamCurveNearest, PathData, Point, Result, Session, SimplifyOptions, SubPath, Value, json, number_or, po, @@ -179,11 +181,121 @@ pub(super) fn smooth_region(s: &mut Session, p: &Value) -> Result { // ---------- Join tool ---------- +/// Most open subpaths the Join tool compares pairwise for crossings before it only joins ends. +const MAX_TRIM_SUBPATHS: usize = 64; + +/// One end of an open subpath that runs on past where it crosses another: the part kept, which +/// ends at the crossing, and the part past it. +struct Overhang { + kept: SubPath, + cut: SubPath, +} + +impl Overhang { + fn at(&self) -> Option { + self.kept.anchors.last().map(|a| a.p) + } +} + +/// The overhangs of `sp` at its first and last crossing (`places`: subpath, segment, t, in order). +/// A crossing on an end anchor leaves no overhang there. +fn overhangs(sp: &SubPath, places: &[(usize, usize, f64)]) -> Vec { + let mut out = vec![]; + for (place, at_start) in [(places.first(), true), (places.last(), false)] { + let Some(&(_, seg, t)) = place else { continue }; + let (split, marks) = pt::insert_at(sp, &[(seg, t)]); + let Ok([first, second]) = <[SubPath; 2]>::try_from(split.cut_at(&marks)) else { continue }; + let (mut kept, cut) = if at_start { (second, first) } else { (first, second) }; + if at_start { + kept.reverse(); + } + out.push(Overhang { kept, cut }); + } + out +} + +/// Does the scrub `pts` (`scrub` as a path) cross `cut` or pass within `tol` of it? +fn scrubbed(cut: &SubPath, pts: &[Point], scrub: &PathData, tol: f64) -> bool { + let pd = PathData::single(cut.clone()); + pt::crossings(&[&pd, scrub], false).is_some_and(|c| c.first().is_some_and(|v| !v.is_empty())) + || cut.anchors.iter().any(|a| dist_to_polyline(pts, a.p) <= tol) + || pts.iter().any(|q| pd.nearest(*q).is_some_and(|n| n.4 <= tol)) +} + +/// Two crossing open subpaths, each `(path, subpath)`, trimmed and joined at the crossing. +struct TrimJoin { + a: (NodeId, usize), + b: (NodeId, usize), + joined: SubPath, +} + +/// #5844: two open subpaths among `ids` that cross, where the scrub runs over the part of each +/// that overhangs the crossing, trimmed at the crossing and joined there with a corner. When +/// several pairs or ends qualify, the one trimming the least wins. +fn trim_join(d: &vectorcraft_doc::Document, ids: &[NodeId], pts: &[Point], tol: f64) -> Result> { + let mut open = vec![]; + for &id in ids { + let (pd, _) = path_of(d, id)?; + open.extend(pd.subpaths.into_iter().enumerate().filter(|(_, sp)| !sp.closed && sp.anchors.len() >= 2).map(|(si, sp)| (id, si, sp))); + } + if open.len() > MAX_TRIM_SUBPATHS { + return Ok(None); + } + let scrub = PathData::single(SubPath::polyline(pts, false)); + let mut best: Option<(f64, TrimJoin)> = None; + for (i, (ida, sa, a)) in open.iter().enumerate() { + for (idb, sb, b) in open.iter().skip(i + 1) { + let (pa, pb) = (PathData::single(a.clone()), PathData::single(b.clone())); + let Some(places) = pt::crossings(&[&pa, &pb], false) else { continue }; + let (Some(on_a), Some(on_b)) = (places.first(), places.get(1)) else { continue }; + let (oa, ob) = (overhangs(a, on_a), overhangs(b, on_b)); + for x in oa.iter().filter(|o| scrubbed(&o.cut, pts, &scrub, tol)) { + for y in ob.iter().filter(|o| scrubbed(&o.cut, pts, &scrub, tol)) { + let (Some(xa), Some(ya)) = (x.at(), y.at()) else { continue }; + let trimmed = subpath_len(&x.cut) + subpath_len(&y.cut); + if xa.distance(ya) > 1e-2 || best.as_ref().is_some_and(|b| b.0 <= trimmed) { + continue; + } + // `x` ends at the crossing; `y`, reversed, starts there: one corner anchor. + let mut joined = x.kept.clone(); + let mut rest = y.kept.clone(); + rest.reverse(); + let (Some(last), Some(first)) = (joined.anchors.last_mut(), rest.anchors.first()) else { continue }; + *last = + Anchor { p: last.p, h_in: last.h_in, h_out: first.h_out + (last.p - first.p), kind: vectorcraft_geom::AnchorKind::Corner }; + joined.anchors.extend(rest.anchors.into_iter().skip(1)); + best = Some((trimmed, TrimJoin { a: (*ida, *sa), b: (*idb, *sb), joined })); + } + } + } + } + Ok(best.map(|(_, t)| t)) +} + pub(super) fn join_scrub(s: &mut Session, p: &Value) -> Result { const C: &str = "path.joinScrub"; let pts = points_param(p, "points", C)?; let tol = number_or(p, "tolerance", 12.0, C)?.max(0.0); let st = s.doc()?; + let targets = target_paths(&st.doc, &st.selection, poly_bounds(&pts, tol)); + // Paths that cross with their ends scrubbed are trimmed there and joined (#5844). + if let Some(TrimJoin { a: (ida, sa), b: (idb, sb), joined }) = trim_join(&st.doc, &targets, &pts, tol)? { + s.edit("Join", |d, sel| { + let missing = || crate::EngineError::Other("Join: a subpath went missing".into()); + *path_mut(d, ida)?.subpaths.get_mut(sa).ok_or_else(missing)? = joined; + let pbm = path_mut(d, idb)?; + if sb >= pbm.subpaths.len() { + return Err(missing()); + } + pbm.subpaths.remove(sb); + if ida != idb && pbm.is_empty() { + d.remove(idb)?; + } + sel.set([ida]); + Ok(()) + })?; + return Ok(json!({ "id": ida.0 })); + } // Open endpoints near the scrub, ordered along it: (order, id, subpath, at_start). let poly = { let mut bp = BezPath::new(); @@ -202,7 +314,7 @@ pub(super) fn join_scrub(s: &mut Session, p: &Value) -> Result { }; let (first_pt, last_pt) = (pts.first().copied(), pts.last().copied()); let mut ends: Vec<(f64, NodeId, usize, bool, Point)> = vec![]; - for id in target_paths(&st.doc, &st.selection, poly_bounds(&pts, tol)) { + for id in targets { let (pd, _) = path_of(&st.doc, id)?; for (si, sp) in pd.subpaths.iter().enumerate() { if sp.closed || sp.anchors.len() < 2 { diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index 479b815ff8..bb8c7329d0 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -1343,6 +1343,54 @@ fn join_tool_joins_endpoints_near_the_scrub_ends() { assert_eq!(p.subpaths[0].anchors[1].p, Point::new(202.5, 100.0)); } +/// #5844: scrubbing over the ends of two crossing open paths that run past the crossing trims +/// those ends and joins the paths there with a corner, rather than drawing a segment between the +/// ends. +#[test] +fn join_tool_trims_crossing_paths_and_joins_them_at_the_crossing() { + let mut s = session(); + let a = line(&mut s, 100.0, 300.0, 400.0, 300.0); + let b = line(&mut s, 300.0, 100.0, 300.0, 380.0); + s.execute("select.all", &json!({})).unwrap(); + drag(&mut s, "join", &[(380.0, 285.0), (285.0, 365.0)], Mods::default()); + let ps = paths(&s); + assert_eq!(ps.len(), 1, "one path is left: {ps:?}"); + let (id, p) = &ps[0]; + assert!(*id == a || *id == b); + assert_eq!(p.subpaths.len(), 1); + let mut got: Vec = p.subpaths[0].anchors.iter().map(|x| x.p).collect(); + if got.first() != Some(&Point::new(100.0, 300.0)) { + got.reverse(); + } + let near = |q: Point, r: Point| q.distance(r) < 1e-6; + assert_eq!(got.len(), 3, "{got:?}"); + assert!(near(got[0], Point::new(100.0, 300.0)) && near(got[1], Point::new(300.0, 300.0)) && near(got[2], Point::new(300.0, 100.0)), "{got:?}"); + assert!(!p.subpaths[0].closed); + assert_eq!(s.doc().unwrap().selection.objects.len(), 1); +} + +/// #5844: a curve with a hook past a straight line (the report's case) is trimmed at the crossing +/// and joined to the line's kept part; nothing of either overhang is left. +#[test] +fn join_tool_trims_a_curve_hooking_past_a_line() { + let mut s = session(); + line(&mut s, 0.0, 300.0, 480.0, 300.0); + s.execute("path.create", &json!({"anchors": [{"x": 260, "y": 0, "out": [290, 150]}, {"x": 378, "y": 368, "in": [310, 380]}]})).unwrap(); + s.execute("select.all", &json!({})).unwrap(); + drag(&mut s, "join", &[(470.0, 280.0), (420.0, 330.0), (370.0, 380.0)], Mods::default()); + let ps = paths(&s); + assert_eq!(ps.len(), 1, "{ps:?}"); + let sp = &ps[0].1.subpaths[0]; + assert!(!sp.closed); + // Every anchor is on the kept sides: the line left of the crossing, the curve above it. + let joint = sp.anchors.iter().find(|x| (x.p.y - 300.0).abs() < 1e-6 && x.p.x > 100.0).expect("an anchor at the crossing"); + for x in &sp.anchors { + assert!(x.p.y <= 300.0 + 1e-6 && x.p.x <= joint.p.x + 1e-6, "{x:?} is past the crossing at {joint:?}"); + } + let bounds = ps[0].1.bounds().unwrap(); + assert!(bounds.y1 <= 300.0 + 1e-6 && bounds.x1 <= joint.p.x + 1e-6, "{bounds:?}"); +} + #[test] fn line_family_tools_draw_and_click_asks_dialog() { let mut s = session(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 7bbc9e58c5..570bd4817a 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Join tool: scrubbing the overhanging ends of two crossing paths trims them and joins the paths at the crossing, #5844; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence @@ -38,6 +38,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-05 | minor | Join tool: scrubbing over the ends of two crossing open paths that run past the crossing trims those ends and joins the paths there with a corner, instead of drawing a segment between the ends (#5844); scores and estimates unchanged | | 2026-11-05 | minor | Effect dialogs: a swatch beside a hex colour field follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills the field (#5365); scores and estimates unchanged | | 2026-11-05 | minor | Shape tools: a shape just drawn keeps its bounding box and Live Shape widgets on show with the Rectangle, Rounded Rectangle, Ellipse, Polygon or Star tool, and its corner and pie widgets drag as with the Selection tool (#5477); scores and estimates unchanged | | 2026-11-05 | minor | Character panel › Show Snap to Glyph Options scrolls the panel down to the Snap to Glyph section, which comes after every character attribute and could sit out of sight, and the section starts with a Snap to Glyph checkbox (View › Snap to Glyph) so its dimmed options can be turned on there (#5273); scores and estimates unchanged | @@ -137,7 +138,7 @@ tools, never checked side by side) isn't captured row by row. | Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Fidelity goes down to 0.01 pt in the dialog, the tool and `path.freehand` (the Smooth tool keeps 0.05); its slider runs across the Tool Options row on a logarithmic rail from 0.01 to 20 pt, the field shows hundredths, and the slider's and the field's arrow keys step hundredths up to 0.1 pt, tenths up to 1 pt and whole points above (Shift ×10) (#3328); Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor while Shift or Alt is held before the press, and a path-continuation cursor over an end of a selected open path, where the line continues the path; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the shorter way round a closed path, #2850); with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path | | Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor while Shift or Alt is held before the press, and a path-continuation cursor over an end of a selected open path, where the line continues the path; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the shorter way round a closed path, #2850); with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path; a Pencil stroke from an end of one selected open path to an end of another connects the two into one path | | Effect dialogs' colour fields: a swatch beside the hex follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills it and Cancel comes back unchanged (#5365) | done | dialogs::effect test outer_glow_colour_swatch_opens_the_color_picker; the picker previews nothing itself, the effect dialog previews the returned colour | -| Join tool scrubbing, Average, Join | done | Join merges the direct-selected anchors lying on one another along a path, as after Average, into one (#1533) | +| Join tool scrubbing, Average, Join | done | Join merges the direct-selected anchors lying on one another along a path, as after Average, into one (#1533); the Join tool trims two crossing open paths whose overhanging ends it scrubs over and joins them at the crossing, instead of drawing a segment between their ends (#5844) | | Average and Join in one step, with a corner or smooth choice for the joined anchor | done | Object › Path › Average & Join… (`path.averageJoin`, Cmd+Alt+Shift+J, "Create corner or smooth join" in [Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): two open path ends meet at their midpoint and join, a corner or smooth point as the dialog's Points choice asks (Corner first, then the last choice), in one undo step | | Smooth tool smooths only the stretch of path under the drag | done | #1512 | | Drawing modes apply to pastes: Draw Inside takes Paste, Paste in Place and Paste on All Artboards inside the object; Draw Behind puts Paste in Place and Paste on All Artboards behind the selection; Shift+D cycles past Draw Behind with any selection ([drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html)) | done | #3705; `pasting_in_draw_inside_puts_the_copies_inside_the_object`, `paste_in_place_in_draw_behind_goes_behind_the_selection`, `shift_d_goes_past_draw_behind_whatever_is_selected` | From 483de72dbbd22aa363c70b0cfb139ed13d020cce Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 6 Nov 2026 05:32:35 +0700 Subject: [PATCH 06/56] Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box (#3901) Squashed from #5851 onto main. --- crates/engine/src/tests/draw2.rs | 36 +++++++++++++++++++++++++++ crates/engine/src/tooling.rs | 16 ++++++++++-- crates/ui-egui/src/canvas/overlays.rs | 6 ++++- crates/ui-egui/src/canvas/tests.rs | 34 +++++++++++++++++++++++++ docs/ui-parity.md | 5 ++-- 5 files changed, 92 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index bb8c7329d0..1af4ac40f0 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -2757,6 +2757,42 @@ fn cmd_alt_lends_group_selection_while_direct_selection_is_active() { s.pointer(&PointerEvent::new(PointerKind::Up, 80.0, 80.0).with_mods(cmd_alt), v).unwrap(); } +#[test] +fn cmd_lends_the_selection_tool_and_its_bounding_box_to_direct_selection() { + // #3901: with Direct Selection, Cmd held gives the Selection tool for the press: its cursor, + // and its bounding box's handles scale the object; Direct Selection is back on the release. + let (none, cmd) = (Mods::default(), Mods { cmd: true, ..Mods::default() }); + let v = view(); + let mut s = session(); + 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.select_tool("directSelection", v).unwrap(); + assert_eq!(s.lent_tool_id(&none), None); + assert_eq!(s.lent_tool_id(&cmd), Some("selection")); + // The path selected whole: the bottom-right handle scales it. + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + assert_eq!(s.cursor(Point::new(200.0, 200.0), cmd, v), vectorcraft_tools::Cursor::ResizeNwSe); + s.pointer(&PointerEvent::new(PointerKind::Down, 200.0, 200.0).with_mods(cmd), v).unwrap(); + assert_eq!(s.tool_id(), "selection"); + for at in [250.0, 300.0] { + s.pointer(&PointerEvent::new(PointerKind::Drag, at, at).with_mods(cmd), v).unwrap(); + } + s.pointer(&PointerEvent::new(PointerKind::Up, 300.0, 300.0).with_mods(cmd), v).unwrap(); + assert_eq!(s.tool_id(), "directSelection"); + let b = s.doc().unwrap().doc.node(id).unwrap().geometric_bounds().unwrap(); + assert!((b.x0 - 100.0).abs() < 1e-6 && (b.x1 - 300.0).abs() < 1e-6 && (b.y1 - 300.0).abs() < 1e-6, "{b:?}"); + // An anchor selected: a Cmd drag inside moves the whole path and the anchor stays selected. + gesture(&mut s, &[(300.0, 300.0)], none); + let picked = s.doc().unwrap().selection.anchors.clone(); + assert!(!picked.is_empty(), "Direct Selection picked the anchor"); + let before: Vec<_> = path(&s, id).subpaths[0].anchors.iter().map(|a| a.p).collect(); + gesture(&mut s, &[(150.0, 150.0), (160.0, 160.0), (170.0, 150.0)], cmd); + let after: Vec<_> = path(&s, id).subpaths[0].anchors.iter().map(|a| a.p).collect(); + assert_eq!(after, before.iter().map(|p| *p + kurbo::Vec2::new(20.0, 0.0)).collect::>()); + assert_eq!(s.doc().unwrap().selection.anchors, picked, "the anchor is still selected"); + assert_eq!(s.tool_id(), "directSelection"); +} + #[test] fn the_pen_drops_the_new_path_asterisk_once_a_path_is_started() { // The Pen's asterisk means a click starts a new path: it shows until the first anchor is diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 18e8da3d59..66d84a925b 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -154,6 +154,8 @@ impl Session { /// Direct Selection to the tools that edit anchors (the Pen) and Selection to the others. /// Cmd+Alt lends Group Selection while Direct Selection is active. Cmd still lends the last /// selection tool from other tools (Alt on the lent Direct Selection gesture stays copy/subtract). + /// Cmd alone lends Direct Selection the Selection tool, whose bounding box transforms the + /// object (#3901; ). /// Perspective Selection keeps Cmd+Alt drags to copy objects on their perspective plane. /// None for the other selection tools and the view tools. fn lent_tool(&self, id: &str, mods: &Mods) -> Option<&'static str> { @@ -161,8 +163,8 @@ impl Session { if matches!(id, "hand" | "zoom" | "rotateView") { return None; } - if id == "directSelection" && mods.cmd && mods.alt { - return Some("groupSelection"); + if id == "directSelection" && mods.cmd { + return Some(if mods.alt { "groupSelection" } else { "selection" }); } if id == "perspectiveSelection" && mods.cmd && mods.alt { return None; @@ -173,6 +175,16 @@ impl Session { Some(self.last_selection_tool.unwrap_or(if edits_anchors(id) { "directSelection" } else { "selection" })) } + /// The selection tool a press with `mods` would borrow from the active tool + /// ([`Self::lend_selection_tool`]), as [`Self::cursor`] shows it: the canvas also shows what + /// that tool shows (Direct Selection with Cmd held shows the bounding box). + pub fn lent_tool_id(&self, mods: &Mods) -> Option<&'static str> { + if !mods.cmd || self.lender.is_some() { + return None; + } + self.lent_tool(self.tool.id(), mods) + } + /// A press with Cmd held (Ctrl elsewhere) and any other tool than a selection tool: the /// selection tool [`Self::lent_tool`] takes the gesture, pressing without Cmd (a plain click, /// not Select Behind). The tool lent to stays as it was, unaware, until the release. diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index d2b2bcfb68..206b095cab 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -100,7 +100,11 @@ pub(super) fn selection_overlay(app: &mut VectorcraftApp, p: &egui::Painter, xf: let shape_tool = vectorcraft_tools::shape::shows_shape_widgets(app.session.tool_id()); // A shape tool drawing a shape shows none of this; adjusting a widget, it shows the widgets. let drawing = shape_tool && app.session.tool_busy() && !app.session.tool_transforming(); - let show_box = (app.session.tool_id() == "selection" || (shape_tool && !app.session.tool_busy())) + // Cmd held lends the Selection tool to a press (Direct Selection's included, #3901): its box + // shows while the key is down, where its handles take that press. + let held = super::drag::mods(p.ctx().input(|i| i.modifiers), false); + let lends_selection = !app.session.tool_busy() && app.session.lent_tool_id(&held) == Some("selection"); + let show_box = (app.session.tool_id() == "selection" || lends_selection || (shape_tool && !app.session.tool_busy())) && (!app.session.tool_transforming() || moved.is_some()) && app.ui.view.bounding_box && app.session.active().is_some_and(|st| !st.selection.is_empty() && st.selection.anchors.is_empty()); diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 9d5b3e8825..dcb9b5312f 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -9268,3 +9268,37 @@ fn the_render_worker_waits_for_a_frame_only_as_long_as_asked() { assert!(w.wait(std::time::Duration::from_secs(5)).is_some(), "finished during the wait"); sender.join().unwrap(); } + +/// #3901: with Direct Selection, the Selection tool's bounding box shows while Cmd/Ctrl is held +/// (a press then takes its handles), and not otherwise. +#[test] +fn direct_selection_shows_the_bounding_box_while_cmd_is_held() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let id = app.run("shape.rectangle", json!({"x": 100, "y": 100, "width": 100, "height": 50})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [id]})).unwrap(); + app.select_tool("directSelection"); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + let corner = xf.to_screen(Point::new(200.0, 150.0)); + // A frame with `modifiers` held → is a white box handle drawn at the bottom-right corner? + let handle_drawn = |app: &mut VectorcraftApp, modifiers: egui::Modifiers| { + let screen = Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))); + let raw = egui::RawInput { screen_rect: screen, events: vec![egui::Event::ModifiersChanged(modifiers)], ..Default::default() }; + let out = ctx.run_ui(raw, |ui| show(app, ui)); + fn flat(s: Shape, out: &mut Vec) { + match s { + Shape::Vec(v) => v.into_iter().for_each(|s| flat(s, out)), + s => out.push(s), + } + } + let mut v = vec![]; + out.shapes.into_iter().for_each(|c| flat(c.shape, &mut v)); + v.iter().any(|s| matches!(s, Shape::Rect(r) if r.fill == Color32::WHITE && (r.rect.width() - 6.0).abs() < 1.0 && r.rect.center().distance(corner) < 0.5)) + }; + assert!(!handle_drawn(&mut app, egui::Modifiers::NONE), "Direct Selection alone shows no box"); + assert!(handle_drawn(&mut app, egui::Modifiers::COMMAND), "Cmd held shows the Selection tool's box"); + assert!(!handle_drawn(&mut app, egui::Modifiers::NONE), "gone once Cmd is released"); + assert!(app.ui.view.bounding_box, "View › Show Bounding Box is unchanged"); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 570bd4817a..b806eafe2d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Join tool: scrubbing the overhanging ends of two crossing paths trims them and joins the paths at the crossing, #5844; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence @@ -38,6 +38,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-05 | minor | Direct Selection: Cmd/Ctrl held lends the Selection tool, whose bounding box shows while the key is down over objects selected whole; its handles scale and rotate, and a Cmd drag moves the whole object with its direct-selected anchors kept (#3901); scores and estimates unchanged | | 2026-11-05 | minor | Join tool: scrubbing over the ends of two crossing open paths that run past the crossing trims those ends and joins the paths there with a corner, instead of drawing a segment between the ends (#5844); scores and estimates unchanged | | 2026-11-05 | minor | Effect dialogs: a swatch beside a hex colour field follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills the field (#5365); scores and estimates unchanged | | 2026-11-05 | minor | Shape tools: a shape just drawn keeps its bounding box and Live Shape widgets on show with the Rectangle, Rounded Rectangle, Ellipse, Polygon or Star tool, and its corner and pie widgets drag as with the Selection tool (#5477); scores and estimates unchanged | @@ -263,7 +264,7 @@ tools, never checked side by side) isn't captured row by row. |---|---|---| | Space: Hand; Cmd+Space / Cmd+Alt+Space: zoom in/out; middle button pans | done | Space pressed after a tool takes a drag keeps the view still and shows that tool's cursor. Shape and anchor tools may use Space to move the geometry being drawn. Cmd+Space pressed mid-drag likewise keeps the active tool cursor. Space held before a press starts a view gesture, and its view cursor returns after release. `space_during_a_pencil_drag_keeps_the_pencil_cursor`, `cmd_space_mid_tool_drag_keeps_the_active_tool_cursor` | | Document window scroll bars along the right and bottom edges (Normal and Full Screen Mode with Menu Bar; none in Full Screen and Presentation Mode): a thumb as long as the view against the art and the artboards; dragging it scrolls, a click on the track pages, the wheel over a bar scrolls along it; in a rotated view they follow the screen's axes | partial | #2322. The span is the art and the artboards with half a window around them, not Illustrator's 227 in canvas: VectorCraft has no bounded drawing area (#2284). A track click pages rather than jumping to the click; the page size and the rotated-view behaviour are our own choice (the public documentation gives neither) | -| Cmd/Ctrl: last-used selection tool; Cmd+Alt: Group Selection inside Direct Selection | done | Cmd+Alt lends Group Selection only while Direct Selection is active (Cmd borrow from the Pen keeps Direct Selection so Alt stays copy/subtract); engine pointer regressions | +| Cmd/Ctrl: last-used selection tool; Cmd+Alt: Group Selection inside Direct Selection | done | Cmd+Alt lends Group Selection only while Direct Selection is active (Cmd borrow from the Pen keeps Direct Selection so Alt stays copy/subtract); Cmd alone lends Direct Selection the Selection tool: its bounding box shows while Cmd is held over objects selected whole and its handles scale and rotate them, and a Cmd drag moves the whole object while its direct-selected anchors stay selected (#3901; no box over a selection with anchors picked yet); engine pointer and canvas regressions | | Eyedropper styles highlighted characters only and preserves ranges across Type switches | done | Font/paint, Shift color-only, Unicode, Undo/Redo and stale-range regression tests; enabled non-neutral source or target object transparency is refused atomically; disable Transparency to sample supported attributes | | Eyedropper reads visible sources while their layer/object is locked or outside isolation | done | Ordinary/Shift/Shift+Alt and gradient-stop reads preserve the source and selection; Alt reverse remains editable-only; hidden art stays excluded (`eyedropper_sources.rs`, #1251) | | Add a visible stroke after drawing with inherited None/zero-width paint | done | Paint and Swap Fill/Stroke restore the existing 1 pt default; positive widths and painted zero widths stay as set; Undo/Redo and targeted appearance items tested (`stroke_visibility.rs`, #1253) | From 8236a8e006d4e10189026b5b4dfb437de62cd45e Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:31:38 -0500 Subject: [PATCH 07/56] SVG import: textLength and lengthAdjust fit text to its length (#5842) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVG text with a textLength came in at its natural width. Following SVG 1.1 §10.9.1, the characters of each text or tspan with a textLength are now fitted to it: by spacing them out (lengthAdjust="spacing", the default), which becomes kerning, or by stretching them (spacingAndGlyphs), which becomes horizontal scale (kept within 1–10000%). Inner elements are fitted first; vertical text is spaced out only, with a warning for spacingAndGlyphs. Negative lengths are ignored. --- crates/svg/src/import/text.rs | 48 ++++++++++++++++++++++++++++++ crates/svg/tests/it/import_text.rs | 37 +++++++++++++++++++++++ crates/svg/tests/it/prop_svg.rs | 21 +++++++++++++ 3 files changed, 106 insertions(+) diff --git a/crates/svg/src/import/text.rs b/crates/svg/src/import/text.rs index 57a156b82e..2502bd2bd6 100644 --- a/crates/svg/src/import/text.rs +++ b/crates/svg/src/import/text.rs @@ -503,6 +503,53 @@ impl Ctx { out.spans[slot].1 = start..out.chars.len(); } + /// `textLength` and `lengthAdjust` (SVG 1.1 §10.9.1, + /// https://www.w3.org/TR/SVG11/text.html#TextElementTextLengthAttribute): the characters of + /// each element with a `textLength` are fitted to that advance, by adding the difference evenly + /// between them (`spacing`, the default; it becomes kerning) or by stretching them + /// (`spacingAndGlyphs`; it becomes horizontal scale, kept within 1–10000%). Innermost elements + /// first, so an element's length takes in its children's. Vertical type is spaced out only. + fn fit_lengths(&self, spans: &[(XNode, Range)], cells: &mut [Cell], vertical: bool, label: &str, warnings: &mut Vec) { + let n = cells.len(); + for (el, r) in spans.iter().rev() { + let Some(want) = el.attribute("textLength").and_then(|v| self.length(v, self.font_size(*el), self.viewport.0)).filter(|w| *w >= 0.0) + else { + continue; + }; + // Past the largest coordinate, the characters would only be out of reach. + let want = want.min(vectorcraft_doc::MAX_COORD); + let Some(part) = cells.get_mut(r.start.min(n)..r.end.min(n)) else { continue }; + let Some(gaps) = part.len().checked_sub(1) else { continue }; + let stretch = el.attribute("lengthAdjust").map(str::trim) == Some("spacingAndGlyphs"); + if stretch && vertical { + warnings.push(format!("{label}: lengthAdjust=\"spacingAndGlyphs\" on vertical text spaces the characters out instead")); + } + // Kerning and scale change shaping (manual kerning turns pair kerning off): measure again. + for _ in 0..4 { + let have = advance(&point_text(part)); + if !have.is_finite() || (want - have).abs() < 0.01 { + break; + } + if stretch && !vertical { + let k = want / have; + if !k.is_finite() || k <= 0.0 { + break; + } + for c in part.iter_mut() { + c.style.h_scale = (c.style.h_scale * k).clamp(1.0, 10_000.0); + } + } else if gaps > 0 { + let d = (want - have) / gaps as f64; + for c in part.iter_mut().take(gaps) { + c.kern += d; + } + } else { + break; + } + } + } + } + /// The path a `` follows, in the text's user space. fn text_path(&self, xml: &roxmltree::Document, tp: XNode) -> Option { let mut bp = match tp.attribute("path") { @@ -730,6 +777,7 @@ impl Ctx { } }); let vertical = self.css.prop(t, "writing-mode").is_some_and(|m| m.starts_with("tb") || m.starts_with("vertical")); + self.fit_lengths(&cs.spans, &mut cells, vertical, label, warnings); let mut obj = TextObject::point(Point::ZERO, "", CharStyle::default()); let mut breaks: Vec = vec![]; let mut para_styles: Vec = vec![]; diff --git a/crates/svg/tests/it/import_text.rs b/crates/svg/tests/it/import_text.rs index 5fa2b5d7f2..7d0e08c0be 100644 --- a/crates/svg/tests/it/import_text.rs +++ b/crates/svg/tests/it/import_text.rs @@ -693,3 +693,40 @@ fn flowed_text_that_cannot_be_read_is_reported() { assert!(w.iter().any(|w| w.contains(id) && w.contains("flowRoot")), "{id}: {w:?}"); } } + +/// Total advance of a single-line text. +fn advance(t: &TextObject) -> f64 { + layout(FontDb::global(), t).glyphs.iter().map(|g| g.advance).sum() +} + +/// SVG 1.1 §10.9.1: `textLength` fits the characters to that advance, by spacing them out +/// (`lengthAdjust="spacing"`, the default) or by stretching them (`spacingAndGlyphs`). +/// https://www.w3.org/TR/SVG11/text.html#TextElementTextLengthAttribute +#[test] +fn text_length_fits_the_advance() { + let natural = advance(only_text(&open(r#"Hello World"#))); + for adjust in ["spacingAndGlyphs", "spacing"] { + for want in [50.0, 150.0, 300.0] { + let (d, w) = import_with_report(&svg(&format!( + r#"Hello World"# + ))) + .unwrap(); + assert!(w.is_empty(), "{w:?}"); + let t = only_text(&d); + assert_eq!(t.plain_text(), "Hello World"); + let got = advance(t); + assert!(close(got, want, 0.05), "{adjust} {want}: {got} (natural {natural})"); + let scaled = t.runs.iter().all(|r| close(r.style.h_scale, 100.0 * want / natural, 0.5)); + assert_eq!(scaled, adjust == "spacingAndGlyphs", "{adjust} {want}: {:?}", t.runs); + } + } + // On a tspan, only its characters are fitted; units and percentages of the viewport resolve. + let t = open(r#"Hi there!"#); + let t = only_text(&t); + let lay = layout(FontDb::global(), t); + let span: f64 = lay.glyphs.iter().filter(|g| (3..8).contains(&g.byte)).map(|g| g.advance).sum(); + assert!(close(span, 100.0, 0.05), "{span}"); + // A negative length is ignored. + let t = open(r#"Hello World"#); + assert!(close(advance(only_text(&t)), natural, 1e-6)); +} diff --git a/crates/svg/tests/it/prop_svg.rs b/crates/svg/tests/it/prop_svg.rs index a25aec175e..2dd7ceec13 100644 --- a/crates/svg/tests/it/prop_svg.rs +++ b/crates/svg/tests/it/prop_svg.rs @@ -82,6 +82,27 @@ proptest! { let _ = import(&format!("{s}")); } + /// Any `textLength` and `lengthAdjust`, on the text or a tspan (vertical too), imports to a + /// valid document without panicking. + #[test] + fn import_random_text_lengths( + len in "-?[0-9]{0,12}(\\.[0-9]{0,4})?(e[+-]?[0-9]{1,3})?(%|px|em|pt)?|[a-z ]{0,6}", + adjust in "spacing|spacingAndGlyphs|[a-zA-Z]{0,8}", + text in "[A-Za-z \u{5d0}-\u{5ea}]{0,12}", + on_span in any::(), + vertical in any::(), + ) { + let attrs = format!("textLength=\"{len}\" lengthAdjust=\"{adjust}\""); + let (outer, inner) = if on_span { ("", attrs.as_str()) } else { (attrs.as_str(), "") }; + let wm = if vertical { " writing-mode=\"tb\"" } else { "" }; + let svg = format!( + "a{text}b" + ); + if let Ok(doc) = import(&svg) { + check_document(&doc).map_err(TestCaseError::fail)?; + } + } + /// Importing random path data never panics and gives a valid document. #[test] fn import_random_path_data(d in "[MLCQZHVAmlcqzhva0-9 .,eE+-]{0,80}") { From dfe628e90629ec902b31de81af5fd6551dbdb657 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:54:53 -0500 Subject: [PATCH 08/56] Blend spine: Shift-click picks several spine points, which drag together (#5285) Direct Selection kept only one picked point of a blend's spine. Shift-click now adds a point of the same spine or takes it away, and dragging any picked point moves them all. object.blend.spine.moveAnchor takes `with`, the other points to move by as much, with the key objects on them, in one undo step. --- crates/engine/src/cmd/live/blend.rs | 27 +++++++++++++++-- crates/engine/src/cmd/live/commands.rs | 2 +- crates/engine/src/tests/blendspine.rs | 28 +++++++++++++++++ crates/tools/src/direct.rs | 42 +++++++++++++++++++++++--- crates/tools/src/direct/tests.rs | 39 ++++++++++++++++++++++++ crates/ui-egui/src/i18n/bg.tsv | 2 ++ crates/ui-egui/src/i18n/bs.tsv | 2 ++ crates/ui-egui/src/i18n/ca.tsv | 2 ++ crates/ui-egui/src/i18n/cs.tsv | 2 ++ crates/ui-egui/src/i18n/de.tsv | 2 ++ crates/ui-egui/src/i18n/el.tsv | 2 ++ crates/ui-egui/src/i18n/es.tsv | 2 ++ crates/ui-egui/src/i18n/fi.tsv | 2 ++ crates/ui-egui/src/i18n/fr.tsv | 2 ++ crates/ui-egui/src/i18n/hu.tsv | 2 ++ crates/ui-egui/src/i18n/it.tsv | 2 ++ crates/ui-egui/src/i18n/ja.tsv | 2 ++ crates/ui-egui/src/i18n/ka.tsv | 2 ++ crates/ui-egui/src/i18n/ko.tsv | 2 ++ crates/ui-egui/src/i18n/nl.tsv | 2 ++ crates/ui-egui/src/i18n/pl.tsv | 2 ++ crates/ui-egui/src/i18n/pt-br.tsv | 2 ++ crates/ui-egui/src/i18n/ru.tsv | 2 ++ crates/ui-egui/src/i18n/sv.tsv | 2 ++ crates/ui-egui/src/i18n/tests.rs | 6 ++++ crates/ui-egui/src/i18n/tr.tsv | 2 ++ crates/ui-egui/src/i18n/uk.tsv | 2 ++ crates/ui-egui/src/i18n/vi.tsv | 2 ++ crates/ui-egui/src/i18n/zh-hans.tsv | 2 ++ crates/ui-egui/src/i18n/zh-hant.tsv | 2 ++ docs/ui-parity.md | 4 ++- 31 files changed, 187 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/live/blend.rs b/crates/engine/src/cmd/live/blend.rs index 73f0922145..e8b3941202 100644 --- a/crates/engine/src/cmd/live/blend.rs +++ b/crates/engine/src/cmd/live/blend.rs @@ -1,3 +1,5 @@ +use std::collections::BTreeSet; + use super::common::{ DEFAULT_DISTANCE, DEFAULT_STEPS, ease_param, fix_ids, ids_json, is_blend, orientation_param, percent_param, roots_param, selected_of, spacing_param, starts_param, wrap, @@ -180,6 +182,17 @@ fn finite_point(p: &Value, cmd: &str) -> Result { if q.x.is_finite() && q.y.is_finite() && q.x.abs() < 1e9 && q.y.abs() < 1e9 { Ok(q) } else { Err(bad(cmd, "x and y must be finite")) } } +/// Most spine points `with` names. +const MAX_SPINE_POINTS: usize = 10_000; + +/// The optional `with` list of spine point indexes (empty when absent). +fn spine_points_param(p: &Value, cmd: &str) -> Result> { + let Some(v) = p.get("with").filter(|v| !v.is_null()) else { return Ok(vec![]) }; + let wrong = || bad(cmd, "`with` must be a list of at most 10000 spine point indexes"); + let list = v.as_array().filter(|l| l.len() <= MAX_SPINE_POINTS).ok_or_else(wrong)?; + list.iter().map(|i| i.as_u64().and_then(|i| usize::try_from(i).ok()).ok_or_else(wrong)).collect() +} + pub(super) fn spine_move_anchor(s: &mut Session, p: &Value) -> Result { const C: &str = "object.blend.spine.moveAnchor"; let index = index_param(p, "anchor", C)?; @@ -191,6 +204,10 @@ pub(super) fn spine_move_anchor(s: &mut Session, p: &Value) -> Result { Some(_) => return Err(bad(C, "handle must be in or out")), }; let independent = switch_or(p, "independent", false, C)?; + let with = spine_points_param(p, C)?; + if handle.is_some() && !with.is_empty() { + return Err(bad(C, "`with` moves points, not a handle")); + } edit_spine(s, p, C, "Reshape Spine", |sp, anchors, keys| { let a = sp.anchors.get_mut(index).ok_or_else(|| bad(C, "no such spine point"))?; if let Some(out) = handle { @@ -198,9 +215,13 @@ pub(super) fn spine_move_anchor(s: &mut Session, p: &Value) -> Result { return Ok(()); } let delta = q - a.p; - a.translate(delta); - // The key objects on the point move with it. - for (k, _) in anchors.iter().enumerate().filter(|(_, a)| **a == index) { + // The other points selected with it (#5285) move as far. + let moved: BTreeSet = with.iter().copied().chain([index]).collect(); + for &i in &moved { + sp.anchors.get_mut(i).ok_or_else(|| bad(C, "no such spine point"))?.translate(delta); + } + // The key objects on the points move with them. + for (k, _) in anchors.iter().enumerate().filter(|(_, a)| moved.contains(*a)) { if let Some(key) = keys.get_mut(k) { Arc::make_mut(key).transform(Affine::translate(delta), false); } diff --git a/crates/engine/src/cmd/live/commands.rs b/crates/engine/src/cmd/live/commands.rs index 99c813fa3e..abd88c3777 100644 --- a/crates/engine/src/cmd/live/commands.rs +++ b/crates/engine/src/cmd/live/commands.rs @@ -81,7 +81,7 @@ pub fn specs() -> Vec { "Move Spine Point", [], None, - "{id? (default: the selected blend), anchor: index, x, y, handle?: in|out, independent?: bool} move a point of the blend's spine (its handles along), or with `handle` place that handle's end at (x, y) (a smooth point keeps the other handle in line unless `independent`). A key object sitting on the point moves with it. The first edit turns the straight spine into a path", + "{id? (default: the selected blend), anchor: index, x, y, with?: [index…], handle?: in|out, independent?: bool} move a point of the blend's spine (its handles along), and the points `with` names by as much, or with `handle` place that handle's end at (x, y) (a smooth point keeps the other handle in line unless `independent`). A key object sitting on a moved point moves with it. The first edit turns the straight spine into a path", has_doc, spine_move_anchor ), diff --git a/crates/engine/src/tests/blendspine.rs b/crates/engine/src/tests/blendspine.rs index 5db598a197..90e60bbb93 100644 --- a/crates/engine/src/tests/blendspine.rs +++ b/crates/engine/src/tests/blendspine.rs @@ -66,6 +66,34 @@ fn a_spine_point_added_and_moved_bends_the_blend() { assert!(center(&steps(&s, g)[1]).distance(Point::new(55.0, 5.0)) < 1e-6); } +/// #5285: `with` moves other spine points by as much as the one dragged, and the key objects on +/// them along, in one undo step; it can't go with a handle or name a point the spine lacks. +#[test] +fn spine_points_move_together() { + let mut s = session(); + let (a, b, g) = blend(&mut s); + s.execute("object.blend.spine.addAnchor", &json!({"x": 55, "y": 5})).unwrap(); + let before = spec(&s, g); + assert!(s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": [9]})).is_err()); + assert!(s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": [2], "handle": "in"})).is_err()); + assert!(s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": "2"})).is_err()); + assert_eq!(spec(&s, g), before, "refused requests change nothing"); + s.execute("object.blend.spine.moveAnchor", &json!({"anchor": 1, "x": 55, "y": 45, "with": [2, 1]})).unwrap(); + let sp = spec(&s, g).spine.unwrap(); + let pts: Vec = sp.subpaths[0].anchors.iter().map(|x| x.p).collect(); + let want = [Point::new(5.0, 5.0), Point::new(55.0, 45.0), Point::new(105.0, 45.0)]; + assert!(pts.len() == 3 && pts.iter().zip(want).all(|(p, w)| p.distance(w) < 1e-9), "{pts:?}"); + let keys = match node(&s, g).kind { + NodeKind::Blend { children, .. } => children, + _ => panic!("not a blend"), + }; + let at = |id: NodeId| keys.iter().find(|k| k.id == id).map(|k| center(k)).unwrap(); + assert!(at(b).distance(Point::new(105.0, 45.0)) < 1e-9, "the key on the point went along: {:?}", at(b)); + assert!(at(a).distance(Point::new(5.0, 5.0)) < 1e-9, "the other stayed: {:?}", at(a)); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(spec(&s, g), before, "one undo step"); +} + /// #2544: an Anchor Point drag on a blend spine must create two symmetric /// handles, not bend the adjacent segment and leave one handle behind. #[test] diff --git a/crates/tools/src/direct.rs b/crates/tools/src/direct.rs index 71f0c1983b..42cb495c8f 100644 --- a/crates/tools/src/direct.rs +++ b/crates/tools/src/direct.rs @@ -25,8 +25,9 @@ //! Both pick the key objects of a blend, and click or drag ruler guides ([`crate::rulerguide`]). //! A Cmd/Ctrl+Shift double-click with either one releases the ruler guide or guide path under the //! pointer ([`release_guide_at`]). -//! Direct Selection also edits a blend's spine: drag its points (a key object on a point moves -//! with it) and, once a point is clicked, its handles; and the points of selected gradient meshes +//! Direct Selection also edits a blend's spine: drag its points (Shift-click picks several, which +//! drag together; a key object on a point moves with it) and, once a point is clicked, its +//! handles; and the points of selected gradient meshes //! and mesh envelopes and their handles ([`MeshEdit`]): Shift-clicks and the marquee pick several, //! a click on a gradient mesh's line picks its two ends and one inside a patch the four points //! around it, a drag of picked points moves them all, the arrow keys nudge them, and a solid fill @@ -182,6 +183,9 @@ pub struct DirectSelectionTool { state: State, /// The spine point last clicked (blend, anchor): its handles show and can be dragged. spine: Option<(NodeId, usize)>, + /// Other points of that spine picked with it (Shift-click adds or takes one away); dragging + /// a picked point moves them all (#5285). + spine_more: Vec, mesh: MeshEdit, /// Smart guides of the handle, anchors or objects being dragged. guides: Vec, @@ -237,6 +241,7 @@ impl DirectSelectionTool { group, state: State::Idle, spine: None, + spine_more: vec![], mesh: MeshEdit::default(), guides: vec![], anchor_snap: None, @@ -773,7 +778,8 @@ impl Tool for DirectSelectionTool { self.state = State::SpineHandle { id: sel.0, anchor: sel.1, out }; return vec![Action::Begin("Reshape Spine".into())]; } - self.spine = None; + let held = self.spine.take().filter(|(id, _)| cx.selection.contains(*id)); + let more = std::mem::take(&mut self.spine_more); self.snapped = false; if let Some(g) = self.mesh.hit(cx, &cx.selection.objects, p) { self.state = State::Mesh; @@ -789,7 +795,24 @@ impl Tool for DirectSelectionTool { return vec![Action::Begin("Reshape".into())]; } if let Some((id, anchor, from)) = hit_spine_point(cx, p, point) { + // The points of this spine picked before: Shift-click adds the point or takes + // it away; a plain click on one of them keeps them all, to drag together. + let mut picked: Vec = + held.filter(|(h, _)| *h == id).map(|(_, a)| more.into_iter().chain([a]).collect()).unwrap_or_default(); + if ev.mods.shift + && let Some(k) = picked.iter().position(|a| *a == anchor) + { + picked.remove(k); + self.spine = picked.pop().map(|a| (id, a)); + self.spine_more = picked; + return vec![]; + } + if !ev.mods.shift && !picked.contains(&anchor) { + picked.clear(); + } + picked.retain(|a| *a != anchor); self.spine = Some((id, anchor)); + self.spine_more = picked; self.state = State::SpinePoint { id, anchor, from, start: p, began: false }; return if cx.selection.contains(id) { vec![] } else { vec![Action::Exec("select.set".into(), json!({"ids": [id.0]}))] }; } @@ -873,7 +896,12 @@ impl Tool for DirectSelectionTool { self.state = State::SpinePoint { id, anchor, from, start, began: true }; } let q = from + move_delta(start, p, ev.mods.shift, cx.constrain_angle); - out.push(Action::Preview("object.blend.spine.moveAnchor".into(), json!({"id": id.0, "anchor": anchor, "x": q.x, "y": q.y}))); + let mut params = json!({"id": id.0, "anchor": anchor, "x": q.x, "y": q.y}); + let with: Vec = self.spine_more.iter().copied().filter(|a| spine_anchor(cx, (id, *a)).is_some()).collect(); + if !with.is_empty() { + params["with"] = json!(with); + } + out.push(Action::Preview("object.blend.spine.moveAnchor".into(), params)); out } (PointerKind::Drag, State::SpineSegment { id, seg, t, start, began }) => { @@ -1139,6 +1167,12 @@ impl DirectSelectionTool { out.push(Overlay::Handle { p: h, color }); } out.push(Overlay::Anchor { p: a.p, color, filled: true, size: 5.0 }); + out.extend(self.spine_more.iter().filter_map(|i| spine_anchor(cx, (sel.0, *i))).map(|m| Overlay::Anchor { + p: m.p, + color, + filled: true, + size: 5.0, + })); out } } diff --git a/crates/tools/src/direct/tests.rs b/crates/tools/src/direct/tests.rs index 47a1dac0e1..c1748cac9f 100644 --- a/crates/tools/src/direct/tests.rs +++ b/crates/tools/src/direct/tests.rs @@ -182,6 +182,45 @@ fn dragging_a_spine_point_moves_it() { assert!(t.overlays(&cx).iter().any(|o| matches!(o, Overlay::Anchor { filled: true, .. })), "the clicked point shows"); } +/// #5285: Shift-click picks several points of a blend's spine, as of a path; dragging one of them +/// moves them all (`with`), and Shift-click on a picked point takes it away again. +#[test] +fn shift_click_picks_several_spine_points_which_drag_together() { + let (mut d, g, _) = blend_doc(); + let sp = vectorcraft_geom::SubPath::polyline(&[Point::new(110.0, 310.0), Point::new(160.0, 310.0), Point::new(210.0, 310.0)], false); + let Some(NodeKind::Blend { spec, .. }) = d.node_mut(g).map(|n| &mut n.kind) else { panic!("blend") }; + (spec.spine, spec.key_anchors) = (Some(PathData::single(sp)), vec![0, 2]); + let mut s = Selection::default(); + s.set([g]); + let p = paint(); + let cx = cx(&d, &s, &p); + let shift = Mods { shift: true, ..Mods::default() }; + let filled = |t: &DirectSelectionTool| t.overlays(&cx).iter().filter(|o| matches!(o, Overlay::Anchor { filled: true, .. })).count(); + let mut t = DirectSelectionTool::new(false); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 160.0, 310.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 160.0, 310.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 210.0, 310.0).with_mods(shift)); + assert_eq!(filled(&t), 2, "both picked points show"); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 210.0, 330.0)); + assert_eq!( + a.last(), + Some(&Action::Preview("object.blend.spine.moveAnchor".into(), json!({"id": g.0, "anchor": 2, "x": 210.0, "y": 330.0, "with": [1]}))) + ); + assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 210.0, 330.0)), vec![Action::Commit]); + // A plain press on a picked point keeps both. + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 160.0, 310.0)); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 160.0, 300.0)); + assert!(matches!(a.last(), Some(Action::Preview(_, v)) if v["anchor"] == 1 && v["with"] == json!([2])), "{a:?}"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 160.0, 300.0)); + // Shift-click takes one away; a plain click on another point picks it alone. + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 210.0, 310.0).with_mods(shift)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 210.0, 310.0).with_mods(shift)); + assert_eq!(filled(&t), 1); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 110.0, 310.0)); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 110.0, 330.0)); + assert!(matches!(a.last(), Some(Action::Preview(_, v)) if v["anchor"] == 0 && v.get("with").is_none()), "{a:?}"); +} + /// #1111: the Anchor Point tool bends a selected blend's straight spine; Direct Selection /// reshapes a curved spine segment and leaves a straight one alone, as it does a path's. #[test] diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 28bc3eff53..e60b76cefa 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -4196,6 +4196,8 @@ axis Both И двете @msg no such saved selection няма такава запазена селекция @msg no such segment няма такъв сегмент @msg no such spine point няма такава точка от оста +@msg `with` must be a list of at most 10000 spine point indexes `with` трябва да е списък с най-много 10000 индекса на точки от оста +@msg `with` moves points, not a handle `with` мести точки, не дръжка @msg no such spine segment няма такъв сегмент от оста @msg no such subpath няма такъв подпът @msg no such user library няма такава потребителска библиотека diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index eb2b821a35..0d95e80181 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4591,6 +4591,8 @@ imageTrace Outline Obris @msg no such saved selection nema takvog sačuvanog odabira @msg no such segment nema takvog segmenta @msg no such spine point nema takve tačke kičme +@msg `with` must be a list of at most 10000 spine point indexes `with` mora biti lista od najviše 10000 indeksa tačaka kičme +@msg `with` moves points, not a handle `with` pomjera tačke, ne ručicu @msg no such spine segment nema takvog segmenta kičme @msg no such subpath nema takve podputanje @msg no such user library nema takve korisničke biblioteke diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 847243b715..a3cb5b42aa 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5328,6 +5328,8 @@ digits Malayalam Malaiàlam @msg no such saved selection no existeix aquesta selecció desada @msg no such segment no existeix aquest segment @msg no such spine point no existeix aquest punt de l’espina +@msg `with` must be a list of at most 10000 spine point indexes `with` ha de ser una llista d’un màxim de 10000 índexs de punts de l’espina +@msg `with` moves points, not a handle `with` mou punts, no una nansa @msg no such spine segment no existeix aquest segment de l’espina @msg no such subpath no existeix aquest subtraçat @msg no such user library no existeix aquesta biblioteca d’usuari diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 2de11a60c8..063ddd591d 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4639,6 +4639,8 @@ imageTrace Outline Obrys @msg no such saved selection takový uložený výběr neexistuje @msg no such segment takový segment neexistuje @msg no such spine point takový bod páteře neexistuje +@msg `with` must be a list of at most 10000 spine point indexes `with` musí být seznam nejvýše 10000 indexů bodů páteře +@msg `with` moves points, not a handle `with` posouvá body, ne táhlo @msg no such spine segment takový segment páteře neexistuje @msg no such subpath taková dílčí cesta neexistuje @msg no such user library taková uživatelská knihovna neexistuje diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index e17e50261b..d28aa09df7 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -4248,6 +4248,8 @@ theme Appearance Erscheinungsbild @msg no such saved selection keine solche gespeicherte Auswahl @msg no such segment kein solches Segment @msg no such spine point kein solcher Achsenpunkt +@msg `with` must be a list of at most 10000 spine point indexes `with` muss eine Liste von höchstens 10000 Achsenpunkt-Indizes sein +@msg `with` moves points, not a handle `with` verschiebt Punkte, keinen Griff @msg no such spine segment kein solches Achsensegment @msg no such subpath kein solcher Teilpfad @msg no such user library keine solche Benutzerbibliothek diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 80a49e899b..16f80c7309 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -4287,6 +4287,8 @@ digits Malayalam Μαλαγιάλαμ @msg no such saved selection δεν υπάρχει τέτοια αποθηκευμένη επιλογή @msg no such segment δεν υπάρχει τέτοιο τμήμα @msg no such spine point δεν υπάρχει τέτοιο σημείο κεντρικής καμπύλης +@msg `with` must be a list of at most 10000 spine point indexes το `with` πρέπει να είναι λίστα με έως 10000 δείκτες σημείων κεντρικής καμπύλης +@msg `with` moves points, not a handle το `with` μετακινεί σημεία, όχι λαβή @msg no such spine segment δεν υπάρχει τέτοιο τμήμα κεντρικής καμπύλης @msg no such subpath δεν υπάρχει τέτοια υποδιαδρομή @msg no such user library δεν υπάρχει τέτοια βιβλιοθήκη χρήστη diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index bcd4fe12f9..fafd0122e9 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4332,6 +4332,8 @@ axis Both Ambos @msg no such saved selection no existe esa selección guardada @msg no such segment no existe ese segmento @msg no such spine point no existe ese punto del eje +@msg `with` must be a list of at most 10000 spine point indexes `with` debe ser una lista de como máximo 10000 índices de puntos del eje +@msg `with` moves points, not a handle `with` mueve puntos, no un manejador @msg no such spine segment no existe ese segmento del eje @msg no such subpath no existe ese subtrazado @msg no such user library no existe esa biblioteca de usuario diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index fde2becd0b..9c0d61be2b 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4547,6 +4547,8 @@ imageTrace Outline Ääriviiva @msg no such saved selection tallennettua valintaa ei ole @msg no such segment segmenttiä ei ole @msg no such spine point selkärangan pistettä ei ole +@msg `with` must be a list of at most 10000 spine point indexes `with`-arvon on oltava luettelo, jossa on enintään 10000 selkärangan pisteen indeksiä +@msg `with` moves points, not a handle `with` siirtää pisteitä, ei kahvaa @msg no such spine segment selkärangan segmenttiä ei ole @msg no such subpath alipolkua ei ole @msg no such user library käyttäjäkirjastoa ei ole diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 4a3eb1ce03..2da80b01cf 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -4322,6 +4322,8 @@ axis Both Les deux @msg no such saved selection sélection enregistrée inexistante @msg no such segment segment inexistant @msg no such spine point point de la dorsale inexistant +@msg `with` must be a list of at most 10000 spine point indexes `with` doit être une liste d’au plus 10000 indices de points de la dorsale +@msg `with` moves points, not a handle `with` déplace des points, pas une poignée @msg no such spine segment segment de la dorsale inexistant @msg no such subpath sous-tracé inexistant @msg no such user library bibliothèque utilisateur inexistante diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index f21ca0d499..9e313975e1 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5009,6 +5009,8 @@ imageTrace Outline Körvonal @msg no such saved selection nincs ilyen mentett kijelölés @msg no such segment nincs ilyen szakasz @msg no such spine point nincs ilyen gerincpont +@msg `with` must be a list of at most 10000 spine point indexes `with`: legfeljebb 10000 gerincpont-indexből álló lista kell +@msg `with` moves points, not a handle `with` pontokat mozgat, nem fogantyút @msg no such spine segment nincs ilyen gerincszakasz @msg no such subpath nincs ilyen részútvonal @msg no such user library nincs ilyen felhasználói könyvtár diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 68c1f23fb0..3459374cad 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4374,6 +4374,8 @@ axis Both Entrambi @msg no such saved selection selezione salvata inesistente @msg no such segment segmento inesistente @msg no such spine point punto della dorsale inesistente +@msg `with` must be a list of at most 10000 spine point indexes `with` deve essere un elenco di al massimo 10000 indici di punti della dorsale +@msg `with` moves points, not a handle `with` sposta punti, non una maniglia @msg no such spine segment segmento della dorsale inesistente @msg no such subpath sottotracciato inesistente @msg no such user library libreria utente inesistente diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index e230d5767a..715f1fc461 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -4153,6 +4153,8 @@ swatch Bright Violet ビビッドバイオレット @msg no such anchor 指定されたアンカーポイントが見つかりません @msg no such segment 指定されたセグメントが見つかりません @msg no such spine point 指定されたスパインポイントが見つかりません +@msg `with` must be a list of at most 10000 spine point indexes `with` には最大 10000 個のスパインポイントのインデックスのリストを指定してください +@msg `with` moves points, not a handle `with` はポイントを移動します。ハンドルには使えません @msg no such spine segment 指定されたスパインセグメントが見つかりません @msg no such subpath 指定されたサブパスが見つかりません @msg object {id} is not a path オブジェクト {id} はパスではありません diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 32293dd8ec..2c80751738 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5529,6 +5529,8 @@ imageTrace Outline კონტური @msg missing number `{key}` აკლია რიცხვი `{key}` @msg missing integer `{key}` აკლია მთელი რიცხვი `{key}` @msg no such spine point ხერხემლის ასეთი წერტილი არ არსებობს +@msg `with` must be a list of at most 10000 spine point indexes `with` უნდა იყოს ხერხემლის წერტილების არაუმეტეს 10000 ინდექსის სია +@msg `with` moves points, not a handle `with` წერტილებს გადაადგილებს და არა სახელურს @msg no such spine segment ხერხემლის ასეთი სეგმენტი არ არსებობს @msg not a blend ეს გადასვლა არ არის @msg only http, https and mailto URLs open in the browser, not “{url}” ბრაუზერში მხოლოდ http, https და mailto URL-ები იხსნება და არა „{url}“ diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 6279635559..01c96a7383 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -4080,6 +4080,8 @@ theme Appearance 외관 @msg no such anchor 해당 앵커가 없습니다 @msg no such segment 해당 세그먼트가 없습니다 @msg no such spine point 해당 스파인 포인트가 없습니다 +@msg `with` must be a list of at most 10000 spine point indexes `with`는 스파인 포인트 인덱스 최대 10000개의 목록이어야 합니다 +@msg `with` moves points, not a handle `with`는 포인트를 이동하며 핸들에는 쓸 수 없습니다 @msg no such spine segment 해당 스파인 세그먼트가 없습니다 @msg no such subpath 해당 하위 패스가 없습니다 @msg object {id} is not a path 개체 {id}은(는) 패스가 아닙니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 7b670288ee..fe34d035de 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5585,6 +5585,8 @@ swatch Bright Violet Felviolet @msg missing number `{key}` getal `{key}` ontbreekt @msg missing integer `{key}` geheel getal `{key}` ontbreekt @msg no such spine point dat aspunt bestaat niet +@msg `with` must be a list of at most 10000 spine point indexes `with` moet een lijst van hoogstens 10000 aspuntindexen zijn +@msg `with` moves points, not a handle `with` verplaatst punten, geen handgreep @msg no such spine segment dat assegment bestaat niet @msg not a blend geen vermenging @msg select a blend or give `id` selecteer een vermenging of geef `id` op diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 759ad22a2e..6bb9ee44cf 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4462,6 +4462,8 @@ imageTrace Outline Kontur @msg no such saved selection brak takiego zapisanego zaznaczenia @msg no such segment brak takiego segmentu @msg no such spine point brak takiego punktu grzbietu +@msg `with` must be a list of at most 10000 spine point indexes `with` musi być listą co najwyżej 10000 indeksów punktów grzbietu +@msg `with` moves points, not a handle `with` przesuwa punkty, nie uchwyt @msg no such spine segment brak takiego segmentu grzbietu @msg no such subpath brak takiej ścieżki podrzędnej @msg no such user library brak takiej biblioteki użytkownika diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index da5ac46f99..cbdda2921a 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -3912,6 +3912,8 @@ axis Both Ambos @msg no such saved selection seleção salva inexistente @msg no such segment segmento inexistente @msg no such spine point ponto da coluna inexistente +@msg `with` must be a list of at most 10000 spine point indexes `with` deve ser uma lista de no máximo 10000 índices de pontos da coluna +@msg `with` moves points, not a handle `with` move pontos, não uma alça @msg no such spine segment segmento da coluna inexistente @msg no such subpath subtraçado inexistente @msg no such user library biblioteca do usuário inexistente diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ec85062074..df48bf8abe 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -4369,6 +4369,8 @@ axis Both Оба @msg no such saved selection такого сохранённого выделения нет @msg no such segment такого сегмента нет @msg no such spine point такой точки остова нет +@msg `with` must be a list of at most 10000 spine point indexes `with` должен быть списком не более чем из 10000 индексов точек остова +@msg `with` moves points, not a handle `with` перемещает точки, а не маркер @msg no such spine segment такого сегмента остова нет @msg no such subpath такого вложенного контура нет @msg no such user library такой пользовательской библиотеки нет diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 2baf46b448..142a85f22c 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -4237,6 +4237,8 @@ axis Both Båda @msg no such saved selection den sparade markeringen finns inte @msg no such segment segmentet finns inte @msg no such spine point ryggradspunkten finns inte +@msg `with` must be a list of at most 10000 spine point indexes `with` måste vara en lista med högst 10000 ryggradspunktsindex +@msg `with` moves points, not a handle `with` flyttar punkter, inte ett handtag @msg no such spine segment ryggradssegmentet finns inte @msg no such subpath delbanan finns inte @msg no such user library användarbiblioteket finns inte diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 39ac29fa78..5bc0190aa6 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -1823,6 +1823,12 @@ fn blend_spine_param_errors_say_what_is_wrong() { ("object.blend.spine.moveAnchor", json!({"anchor": 0, "x": 1e12, "y": 0}), "x and y must be finite"), ("object.blend.spine.moveAnchor", json!({"anchor": 0, "x": 0, "y": 0, "handle": "up"}), "handle must be in or out"), ("object.blend.spine.moveAnchor", json!({"anchor": 5, "x": 0, "y": 0}), "no such spine point"), + ( + "object.blend.spine.moveAnchor", + json!({"anchor": 0, "x": 0, "y": 0, "with": "1"}), + "`with` must be a list of at most 10000 spine point indexes", + ), + ("object.blend.spine.moveAnchor", json!({"anchor": 0, "x": 0, "y": 0, "with": [1], "handle": "in"}), "`with` moves points, not a handle"), ("object.blend.spine.moveAnchor", json!({"id": other, "anchor": 0, "x": 0, "y": 0}), "not a blend"), ("object.blend.spine.reshapeSegment", json!({"segment": 0, "dx": 1e12}), "t, dx and dy must be finite"), ("object.blend.spine.reshapeSegment", json!({"segment": 5, "dy": 10}), "no such spine segment"), diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 312e6163bf..c296f66aa0 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5432,6 +5432,8 @@ theme Appearance Görünüm @msg mask art ends outside a mask dictionary maske çizimi bir maske sözlüğünün dışında bitiyor @msg missing number `{key}` `{key}` sayısı eksik @msg no such spine point böyle bir omurga noktası yok +@msg `with` must be a list of at most 10000 spine point indexes `with` en fazla 10000 omurga noktası dizininden oluşan bir liste olmalıdır +@msg `with` moves points, not a handle `with` noktaları taşır, tutamacı değil @msg no such spine segment böyle bir omurga segmenti yok @msg not a blend bir karışım değil @msg select a blend or give `id` bir karışım seçin veya `id` belirtin diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 47075bd0e9..5f823ba124 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4358,6 +4358,8 @@ axis Both Обидві @msg no such saved selection такого збереженого виділення немає @msg no such segment такого сегменту немає @msg no such spine point такої точки осі немає +@msg `with` must be a list of at most 10000 spine point indexes `with` має бути списком щонайбільше з 10000 індексів точок осі +@msg `with` moves points, not a handle `with` переміщує точки, а не маркер @msg no such spine segment такого сегмента осі немає @msg no such subpath такого вкладеного контуру немає @msg no such user library такої користувацької бібліотеки немає diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 2e9f19d380..7d157502cf 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -4661,6 +4661,8 @@ theme Appearance Giao diện @msg no such saved selection không có vùng chọn đã lưu như vậy @msg no such segment không có đoạn như vậy @msg no such spine point không có điểm trục như vậy +@msg `with` must be a list of at most 10000 spine point indexes `with` phải là danh sách tối đa 10000 chỉ số điểm trục +@msg `with` moves points, not a handle `with` di chuyển các điểm, không phải tay nắm @msg no such spine segment không có đoạn trục như vậy @msg no such subpath không có nhánh con như vậy @msg no such user library không có thư viện người dùng như vậy diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 65c01ada87..643b922180 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -1883,6 +1883,8 @@ file-filter Templates 模板 @msg the blend has no spine 混合对象没有脊线 @msg the spine has no segments 脊线没有线段 @msg no such spine point 没有此脊线点 +@msg `with` must be a list of at most 10000 spine point indexes `with` 必须是最多 10000 个脊线点索引的列表 +@msg `with` moves points, not a handle `with` 移动的是点,不是手柄 @msg no such spine segment 没有此脊线线段 @msg a key object sits on that point 该点上有关键对象 @msg a spine keeps at least two points 脊线至少保留两个点 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 2fe1e1872a..945626915d 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2856,6 +2856,8 @@ file-filter Templates 範本 @msg the blend has no spine 漸變物件沒有脊線 @msg the spine has no segments 脊線沒有線段 @msg no such spine point 沒有這個脊線點 +@msg `with` must be a list of at most 10000 spine point indexes `with` 必須是最多 10000 個脊線點索引的清單 +@msg `with` moves points, not a handle `with` 移動的是點,不是控制把手 @msg no such spine segment 沒有這個脊線線段 @msg a key object sits on that point 該點上有關鍵物件 @msg a spine keeps at least two points 脊線至少要保留兩個點 diff --git a/docs/ui-parity.md b/docs/ui-parity.md index b806eafe2d..20927b233e 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence @@ -38,6 +38,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-05 | minor | Direct Selection: Shift-click picks several points of a blend's spine and dragging one moves them all, with the key objects on them, in one undo step (#5285); scores and estimates unchanged | | 2026-11-05 | minor | Direct Selection: Cmd/Ctrl held lends the Selection tool, whose bounding box shows while the key is down over objects selected whole; its handles scale and rotate, and a Cmd drag moves the whole object with its direct-selected anchors kept (#3901); scores and estimates unchanged | | 2026-11-05 | minor | Join tool: scrubbing over the ends of two crossing open paths that run past the crossing trims those ends and joins the paths there with a corner, instead of drawing a segment between the ends (#5844); scores and estimates unchanged | | 2026-11-05 | minor | Effect dialogs: a swatch beside a hex colour field follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills the field (#5365); scores and estimates unchanged | @@ -135,6 +136,7 @@ tools, never checked side by side) isn't captured row by row. | Layers panel lists a blend's spine (#4820) | done | an open blend shows a `` row below its key objects, where Release leaves the spine; a click selects the blend (Shift/Cmd toggles it) so Direct Selection edits the spine; a locked blend's row selects nothing; no row while searching or filtering (`a_blends_spine_is_a_row_below_its_keys_that_selects_the_blend`) | | Layers panel: a layer whose Layer Options › Print is off shows its name italic (#5739) | done | the panel row and its drag ghost; a printing layer stays upright, and Print on again restores it; `panels::layers` test `a_layer_that_does_not_print_has_its_name_italic` | | Blend spine Anchor Point conversion and handle editing (#2544) | implemented | symmetric handles, independent drag/retraction, visible-handle policy and selection/stacking covered by tool and engine regressions; Windows native canvas checks and screenshots reviewed in PR #2643 | +| Several blend spine points picked and dragged together (#5285) | done | with Direct Selection, Shift-click picks more points of a selected blend's spine or takes one away, as on a path; dragging any picked point moves them all, and the key objects on them, in one undo step (`object.blend.spine.moveAnchor {with}`); a marquee doesn't pick spine points yet | | Add/Delete/Anchor Point tools; Anchor Point tool drags segments to reshape | done | #2267: a click on a handle end retracts that handle and leaves the anchor a corner with the other one; Shift held at the press on an anchor moves it, handles and all (Shift kept down: at 45° steps) instead of pulling out handles | | Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Fidelity goes down to 0.01 pt in the dialog, the tool and `path.freehand` (the Smooth tool keeps 0.05); its slider runs across the Tool Options row on a logarithmic rail from 0.01 to 20 pt, the field shows hundredths, and the slider's and the field's arrow keys step hundredths up to 0.1 pt, tenths up to 1 pt and whole points above (Shift ×10) (#3328); Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor while Shift or Alt is held before the press, and a path-continuation cursor over an end of a selected open path, where the line continues the path; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the shorter way round a closed path, #2850); with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path | | Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor while Shift or Alt is held before the press, and a path-continuation cursor over an end of a selected open path, where the line continues the path; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the shorter way round a closed path, #2850); with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path; a Pencil stroke from an end of one selected open path to an end of another connects the two into one path | From 316f0d62133dfc7757a9c527ea922988c3024635 Mon Sep 17 00:00:00 2001 From: Kushagra Kumar Date: Fri, 6 Nov 2026 07:23:31 +0700 Subject: [PATCH 09/56] SVG import: clip path on clipPath children clips child silhouettes before union (#5841) Squashed from #5855 onto main. --- Cargo.lock | 1 + crates/svg/Cargo.toml | 1 + crates/svg/src/import/convert.rs | 70 ++++++++++++- crates/svg/tests/it/import_details.rs | 141 ++++++++++++++++++++++++++ 4 files changed, 210 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fcb4c1124a..32cffe9fda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6471,6 +6471,7 @@ dependencies = [ "vectorcraft-doc", "vectorcraft-effects", "vectorcraft-geom", + "vectorcraft-pathops", "vectorcraft-testkit", "vectorcraft-text", ] diff --git a/crates/svg/Cargo.toml b/crates/svg/Cargo.toml index 44b8c696e4..7c506d2bb3 100644 --- a/crates/svg/Cargo.toml +++ b/crates/svg/Cargo.toml @@ -17,6 +17,7 @@ vectorcraft-doc = { workspace = true } vectorcraft-effects = { workspace = true } vectorcraft-brush = { workspace = true } vectorcraft-text = { workspace = true } +vectorcraft-pathops = { workspace = true } kurbo = { workspace = true } usvg = { workspace = true } thiserror = { workspace = true } diff --git a/crates/svg/src/import/convert.rs b/crates/svg/src/import/convert.rs index 92f5234ee6..d8cf3bcd58 100644 --- a/crates/svg/src/import/convert.rs +++ b/crates/svg/src/import/convert.rs @@ -186,22 +186,85 @@ pub(super) fn drawn_ellipse(p: &usvg::tiny_skia_path::Path) -> Option Some(PathData::single(SubPath::new(anchors, true))) } +const MAX_CLIP_DEPTH: usize = 16; + +/// Most clip paths read for one clip. They are shared, so children that each name the next one +/// multiply the work at every level: without this, a few lines of SVG would never finish. +const MAX_CLIP_READS: usize = 1024; + /// The shapes of clip path `cp` on an element whose user space `ts` maps to the document. pub(super) fn clip_shapes(cp: &usvg::ClipPath, ts: Affine) -> Vec<(BezPath, FillRule)> { - fn collect(g: &usvg::Group, m: Affine, out: &mut Vec<(BezPath, FillRule)>) { + let mut reads = MAX_CLIP_READS; + clip_shapes_depth(cp, ts, 0, &mut reads) +} + +/// Recursively collect shapes for `cp` in document space up to `MAX_CLIP_DEPTH`, and while `reads` +/// are left. +fn clip_shapes_depth(cp: &usvg::ClipPath, ts: Affine, depth: usize, reads: &mut usize) -> Vec<(BezPath, FillRule)> { + if depth > MAX_CLIP_DEPTH || *reads == 0 { + return Vec::new(); + } + *reads -= 1; + fn collect(g: &usvg::Group, m: Affine, depth: usize, reads: &mut usize, out: &mut Vec<(BezPath, FillRule)>) { for c in g.children() { match c { - usvg::Node::Group(g) => collect(g, m * aff(g.transform()), out), + usvg::Node::Group(g) => { + let m_child = m * aff(g.transform()); + if let Some(child_cp) = g.clip_path() { + let mut child_shapes = Vec::new(); + collect(g, m_child, depth + 1, reads, &mut child_shapes); + if !child_shapes.is_empty() { + let clip_paths = clip_shapes_depth(child_cp, m_child, depth + 1, reads); + intersect_shapes(&child_shapes, &clip_paths, out); + } + } else { + collect(g, m_child, depth, reads, out); + } + } usvg::Node::Path(p) => out.push((bezpath(p.data(), m), p.fill().map(|f| rule(f.rule())).unwrap_or_default())), _ => {} } } } let mut shapes = Vec::new(); - collect(cp.root(), ts * aff(cp.transform()), &mut shapes); + collect(cp.root(), ts * aff(cp.transform()), depth, reads, &mut shapes); + if !shapes.is_empty() + && depth > 0 + && depth < MAX_CLIP_DEPTH + && *reads > 0 + && let Some(parent_cp) = cp.clip_path() + { + let parent_shapes = clip_shapes_depth(parent_cp, ts, depth + 1, reads); + let mut intersected = Vec::new(); + intersect_shapes(&shapes, &parent_shapes, &mut intersected); + shapes = intersected; + } shapes } +/// Intersect `shapes` with `clips`: SVG 1.1 §14.3.5 specifies that a clip path clips to the union +/// of its children, each child first clipped by its own clip-path if present. +fn intersect_shapes(shapes: &[(BezPath, FillRule)], clips: &[(BezPath, FillRule)], out: &mut Vec<(BezPath, FillRule)>) { + if shapes.is_empty() || clips.is_empty() { + return; + } + let clip_data = match clips { + [(bp, rule)] => (PathData::from_bezpath(bp), *rule), + _ => { + let paths: Vec<(PathData, FillRule)> = clips.iter().map(|(bp, r)| (PathData::from_bezpath(bp), *r)).collect(); + let refs: Vec<(&PathData, FillRule)> = paths.iter().map(|(p, r)| (p, *r)).collect(); + (vectorcraft_pathops::unite_all(&refs), FillRule::NonZero) + } + }; + for (bp, r) in shapes { + let child_data = PathData::from_bezpath(bp); + let inter = vectorcraft_pathops::boolean(&child_data, *r, &clip_data.0, clip_data.1, vectorcraft_pathops::BoolOp::Intersect); + if !inter.subpaths.is_empty() { + out.push((inter.to_bezpath(), FillRule::NonZero)); + } + } +} + /// Does clip path `cp` (on an element whose user space `ts` maps to the document) leave `art`, /// placed by `xf`, whole? (Only its bounds are checked: the box must be inside a clip shape.) pub(super) fn uncut(cp: &usvg::ClipPath, ts: Affine, art: &Node, xf: Affine) -> bool { @@ -217,6 +280,7 @@ pub(super) fn uncut(cp: &usvg::ClipPath, ts: Affine, art: &Node, xf: Affine) -> corners.iter().all(|c| shapes.iter().any(|(s, _)| kurbo::Shape::contains(s, xf * *c))) } +/// Convert a usvg fill rule to the document model fill rule. pub(super) fn rule(r: usvg::FillRule) -> FillRule { match r { usvg::FillRule::NonZero => FillRule::NonZero, diff --git a/crates/svg/tests/it/import_details.rs b/crates/svg/tests/it/import_details.rs index 967963a6f7..13518a6fd4 100644 --- a/crates/svg/tests/it/import_details.rs +++ b/crates/svg/tests/it/import_details.rs @@ -252,6 +252,147 @@ fn clip_path_children_unite_under_their_own_rules() { assert!(matches!(children[1].kind, NodeKind::Compound { rule: vectorcraft_geom::FillRule::EvenOdd, .. })); } +/// SVG 1.1 §14.3.5: a child of a clipPath element with its own clip-path is clipped by it before +/// contributing to the clip (https://www.w3.org/TR/SVG11/masking.html#EstablishingANewClippingPath). +#[test] +fn clip_path_child_clip_path_clips_child() { + let page = r##" + + + + + + + + "##; + let (d, w) = import_with_report(page).unwrap(); + assert!(w.is_empty(), "{w:?}"); + let mine = render_artboard(&d); + assert_similar(&mine, &resvg_render(page, 200, 200), 24.0, 0.003); + assert_eq!(mine.over_white(25, 25), [255, 0, 0], "the left strip is clipped in"); + assert_eq!(mine.over_white(100, 100), [255, 255, 255], "the right side is cut by inner clip"); + // Written back out, the clip stays identical. + let out = vectorcraft_svg::export(&d, &Default::default()); + assert_similar(&render_artboard(&vectorcraft_svg::import(&out).unwrap()), &mine, 24.0, 0.003); +} + +#[test] +fn clip_path_child_with_chained_clip_path_intersects() { + let page = r##" + + + + + + + + + "##; + let (d, w) = import_with_report(page).unwrap(); + assert!(w.is_empty(), "{w:?}"); + let mine = render_artboard(&d); + assert_similar(&mine, &resvg_render(page, 200, 200), 24.0, 0.003); + assert_eq!(mine.over_white(25, 25), [255, 0, 0], "top left quadrant is inside both clips"); + assert_eq!(mine.over_white(25, 150), [255, 255, 255], "bottom left is cut by base clip"); + assert_eq!(mine.over_white(100, 25), [255, 255, 255], "top right is cut by inner clip"); +} + +/// Clip paths are shared, so children that each name the next one multiply at every level: ten +/// children on seven levels would take 10^7 reads unbounded. The import must still finish. +#[test] +fn clip_paths_whose_children_fan_out_still_import() { + let mut defs = String::from(r#""#); + for n in 1..8 { + let kids = format!(r#""#, n - 1).repeat(10); + defs += &format!(r#"{kids}"#); + } + let svg = format!( + r#"{defs}"# + ); + assert!(import_with_report(&svg).is_ok()); +} + +#[test] +fn clip_path_deep_chain_preserves_art() { + let mut defs = String::from(r#""#); + for n in 1..=20 { + defs += &format!(r#""#, n - 1); + } + let svg = format!( + r##"{defs}"## + ); + let (d, w) = import_with_report(&svg).unwrap(); + assert!(!w.is_empty(), "expected warning about deep clip nesting"); + let mine = render_artboard(&d); + assert_eq!(mine.over_white(50, 50), [255, 0, 0], "red rect should be preserved despite depth limit"); +} + +#[test] +fn clip_path_child_deep_chain_preserves_art() { + let mut defs = String::from(r#""#); + for n in 1..=20 { + defs += &format!(r#""#, n - 1); + } + defs += r#""#; + let svg = format!( + r##"{defs}"## + ); + let (d, _w) = import_with_report(&svg).unwrap(); + let mine = render_artboard(&d); + assert_eq!(mine.over_white(50, 50), [255, 0, 0], "red rect should be preserved despite depth limit in child clip"); +} + +#[test] +fn clip_path_preserves_union_when_read_budget_exhausted() { + let mut defs = String::from(r#""#); + let mut kids = String::new(); + for i in 0..1100 { + let x = (i % 20) * 10; + let y = (i / 20) * 10; + kids += &format!(r##""##); + } + defs += &format!(r#"{kids}"#); + let svg = format!( + r##"{defs}"## + ); + let (d, _w) = import_with_report(&svg).unwrap(); + let mine = render_artboard(&d); + // Early tiles processed within the 1024 read budget must be preserved in the union. + assert_eq!(mine.over_white(5, 5), [255, 0, 0], "early tile inside read budget is preserved"); +} + +#[test] +fn clip_path_empty_clips_everything() { + let page = r##" + + + + + "##; + let (d, _w) = import_with_report(page).unwrap(); + let mine = render_artboard(&d); + assert_eq!(mine.over_white(50, 50), [255, 255, 255], "genuinely empty clip path clips away all art"); +} + +#[test] +fn clip_path_child_with_empty_linked_clip_clips_everything() { + let page = r##" + + + + + + + + + + + "##; + let (d, _w) = import_with_report(page).unwrap(); + let mine = render_artboard(&d); + assert_eq!(mine.over_white(50, 50), [255, 255, 255], "empty linked clip path clips away all art"); +} + #[test] fn undisplayed_objects_import_hidden() { let body = r##" From c15383c510b11bb996aa2dfd1ed2f5b58d9108ae Mon Sep 17 00:00:00 2001 From: Simon Hull <5488089+simonhull@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:05:56 -0600 Subject: [PATCH 10/56] Images: an image zoomed in on has its colours made only for the tiles in view (#4155) From about 50% zoom on the file of #4155, the pixels drawn are the full 141-megapixel photo, and in a CMYK document they were separated into ink planes (or colorized, or proofed) whole for every view: 8 to 9 s of white canvas a zoom step. When the pixels drawn are larger than a 1,024-pixel tile, their colours are made again for the frame and part of them is out of view, only the tiles in view are made, each kept under its own key (`ImageKey::tile`), and drawn together as one pixmap so their edges don't show. The colours are made pixel by pixel, so the result is the same as for the whole image. CMYK images painting their own inks are still made whole. Zooming in to 50%, 100% and 200% on that file went from 9.0, 8.6 and 8.7 s to 0.78, 0.05 and 0.05 s (M3 Pro, one run each), with the same pixels on screen. --- crates/render/src/blobs.rs | 1 + crates/render/src/images.rs | 34 +++++- crates/render/src/ink.rs | 9 +- crates/render/src/renderer/images.rs | 150 +++++++++++++++++++++++---- crates/render/src/tests/memory.rs | 50 +++++++++ docs/gaps.md | 9 +- docs/target-app-parity.md | 4 +- 7 files changed, 233 insertions(+), 24 deletions(-) diff --git a/crates/render/src/blobs.rs b/crates/render/src/blobs.rs index 99afde0773..ab5d831a0b 100644 --- a/crates/render/src/blobs.rs +++ b/crates/render/src/blobs.rs @@ -21,6 +21,7 @@ pub(crate) fn blob_key(blob: &vectorcraft_doc::ImageBlob) -> (images::ImageKey, luts: (lut.as_ref().map_or(0, |l| l.1), 0), plates: 0, mip: 0, + tile: None, }; (key, lut.map(|l| l.0), id.size) } diff --git a/crates/render/src/images.rs b/crates/render/src/images.rs index 644325f4a3..dbdbf00669 100644 --- a/crates/render/src/images.rs +++ b/crates/render/src/images.rs @@ -108,6 +108,8 @@ pub(crate) struct ImageKey { pub plates: u64, /// Halved this many times ([`half`]). pub mip: u8, + /// A [`TILE`]-pixel square of the pixels (column, row), when only part of them is made. + pub tile: Option<(u16, u16)>, } /// A blob's content key and whether it holds CMYK inks, worked out once per blob allocation, and @@ -413,6 +415,36 @@ fn mean(v: [u8; 4]) -> u8 { ((v.iter().map(|&c| u32::from(c)).sum::() + 2) / 4) as u8 } +/// The side of the squares whose colours are made one by one when only part of an image's +/// pixels show ([`ImageKey::tile`]): a large photo zoomed in on is separated, colorized or proofed +/// only where it shows. +pub(crate) const TILE: u32 = 1024; + +/// The `w`×`h` pixels of `pm` from (`x`, `y`). `None` unless they lie inside `pm`. +pub(crate) fn crop(pm: &Pixmap, x: u32, y: u32, w: u32, h: u32) -> Option { + let (pw, ph) = (u32::from(pm.width()), u32::from(pm.height())); + if w == 0 || h == 0 || x.checked_add(w)? > pw || y.checked_add(h)? > ph { + return None; + } + let (stride, x, w) = (pw as usize, x as usize, w as usize); + let rows = pm.data().chunks_exact(stride).skip(y as usize).take(h as usize); + let data: Vec = rows.flat_map(|row| row.get(x..x + w).unwrap_or_default().iter().copied()).collect(); + (data.len() == w * h as usize).then(|| Pixmap::from_parts(data, w as u16, h as u16)) +} + +/// `src` copied into `dst` with its top left at (`x`, `y`), as far as `dst` reaches. +pub(crate) fn paste(dst: &mut Pixmap, src: &Pixmap, x: usize, y: usize) { + let (dw, sw) = (usize::from(dst.width()), usize::from(src.width())); + let dst_rows = dst.data_mut().chunks_exact_mut(dw).skip(y); + for (to, from) in dst_rows.zip(src.data().chunks_exact(sw)) { + let row = to.get_mut(x..).unwrap_or_default(); + let n = row.len().min(from.len()); + if let (Some(to), Some(from)) = (row.get_mut(..n), from.get(..n)) { + to.copy_from_slice(from); + } + } +} + /// Pixels `pm` colorized with `rgb`: each pixel takes the color, as opaque as the pixel is dark /// (255 less its Rec. 709 luma) times its alpha, so white pixels are transparent. pub(crate) fn colorized(pm: &Pixmap, [r, g, b]: [u8; 3]) -> Pixmap { @@ -448,7 +480,7 @@ mod tests { use super::*; fn key(content: &str) -> ImageKey { - ImageKey { content: content.into(), adjust: None, grey: false, tint: None, ink: Ink::Display, luts: (0, 0), plates: 0, mip: 0 } + ImageKey { content: content.into(), adjust: None, grey: false, tint: None, ink: Ink::Display, luts: (0, 0), plates: 0, mip: 0, tile: None } } #[test] diff --git a/crates/render/src/ink.rs b/crates/render/src/ink.rs index c4e1d0bb74..dee93e9030 100644 --- a/crates/render/src/ink.rs +++ b/crates/render/src/ink.rs @@ -395,11 +395,17 @@ pub(crate) fn cmyk_pixmap(blob: &ImageBlob, lut: &InkLut) -> Option { inks_pixmap(&blob.cmyk()?, lut) } +/// Whether image pixels `key` are a CMYK image's inks as shown (not adjusted or greyscale), so +/// they paint those inks ([`key_inks`]). +pub(crate) fn shows_own_inks(key: &ImageKey) -> bool { + key.luts.0 != 0 && key.adjust.is_none() && !key.grey +} + /// The ink amounts behind image pixels `key` when they are CMYK image `blob`'s inks as shown (not /// adjusted or greyscale): its own inks, halved as its pixels are to `key`'s mip /// ([`images::half_inks`]). `None` for other pixels. pub(crate) fn key_inks(key: &ImageKey, blob: Option<&ImageBlob>) -> Option { - if key.luts.0 == 0 || key.adjust.is_some() || key.grey { + if !shows_own_inks(key) { return None; } (0..key.mip).try_fold(blob?.cmyk()?, |inks, _| images::half_inks(&inks)) @@ -538,6 +544,7 @@ mod tests { luts: (0, 0), plates: 0, mip: 0, + tile: None, }; let pm = Arc::new(Pixmap::from_parts(vec![PremulRgba8 { r: 204, g: 102, b: 51, a: 255 }, PremulRgba8 { r: 102, g: 51, b: 26, a: 128 }], 2, 1)); diff --git a/crates/render/src/renderer/images.rs b/crates/render/src/renderer/images.rs index 0f22fbae39..a604481dd4 100644 --- a/crates/render/src/renderer/images.rs +++ b/crates/render/src/renderer/images.rs @@ -71,45 +71,48 @@ impl Renderer { } } } - kept + kept.map(Shown::whole) } else if let Some(pm) = mips.then(|| self.kept_mip(f, &im.key, im.pixels.as_deref(), outline, tint, unit)).flatten() { - Some(pm) + Some(Shown::whole(pm)) } else { self.image_pixmap(f.doc, &im.key, im.pixels.as_deref(), outline, !mips).map(|(key, pm)| { // Shrunk first, so what is made of the pixels below is made of the ones drawn: a // 141-megapixel photo is separated at the size it shows, not at its own (#4155). let (key, pm) = if mips { image_mip(key, pm, unit) } else { (key, pm) }; let blob = f.doc.image_blob(im); - let (key, pm) = match tint { - Some(rgb) => colorized_pixmap(key, &pm, rgb), - None => (key, pm), - }; - // A colorized image is already in the frame's ink ([`image_tint`]), and with - // Separations Preview its color is already the visible plates' (`proof::prepare`). - let (key, pm) = if outline || tint.is_some() { (key, pm) } else { ink::ink_image(&key, &pm, f.ink, blob, true) }; - match f.plates.filter(|_| !outline && tint.is_none()) { - Some(lut) => proof::plate_image(lut, &key, &pm, blob, true).1, - None => pm, + // Zoomed in on it, only the tiles in view. + if let Some(window) = in_view(f, im, &key, &pm, outline, tint) { + return window_pixmap(f, &key, &pm, window, outline, tint, blob); } + Shown::whole(shown_pixmap(f, key, pm, outline, tint, blob)) }) }; - if let Some(pm) = shown { - let sx = im.width as f64 / pm.width().max(1) as f64; - let sy = im.height as f64 / pm.height().max(1) as f64; + if let Some(Shown { pm, level: (lw, lh), at: (ax, ay) }) = shown { + // The pixels drawn are `pm`, from (`ax`, `ay`) of the `lw`×`lh` pixels of the level. + let sx = im.width as f64 / f64::from(lw.max(1)); + let sy = im.height as f64 / f64::from(lh.max(1)); + let drawn = Affine::scale_non_uniform(sx, sy) * Affine::translate((f64::from(ax), f64::from(ay))); + let part = Rect::new( + f64::from(ax) * sx, + f64::from(ay) * sy, + f64::from(ax + u32::from(pm.width())) * sx, + f64::from(ay + u32::from(pm.height())) * sy, + ) + .intersect(rect); let quality = if f.opts.smooth_images && !pixelated { peniko::ImageQuality::Medium } else { peniko::ImageQuality::Low }; let sampler = peniko::ImageSampler { quality, ..Default::default() }; ctx.set_paint(vello_cpu::Image { image: vello_cpu::ImageSource::Pixmap(pm), sampler }); match area { Some((bp, rule)) => { ctx.set_transform(f.view); - ctx.set_paint_transform(im.xf * Affine::scale_non_uniform(sx, sy)); + ctx.set_paint_transform(im.xf * drawn); ctx.set_fill_rule(fill_rule(*rule)); ctx.fill_path(bp); } None => { ctx.set_transform(f.view * im.xf); - ctx.set_paint_transform(Affine::scale_non_uniform(sx, sy)); - ctx.fill_rect(&rect); + ctx.set_paint_transform(drawn); + ctx.fill_rect(&part); } } ctx.reset_paint_transform(); @@ -307,6 +310,117 @@ impl Renderer { } } +/// Image pixels [`Renderer::draw_image_in`] draws: `pm`, from (`at`) of the `level` pixels of the +/// mip drawn (all of them, or the tiles in view). +struct Shown { + pm: Arc, + level: (u32, u32), + at: (u32, u32), +} + +impl Shown { + /// All of the pixels of a level. + fn whole(pm: Arc) -> Self { + let level = (u32::from(pm.width()), u32::from(pm.height())); + Self { pm, level, at: (0, 0) } + } +} + +/// Image pixels `pm` (kept as `key`) as [`Renderer::draw_image_in`] draws them: in greyscale with +/// `grey` (the outline view's) or colorized with `tint` as they are, else painted with the frame's +/// ink and shown through its Separations Preview plates. Kept with the images under +/// [`shown_key`], and marked used there. +fn shown_pixmap( + f: &Frame, + key: images::ImageKey, + pm: Arc, + grey: bool, + tint: Option<[u8; 3]>, + blob: Option<&vectorcraft_doc::ImageBlob>, +) -> Arc { + let (key, pm) = match tint { + Some(rgb) => colorized_pixmap(key, &pm, rgb), + None => (key, pm), + }; + // A colorized image is already in the frame's ink ([`image_tint`]), and with Separations + // Preview its color is already the visible plates' (`proof::prepare`). + if grey || tint.is_some() { + return pm; + } + let (key, pm) = ink::ink_image(&key, &pm, f.ink, blob, true); + match f.plates { + Some(lut) => proof::plate_image(lut, &key, &pm, blob, true).1, + None => pm, + } +} + +/// The tiles of image pixels `pm` (kept as `key`, the level of image `im` drawn) in the frame's +/// view, as a range of columns and rows, when the pixels' colours are made again +/// ([`shown_pixmap`]: colorized, separated or proofed), more than one tile of them is made, and +/// some are out of view. `None` otherwise: all the pixels are made, as they are for a CMYK image's +/// own inks (made from the whole image's). +fn in_view( + f: &Frame, + im: &vectorcraft_doc::ImageObject, + key: &images::ImageKey, + pm: &Pixmap, + grey: bool, + tint: Option<[u8; 3]>, +) -> Option<([u32; 2], [u32; 2])> { + let made = !grey && (tint.is_some() || ink::ink_key(key, f.ink) != *key || f.plates.is_some()); + let (w, h) = (u32::from(pm.width()), u32::from(pm.height())); + if !made || (w <= images::TILE && h <= images::TILE) || ink::shows_own_inks(key) { + return None; + } + // The view in the level's pixels, a couple wider for smoothing at its edge. + let to_level = (im.xf * Affine::scale_non_uniform(im.width as f64 / f64::from(w), im.height as f64 / f64::from(h))).inverse(); + let v = f.visible; + let corners = [(v.x0, v.y0), (v.x1, v.y0), (v.x1, v.y1), (v.x0, v.y1)].map(|c| to_level * vectorcraft_geom::Point::from(c)); + let (x0, x1) = corners.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(a, b), p| (a.min(p.x), b.max(p.x))); + let (y0, y1) = corners.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(a, b), p| (a.min(p.y), b.max(p.y))); + if ![x0, x1, y0, y1].iter().all(|v| v.is_finite()) { + return None; + } + let tiles = |lo: f64, hi: f64, n: u32| { + let last = n.saturating_sub(1) / images::TILE; + let at = |v: f64| ((v.clamp(0.0, f64::from(n.saturating_sub(1))) as u32) / images::TILE).min(last); + ([at(lo - 2.0), at(hi + 2.0)], last) + }; + let ((cols, last_col), (rows, last_row)) = (tiles(x0, x1, w), tiles(y0, y1, h)); + // All of them in view: made whole, as without tiles. + (cols != [0, last_col] || rows != [0, last_row]).then_some((cols, rows)) +} + +/// The tiles `cols` × `rows` of image pixels `pm` (kept as `key`) as [`shown_pixmap`] makes them, +/// each made and kept on its own ([`images::ImageKey::tile`]), in one pixmap. +fn window_pixmap( + f: &Frame, + key: &images::ImageKey, + pm: &Pixmap, + (cols, rows): ([u32; 2], [u32; 2]), + grey: bool, + tint: Option<[u8; 3]>, + blob: Option<&vectorcraft_doc::ImageBlob>, +) -> Shown { + let (w, h) = (u32::from(pm.width()), u32::from(pm.height())); + let t = images::TILE; + let at = (cols[0] * t, rows[0] * t); + let size = (((cols[1] + 1) * t).min(w) - at.0, ((rows[1] + 1) * t).min(h) - at.1); + let mut window = Pixmap::new(size.0 as u16, size.1 as u16); + for (col, row) in (rows[0]..=rows[1]).flat_map(|r| (cols[0]..=cols[1]).map(move |c| (c, r))) { + let tile_key = images::ImageKey { tile: Some((col as u16, row as u16)), ..key.clone() }; + let (x, y) = (col * t, row * t); + let made = lookup(&shown_key(f, tile_key.clone(), grey, tint), true).or_else(|| { + let part = images::crop(pm, x, y, t.min(w - x), t.min(h - y))?; + Some(shown_pixmap(f, tile_key, Arc::new(part), grey, tint, blob)) + }); + if let Some(made) = made { + images::paste(&mut window, &made, (x - at.0) as usize, (y - at.1) as usize); + } + } + Shown { pm: Arc::new(window), level: (w, h), at } +} + /// The key [`Renderer::draw_image_in`] gives the pixels it draws of image pixels `key`: in /// greyscale with `grey` (the outline view's) or colorized with `tint` as they are, else painted /// with the frame's ink and shown through its Separations Preview plates. diff --git a/crates/render/src/tests/memory.rs b/crates/render/src/tests/memory.rs index 976709e752..d8b267cb9e 100644 --- a/crates/render/src/tests/memory.rs +++ b/crates/render/src/tests/memory.rs @@ -2494,3 +2494,53 @@ fn a_reduced_image_on_the_ink_planes_shows_its_average() { assert!(px.iter().zip(want).all(|(a, b)| a.abs_diff(b) <= 2), "pixel {i}: {px:?}, the full frame averages {want:?}"); } } + +/// A `w`×`h` PNG with a different colour in every pixel, so a pixel drawn from the wrong place +/// shows; its pixels depend on `seed` (each test its own image: the store is shared). +fn varied_png(w: u32, h: u32, seed: u8) -> Vec { + let img = image::RgbaImage::from_fn(w, h, |x, y| image::Rgba([(x * 5 + y) as u8, (x / 3 + y * 7) as u8, (x ^ y) as u8 ^ seed, 255])); + let mut out = vec![]; + img.write_to(&mut std::io::Cursor::new(&mut out), image::ImageFormat::Png).unwrap(); + out +} + +/// #4155: an image drawn larger than a tile with its colours made again (here separated into ink +/// planes) has them made only for the tiles in view. Zoomed in on a 141-megapixel photo, the whole +/// photo was separated for every view, taking seconds each time. +#[test] +fn a_zoomed_in_image_is_separated_only_where_it_shows() { + let _fonts = fonts_steady(); + let (w, h) = (2 * images::TILE + 100, 40); + let d = cmyk_doc_with("wide", ImageBlob::new("image/png", varied_png(w, h, 1)), w, h); + let on = RenderOptions { image_mips: true, ..Default::default() }; + let _ = Renderer::new().render_region_inks(&d, Rect::new(0.0, 0.0, 300.0, 40.0), 1.0, &on); + let full = blob_key(&d.images["wide"]).0; + let s = images::store(); + for plane in [Ink::Cmy, Ink::K] { + assert!(s.peek(&ink::ink_key(&full, plane)).is_none(), "the whole {plane:?} plane was made"); + let tile = |col: u16| ink::ink_key(&images::ImageKey { tile: Some((col, 0)), ..full.clone() }, plane); + assert!(s.peek(&tile(0)).is_some(), "the {plane:?} plane of the tile in view was made"); + assert!(s.peek(&tile(1)).is_none() && s.peek(&tile(2)).is_none(), "tiles out of view were made"); + } +} + +/// An image drawn from tiles draws the pixels it draws whole, across the tiles' edges too. +#[test] +fn a_tiled_image_draws_what_the_whole_image_draws() { + let _fonts = fonts_steady(); + let (w, h) = (2 * images::TILE + 100, 40); + let d = cmyk_doc_with("seams", ImageBlob::new("image/png", varied_png(w, h, 2)), w, h); + let on = RenderOptions { image_mips: true, ..Default::default() }; + // Across the edge between the first two tiles. + let (x0, x1) = (f64::from(images::TILE) - 150.0, f64::from(images::TILE) + 150.0); + let drawn = Renderer::new().render_region_inks(&d, Rect::new(x0, 0.0, x1, 40.0), 1.0, &on); + let (key, full) = crate::blobs::blob_pixmap(&d.images["seams"], false).unwrap(); + let plane = |ink| ink::ink_image(&key, &full, ink, d.images.get("seams"), false).1; + let bytes = |pm: &Pixmap| pm.data().iter().flat_map(|p| [p.r, p.g, p.b, p.a]).collect::>(); + let whole = ink::amounts(&bytes(&plane(Ink::Cmy)), &bytes(&plane(Ink::K))); + for (i, got) in drawn.as_chunks::<4>().0.iter().enumerate() { + let (x, y) = (x0 as usize + i % 300, i / 300); + let want = &whole[(y * w as usize + x) * 4..][..4]; + assert!(got.iter().zip(want).all(|(a, b)| a.abs_diff(*b) <= 1), "pixel ({x}, {y}): {got:?}, whole {want:?}"); + } +} diff --git a/docs/gaps.md b/docs/gaps.md index 2f406c3cbe..027cfdee7a 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -649,14 +649,16 @@ from G14 and the budget run of G15: **~170–270 h** one agent, ~50–80 h wall ## G15 Performance budgets and a GPU renderer +- **Improved (#4155):** an image zoomed in on has its colours separated, colorized or proofed only for the + 1,024-pixel tiles in view: zooming in to 100% on the file of #4155 went from 8.6 s to 0.05 s (measured in the app, + M3 Pro, one run). A CMYK image painting its own inks is still made whole. - **Improved (#4155):** a document's first frame renders on the render worker, not the UI thread: opening the file of #4155 kept the UI thread busy for 8.7 s at a stretch, now at most 64 ms, and a 50,000-path SVG 1.4 s, now 62 ms (measured in the app, M3 Pro, one run each). A light document's frame, ready within 16 ms, still shows at once. - **Improved (#4155):** the canvas shrinks a reduced image to the mip it draws before separating it into ink planes, colorizing it or proofing it, so that work is done at the size the image shows, not at its own. On the 141-megapixel image of #4155 the first frame went from 9.2 s to 1.6 s and the sharp frame after a pan from 3.9 s - to 8 ms (measured in the app, M3 Pro, one run each). Still to do: at 100% zoom or more an image is still separated - whole; tiles would bound that by the view. + to 8 ms (measured in the app, M3 Pro, one run each). - **Improved (2026-11-02):** the renderer keeps a compound path's assembled path with the node, as it keeps a plain path's, instead of assembling its members again in every frame; the path is assembled into a buffer sized up front. Unused geometry entries are dropped after a few frames however few there are (before, only past 1,024 entries), so @@ -767,6 +769,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| +| 2026-11-05 | minor | G15: an image zoomed in on is separated, colorized or proofed only for the tiles in view (#4155); 100% zoom on that file 8.6 s → 0.05 s. Estimate unchanged. | | 2026-11-05 | minor | G15: a document's first frame renders on the render worker (#4155); the longest UI-thread stall opening that file went from 8.7 s to 64 ms. Estimate unchanged. | | 2026-11-05 | minor | G15: a reduced image is shrunk before it is separated into ink planes (#4155); first frame 9.2 s → 1.6 s, sharp frame after a pan 3.9 s → 8 ms on that file. Estimate unchanged. | | 2026-11-05 | minor | G7: document tabs are dragged along the tab strip to reorder them (`document.move`, #5663). Estimate unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 0994d967c2..0a0061b74e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -31,6 +31,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-05 | minor | Canvas: an image drawn larger than 1,024 pixels at the size it shows, with its colours made again (separated into ink planes, colorized or shown through Separations Preview), has them made only for the 1,024-pixel tiles in view, each kept for later frames (#4155). Zooming in to 50%, 100% and 200% on the file of #4155 went from 8.6–9.0 s to 0.78 s, 0.05 s and 0.05 s (measured, M3 Pro, one run each), with the same pixels. Scores and estimates unchanged. | | 2026-11-05 | minor | Canvas: a document's first frame (opened, or its tab chosen) renders on the render worker instead of the UI thread; the window shows the document's paper and artboards until the art lands, and a frame ready within 16 ms shows at once. Opening the file of #4155 kept the UI thread busy for 8.7 s at a stretch, now at most 64 ms; a 50,000-path SVG 1.4 s, now 62 ms (measured, M3 Pro, one run each). Scores and estimates unchanged. | | 2026-11-05 | minor | Canvas: an image drawn reduced in a CMYK document is shrunk to the size it shows before it is separated into ink planes, not separated at full size and then shrunk (#4155). On the 141-megapixel image of #4155 the first frame went from 9.2 s to 1.6 s, and the sharp frame after a pan from 3.9 s to 8 ms (measured, M3 Pro, one run each). The same pixels show within 5 levels; fine detail such as 1-pixel lines now shows its true average. Scores and estimates unchanged. | | 2026-11-05 | minor | Effect dialogs: a hex colour parameter (Outer Glow's Color, Inner Glow's, Drop Shadow's) shows a swatch beside the field that follows typed hex values; a double-click opens the Color Picker over the dialog on that colour, and its OK fills the field while Cancel comes back unchanged (#5365); scores and estimates unchanged. | @@ -1367,6 +1368,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Dragging objects with raster effects when zoomed in (#2558):** during a drag with a tool on the canvas, the renderer draws filtered content (Gaussian Blur, Feather and the Photoshop-style filters) within 1,000,000 pixels, at a lower resolution where it would need more, unless it can draw the content from an earlier frame's raster. In the desktop app it does the same for drop shadows, outer glows and inner glows. No raster made that way is kept. The frame after the drag renders them as a still frame does, and a dialog's preview, exports and printing render as before. `zoomed_drag_perf` times a drag's frames at 100% to 6400%. - **Dragging other art over a wide blur (#2558):** an effect raster too large to keep whole (a wide blur, a shadow or glow, or any blur zoomed in) is cropped to what can show in the view, or made at a lower resolution and resampled to the view's pixels, and kept while the view stays the same, so dragging other art over the object draws its effects from the still frame instead of re-rendering them at the drag's lower resolution. A drag stays on the render worker once the worker drew the frame shown, since only that renderer holds the rasters. `tests_viewraster` covers each effect, and `a_drag_over_a_wide_blur_draws_the_blur_from_the_still_frame` the canvas on and off the worker. Not yet: a worker frame shows one display frame after the overlays, and the first frame of an interaction can land on the renderer that has not made the rasters yet (follow-up: render every canvas frame on the worker, waiting briefly for fast ones). - **Opening a heavy document (#4155):** the canvas renders a document's first frame (when it opens, or its tab is chosen) on the render worker, as it renders the frames of a slow document, instead of on the UI thread, where a heavy one froze the window until it was done. The UI thread waits for it up to 16 ms (`FIRST_FRAME_GRACE`), so a light document's art shows in the same frame as before, without a frame of bare paper; otherwise the document's paper and artboards show, the window stays live, and the art shows when it lands. The web build, which has no worker, renders it as before. Measured on an M3 Pro, one run each, from launch with the file: the file of #4155 kept the UI thread busy for 8.7 s at a stretch, now at most 64 ms (its art lands as before, after about 9 s of rendering); a 50,000-path SVG 1.4 s, now 62 ms. `a_documents_first_frame_renders_on_the_worker` and `the_render_worker_waits_for_a_frame_only_as_long_as_asked` (`crates/ui-egui/src/canvas/tests.rs`). +- **Zooming in on large images (#4155):** when an image is drawn from pixels (its mip, or its full pixels) more than 1,024 pixels on a side, and their colours are made again for the frame (separated into a CMYK document's ink planes, colorized, or shown through Separations Preview's plates), only the 1,024-pixel tiles in view are made, each kept with the images under its own key, and the tiles in view are drawn as one pixmap so their edges don't show. The colours are made pixel by pixel, so the result is the same as making them for the whole image (`a_tiled_image_draws_what_the_whole_image_draws`, across a tile edge); `a_zoomed_in_image_is_separated_only_where_it_shows` checks the tiles out of view are not made. A CMYK image painting its own inks is still made whole. On the file of #4155 (an 11,339 × 12,424 photo, M3 Pro, one run each), the sharp frame after zooming in to 50%, 100% and 200% went from 9.0, 8.6 and 8.7 s to 0.78, 0.05 and 0.05 s, and the app's memory after zooming from 4.4 GB to 2.6 GB; the screens at 100% match (p99 difference 0). - **Large images in CMYK documents (#4155):** the canvas draws a reduced image from a mip (halved while still at least as fine as the screen) and, in a CMYK document, separates that mip into its ink planes, colorizes it or shows it through Separations Preview's plates, instead of doing that to the full pixels and shrinking the result. A CMYK image's own inks are halved with its pixels, so it still paints them. Exports draw without mips and are unchanged. On the file of #4155 (one 11,339 × 12,424 image), measured on an M3 Pro under load, one run each: first frame 9.2 s → 1.6 s, opening to the first frame 11.7 s → 3.9 s, the sharp frame after a pan 3.9 s → 8 ms and after a zoom 3.5 s → 0.16 s; the fitted view's pixels differ by at most 5 levels (p99 2). `a_reduced_image_is_separated_from_its_mip_not_its_full_pixels`, `a_reduced_cmyk_image_paints_its_own_inks` and `a_reduced_image_on_the_ink_planes_shows_its_average` (`crates/render/src/tests/memory.rs`) cover the order, the inks and the colour: 1-pixel black and white lines show as the mid grey they average to, where separating first showed them 44 levels darker. - **Panning over a cropped effect raster:** when a pan makes a shadow, glow or filtered content raster cropped to the view again at the same zoom and rotation, the renderer makes it over a margin around the view too (up to half the view's longer side, within 8.4 million pixels), and later pans that keep the view inside that margin draw the raster instead of making it again. Zooming and the first frame at a zoom make the raster without the margin. The canvas pans by whole device pixels: the wheel, a trackpad, a touch screen and the scroll bars add the part of a pixel left over to the next scroll of the same view, and Hand tool and scroll bar thumb drags round the distance dragged. A Drop Shadow or Outer Glow raster holds the shadow or glow of group members outside the view, so a pan that shows a member draws its shadow or glow from the raster. `pans_within_a_cropped_rasters_margin_draw_it_kept` covers Drop Shadow, Gaussian Blur and Feather on a large image at 100%. `a_groups_shadow_raster_holds_the_members_outside_the_view` covers a group's members, `fractional_scrolls_moved_in_whole_pixels_draw_a_cropped_raster_kept` covers scrolls by fractions of a pixel, and `scrolls_and_pans_move_the_view_by_whole_device_pixels` covers the canvas. From f987c2bbb06ea1fc12a2b43cec1095dd8b252d9b Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 18:39:09 -0500 Subject: [PATCH 11/56] Intertwine: the object brought over leaves no hairline of the one below (#5337) The area an Intertwine member is drawn over another in was exactly the overlap face, so its edge lay on the edge of the member below. Both edges were anti-aliased, and the member below showed through as a thin line along them. The area now reaches 2 pt past the face into the parts where only the raised member paints (where drawing it again changes nothing), so its edge lies inside that member. --- crates/engine/src/cmd/intertwine.rs | 53 +++++++++++++++++++++++---- crates/engine/src/tests/intertwine.rs | 22 +++++++++++ docs/gaps.md | 3 +- 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/intertwine.rs b/crates/engine/src/cmd/intertwine.rs index 23f1be1906..b19206c397 100644 --- a/crates/engine/src/cmd/intertwine.rs +++ b/crates/engine/src/cmd/intertwine.rs @@ -10,7 +10,10 @@ //! //! An overlap area is a face of the planar arrangement of what the members paint (their fills and //! strokes, type outlined; other objects by their bounds): the part where two or more of them -//! overlap, split wherever a member's edge crosses it. +//! overlap, split wherever a member's edge crosses it. The area a member is raised in is that +//! face grown a little ([`SEAM`]) into the parts where only that member paints ([`raised_area`]), +//! so its edge does not lie on the edge of the member it passes over: there, both edges would be +//! anti-aliased and the member below would show through as a hairline (#5337). //! //! Behaviour: (Make, //! Release, clicking or drawing around an overlap, Bring to Front, Bring Forward, Send Backward @@ -23,7 +26,7 @@ use serde_json::{Value, json}; use vectorcraft_doc::{Document, Node, NodeId, NodeKind}; use vectorcraft_geom::{FillRule, PathData, Point, SubPath}; use vectorcraft_pathops as po; -use vectorcraft_tools::intertwine::{Face, drawn_order, face_at, faces, faces_in, is_intertwine, nonempty}; +use vectorcraft_tools::intertwine::{Face, drawn_order, face_at, faces_in, faces_of, is_intertwine, nonempty, painted_areas}; use super::edit::selected_roots; use super::pathops::Beside; @@ -302,13 +305,46 @@ fn tiers(order: &[usize]) -> Vec<(usize, usize)> { .collect() } +/// How far (pt) the area a member is raised in reaches past its overlap face, into the parts only +/// that member paints ([`raised_area`]). +const SEAM: f64 = 2.0; + +/// The area member `i` is raised in for `face`: the face, and the parts within [`SEAM`] of it +/// where only `i` paints (`areas`: what each member paints, [`painted_areas`]). Drawing `i` again +/// there changes nothing, and the edge of the area then lies inside `i`, not on the edge of a +/// member it passes over (where the anti-aliased edges of both would let that member show +/// through as a hairline). +fn raised_area(face: &PathData, i: usize, areas: &[Option]) -> PathData { + let Some(own) = areas.get(i).and_then(Option::as_ref) else { return face.clone() }; + let ring = po::offset_path(face, SEAM, po::Join::Round, 4.0); + let Some(near) = ring.bounds() else { return face.clone() }; + let mut paths = vec![(&ring, FillRule::NonZero), (own, FillRule::NonZero)]; + paths.extend( + areas + .iter() + .enumerate() + .filter(|(k, _)| *k != i) + .filter_map(|(_, a)| a.as_ref()) + .filter(|a| a.bounds().is_some_and(|b| b.overlaps(near))) + .map(|a| (a, FillRule::NonZero)), + ); + let only = po::boolean_n(&paths, |inside| inside.first() == Some(&true) && inside.get(1) == Some(&true) && !inside.iter().skip(2).any(|b| *b)); + if only.is_empty() { + return face.clone(); + } + nonempty(po::boolean(face, FillRule::NonZero, &only, FillRule::NonZero, po::BoolOp::Union)).unwrap_or_else(|| face.clone()) +} + /// Draw the members of `face` in `order` there (bottom first), leaving the other areas as they -/// are. -fn arrange_face(children: &mut [Arc], face: &Face, order: &[usize]) { +/// are (`areas`: what each member paints, [`painted_areas`]). +fn arrange_face(children: &mut [Arc], face: &Face, order: &[usize], areas: &[Option]) { for (i, tier) in tiers(order) { - if let Some(c) = children.get_mut(i) { - set_tier(Arc::make_mut(c), &face.path, tier); + let Some(c) = children.get_mut(i) else { continue }; + // A member drawn in its own order there with no areas has nothing to change. + if tier == 0 && c.extras().intertwine.is_none() && c.extras().intertwine_tiers.is_empty() { + continue; } + set_tier(Arc::make_mut(c), &raised_area(&face.path, i, areas), tier); } } @@ -379,7 +415,8 @@ fn arrange(s: &mut Session, p: &Value) -> Result { Some(m) => Some(children.iter().position(|c| c.id == m).ok_or_else(|| bad(C, format!("object {} is not in this Intertwine group", m.0)))?), None => None, }; - let all = faces(&children); + let painted = painted_areas(&children); + let all = faces_of(&painted); let found = match (at, &lasso) { (Some(p), _) => face_at(&all, p).into_iter().collect(), (None, Some(l)) => faces_in(&all, l), @@ -423,7 +460,7 @@ fn arrange(s: &mut Session, p: &Value) -> Result { let n = d.node_mut(group).ok_or(EngineError::NoNode(group))?; let NodeKind::Intertwine { children } = &mut n.kind else { return Err(EngineError::NoNode(group)) }; for (face, new) in &plans { - arrange_face(children, face, new); + arrange_face(children, face, new, &painted); } Ok(()) })?; diff --git a/crates/engine/src/tests/intertwine.rs b/crates/engine/src/tests/intertwine.rs index 6895d74a07..ecb9742a30 100644 --- a/crates/engine/src/tests/intertwine.rs +++ b/crates/engine/src/tests/intertwine.rs @@ -82,6 +82,28 @@ fn clicking_an_overlap_brings_the_object_below_to_the_front_there_only() { assert_eq!(hit(&s, 50.0, 70.0), Some(b)); } +/// #5337: where A is brought over B, the edges of B that cross A leave no blue hairline in A. +#[test] +fn the_object_brought_over_shows_no_seam_of_the_one_below() { + let mut s = session(); + intertwined(&mut s); + arrange(&mut s, json!({"at": [50, 30]})); + let zoom = 8.0; + let r = vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 800, 800, Affine::scale(zoom), &Default::default()); + let mut worst = 0; + for y in 160..360 { + for x in 320..480 { + let (px, py) = ((x as f64 + 0.5) / zoom, (y as f64 + 0.5) / zoom); + // Well inside ring A's 8 pt stroke (radius 21 to 29), A covers every pixel. + let d = ((px - 35.0).powi(2) + (py - 50.0).powi(2)).sqrt(); + if (22.0..28.0).contains(&d) { + worst = worst.max(r.pixel(x, y)[2]); + } + } + } + assert!(worst < 8, "blue shows through ring A at the top crossing (blue {worst})"); +} + #[test] fn clicking_the_same_overlap_again_swaps_back() { let mut s = session(); diff --git a/docs/gaps.md b/docs/gaps.md index 027cfdee7a..5a8de15d61 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -495,7 +495,8 @@ from G14 and the budget run of G15: **~170–270 h** one agent, ~50–80 h wall pointer, and a right-click offers Bring to Front, Bring Forward, Send Backward and Send to Back for it in that area (`object.intertwine.arrange` with `order` front, forward, backward or back; ). - The group renders, saves and exports through its live expansion. Still missing: adding objects to the group by + The group renders, saves and exports through its live expansion; an object brought over another shows no hairline + of the one below along that object's edges (#5337). Still missing: adding objects to the group by dragging them in the Layers panel is untested. - **Done (from users' reports):** Object › Create Gradient Mesh on an embedded image turns it into a mesh over its rectangle, with the image's transform kept; each point takes the average colour and opacity of the picture around it From 1f7f341c2120bb6d17793ce8be3a13ddfa415172 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 18:42:46 -0500 Subject: [PATCH 12/56] Properties: Quick Actions has Repeat Options for a selected repeat (#5181) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One selected radial, grid or mirror repeat (or one object of its source art in isolation mode) shows a Repeat Options button in the Properties panel's Quick Actions. It runs Object › Repeat › Options, opening the Repeat Options dialog with the repeat's current values. --- crates/ui-egui/src/panels/properties.rs | 8 ++++++ crates/ui-egui/src/panels/properties/tests.rs | 28 +++++++++++++++++++ docs/ui-parity.md | 5 ++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 79632f4004..f7bcfb5ae3 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -122,6 +122,11 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { // any tool (, #4817). let blend_options = n_sel == 1 && matches!(first.as_ref().map(|n| &n.kind), Some(NodeKind::Blend { .. })); let merge_live_paint = n_sel > 1 && can_merge_live_paint(app); + // Repeat Options for one selected repeat (radial, grid or mirror), or one object of its source + // art in isolation mode: Object › Repeat › Options, the dialog of the repeat options pages + // (, + // #5181). + let repeat_options = n_sel == 1 && crate::menus::enabled(app, "object.repeat.options"); let mut actions: Vec<(&str, &str)> = vec![]; if n_sel > 1 { actions.push((tl!("Group"), "object.group")); @@ -133,6 +138,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if blend_options { actions.push((tl!("Blend Options"), "ui.blendOptions")); } + if repeat_options { + actions.push((tl!("Repeat Options"), "object.repeat.options")); + } if is_group { actions.push((tl!("Ungroup"), "object.ungroup")); actions.push((tl!("Isolate Group"), "object.isolate")); diff --git a/crates/ui-egui/src/panels/properties/tests.rs b/crates/ui-egui/src/panels/properties/tests.rs index 7c5e69e119..70d80ffa2b 100644 --- a/crates/ui-egui/src/panels/properties/tests.rs +++ b/crates/ui-egui/src/panels/properties/tests.rs @@ -1339,6 +1339,34 @@ fn blend_options_is_a_quick_action_for_one_blend() { assert!(!shows(&tall(&mut app, &ctx, vec![]), "Blend Options"), "a rectangle"); } +/// One selected repeat, radial, grid or mirror, has Repeat Options in Quick Actions (#5181), which +/// opens the Repeat Options dialog with its values; a plain rectangle, or a repeat selected with +/// another object, does not. +#[test] +fn repeat_options_is_a_quick_action_for_one_repeat() { + let ctx = egui::Context::default(); + for (cmd, field) in [("object.repeat.radial", "instances"), ("object.repeat.grid", "rows"), ("object.repeat.mirror", "angle")] { + let mut app = new_app(); + let a = rect(&mut app, 20.0, 20.0, 40.0, 40.0); + let repeat = app.run(cmd, json!({"ids": [a]})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [repeat]})).unwrap(); + let texts = tall(&mut app, &ctx, vec![]); + assert!(shows(&texts, "Repeat Options"), "{cmd}"); + let depth = undo_depth(&app); + press(&mut app, &ctx, text_at(&texts, "Repeat Options").center()); + let d = app.ui.dialog.as_ref().expect("the Repeat Options dialog opens"); + assert_eq!(d.kind, "command", "{cmd}"); + assert!(d.fields.contains_key(field), "{cmd}: the dialog has the repeat's {field}"); + assert_eq!(undo_depth(&app), depth, "opening the dialog changes nothing"); + app.ui.dialog = None; + let c = rect(&mut app, 20.0, 200.0, 40.0, 40.0); + app.run("select.set", json!({"ids": [repeat, c]})).unwrap(); + assert!(!shows(&tall(&mut app, &ctx, vec![]), "Repeat Options"), "{cmd}: a repeat and another object"); + app.run("select.set", json!({"ids": [c]})).unwrap(); + assert!(!shows(&tall(&mut app, &ctx, vec![]), "Repeat Options"), "a rectangle"); + } +} + /// Quick Actions offer Lock for a selected member in isolation and for a selected group outside it. #[test] fn lock_is_a_quick_action_in_and_outside_isolation_mode() { diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 20927b233e..dbf3ae1cd7 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Properties: Quick Actions has Repeat Options for one selected repeat, #5181; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence @@ -359,7 +359,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Actions panel: Create New Action (bottom bar, ≡ › New Action…) asks for the name, set, function key and color, and Record adds the action and records into it ([Create new actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/record-actions.html)) | partial | `ui.action.new`, `ui.action.play`; `panels/actions.rs` tests. A function key plays its action, even when a command has the same shortcut, and the command keeps it. Button Mode, which shows the color, remains | | Actions panel: Delete Selection (bottom bar) deletes the selected set with its actions and keeps the other sets ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `ui.actionSet.delete`; `panels/actions.rs` tests. VectorCraft's own rules, which the overview does not cover: deleting a set asks first (a selected action is still deleted at once), Shift-click on a set's name selects a range of sets, ≡ › Delete does the same as the button, and Default Actions and the last set can be deleted. Undo does not restore a deleted set, and recorded commands cannot be selected or deleted | | Actions panel: ≡ › Duplicate copies the selected action or set ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `ui.actionSet.duplicate`; `panels/actions.rs` tests. VectorCraft's own rules, which the overview does not cover: the copy goes right after the original, is named after it with " copy" added and is selected, and a copied set holds copies of all its actions. Undo does not remove the copy, and recorded commands cannot be duplicated | -| Properties panel per context (every selection type's Quick Actions) | partial | one clip group: Edit Clipping Path and Edit Contents, at the top of the panel rather than in Quick Actions (G1); the overview's additional controls ([Properties panel overview](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/properties-panel-overview.html)): Blend Options (one blend selected, with any tool, #4817) and Merge Live Paint (a Live Paint group with more) in Quick Actions, the Width Profile list (Width tool or a variable-width stroke) and an applied effect's Delete icon in Appearance, Corner and Corner Radius for corners selected with Direct Selection; Variable Font was already there | +| Properties panel per context (every selection type's Quick Actions) | partial | one clip group: Edit Clipping Path and Edit Contents, at the top of the panel rather than in Quick Actions (G1); the overview's additional controls ([Properties panel overview](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/properties-panel-overview.html)): Blend Options (one blend selected, with any tool, #4817), Repeat Options (one radial, grid or mirror repeat selected: Object › Repeat › Options, #5181; the overview does not list it) and Merge Live Paint (a Live Paint group with more) in Quick Actions, the Width Profile list (Width tool or a variable-width stroke) and an applied effect's Delete icon in Appearance, Corner and Corner Radius for corners selected with Direct Selection; Variable Font was already there | | Select › Start Global Edit / Stop Global Edit; Properties › Quick Actions with the Global Edit Options popover (Match: Appearance, Size; On Artboards: All Artboards or a range, Include Objects On Canvas; Result(s)); Escape stops it; the matched objects are highlighted in their layer colour while it runs; a Shift-click on a highlighted match leaves it out | partial | #3521, `select.globalEdit` / `select.globalEditOptions` / `select.globalEditExclude`, `crates/engine/src/tests/globaledit.rs`; paths, compound paths, symbol instances and groups of them (similar groups, #4939: edits inside one group reach the same object in the others; [public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/edit-groups-with-similar-objects.html)); Shift-click to leave a match out ([public source](https://helpx.adobe.com/ph_fil/illustrator/how-to/global-editing-sensei.html)); the Control bar's Global Edit Options dropdown opens the same options; rotated copies and highlighting matches before the start remain ([public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/edit-similar-objects.html)) | | Contextual task bar | done | | | Control bar with Transform and Stroke popovers | done | | @@ -461,6 +461,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | Properties: Quick Actions has Repeat Options for one selected radial, grid or mirror repeat, opening Object › Repeat › Options with its values (#5181); scores and estimates unchanged | | 2026-11-06 | minor | Control bar: with type selected, a Paragraph: link (the Paragraph panel in a popover) and the Align left, Align center and Align right buttons follow the Character controls; the bar leaves them out from its right end when short of room, after X/Y/W/H and the Align buttons (#5372); scores and estimates unchanged | | 2026-11-04 | minor | Contour add-on (beyond Illustrator): drag away from a selected shape's edge to grow a live copy of it, or toward the inside to shrink it; the copy carries a live Offset Path effect, so it stays editable until Bake (Expand Appearance), a second drag changes the same Contour instead of nesting one, and a floating bar sets the distance and the Sharp, Round or Square corners. `addon.contour.set` is the command behind it. It is a built-in add-on: Object › Plug-ins › Contour, and its own heading in All Tools, with no default shortcut or toolbar slot. A VectorCraft design built on Offset Path; no other application was inspected. Scores and estimates unchanged. | | 2026-11-04 | minor | Contour tool (beyond Illustrator): drag away from a selected shape's edge to grow a live copy of it, or toward the inside to shrink it; the copy carries a live Offset Path effect, so it stays editable until Bake (Expand Appearance), a second drag changes the same Contour instead of nesting one, and a floating bar sets the distance and the Sharp, Round or Square corners. `object.contour` is the command behind it. A VectorCraft design built on Offset Path; no other application was inspected. Scores and estimates unchanged. | From 283c0d12bb56d4c04d78b99e46a022718b06cb60 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:03:04 -0500 Subject: [PATCH 13/56] Effects: an image's Inner Glow follows its visible pixels, not its frame (#5308) Inner Glow clipped to the art's outline and bled in from outside it; for a placed image that outline is the frame, so a PNG with transparent areas glowed along the frame's edge, over pixels that don't show. For an image the glow is now cast by its pixels' alpha (everything around them, blurred, or the pixels themselves with Center) and kept to where the image shows, as much as it shows. --- crates/render/src/fx/renderer.rs | 39 +++++++++++++++++++++++++++++- crates/render/src/fx/tests.rs | 41 ++++++++++++++++++++++++++++++++ docs/ui-parity.md | 2 +- 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/crates/render/src/fx/renderer.rs b/crates/render/src/fx/renderer.rs index 987499710f..fae143a239 100644 --- a/crates/render/src/fx/renderer.rs +++ b/crates/render/src/fx/renderer.rs @@ -697,11 +697,48 @@ impl Renderer { } else { paint(self, ctx, f); } - // Above the content: inner glows, clipped to its outline. + // Above the content: inner glows, clipped to its outline. An image's glow follows its + // visible pixels, not its frame (#5308). let Some((g, rule)) = content.outline else { return }; + let pixels = matches!(content.node.kind, NodeKind::Image(_)); for fx in rfx { let RasterFx::InnerGlow { mode, opacity, blur, color, center } = fx else { continue }; let filter = shadow_filter(0.0, 0.0, *blur, pcolor(f.ink, color)); + if pixels { + self.with_filters(ctx, f, g.bounding_box(), *blur, Some((*mode, *opacity)), |r, c, fr, comp| { + if let Some((m, o)) = comp { + c.set_transform(Affine::IDENTITY); + c.push_layer(None, Some(blend_mode(m)), Some(o), None, None); + } + c.set_transform(fr.view); + c.set_fill_rule(fill_rule(rule)); + c.push_clip_layer(g); + c.push_layer(None, None, None, None, Some(filter)); + if !*center { + // Everything around the visible pixels, so the glow bleeds in from their edges. + let pad = blur * 2.0 + 4.0 * fr.px; + c.set_transform(fr.view); + c.set_paint(peniko::Color::BLACK); + c.fill_rect(&g.bounding_box().inflate(pad, pad)); + c.push_layer(None, Some(peniko::BlendMode::new(peniko::Mix::Normal, peniko::Compose::DestOut)), None, None, None); + } + // The glow is cast by the pixels' alpha alone (the filter takes no color from them). + paint(r, c, fr); + if !*center { + c.pop_layer(); + } + c.pop_layer(); + // Only where the image shows, as much as it shows. + c.push_layer(None, Some(peniko::BlendMode::new(peniko::Mix::Normal, peniko::Compose::DestIn)), None, None, None); + paint(r, c, fr); + c.pop_layer(); + c.pop_layer(); + if comp.is_some() { + c.pop_layer(); + } + }); + continue; + } self.with_filters(ctx, f, g.bounding_box(), *blur, Some((*mode, *opacity)), |_, c, fr, comp| { // The blend layer goes outside the clip: a clip layer is isolated, so a blend // inside it would mix with nothing instead of the content below. diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 031c5afa94..74ff632d67 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -1076,3 +1076,44 @@ fn photoshop_filters_on_content_larger_than_the_budget() { assert!(lum(img.pixel(190, 100)) >= WHITE - 3 * 25, "{id}: outside {:?}", img.pixel(190, 100)); } } + +/// #5308: an image's Inner Glow follows its visible pixels, not its frame. A 40 × 40 image whose +/// left half is transparent and right half opaque black, on a black page, with a white glow from +/// the edges: the transparent half stays black, and the glow lights the opaque half's left edge +/// (inside the frame), on the single-threaded and the multithreaded renderer alike. +#[test] +fn an_image_inner_glow_follows_its_visible_pixels() { + use vectorcraft_doc::{ImageBlob, ImageObject, NodeKind}; + let rgba: Vec = (0..40 * 40).flat_map(|i| if i % 40 < 20 { [0, 0, 0, 0] } else { [0, 0, 0, 255] }).collect(); + let png = crate::encode::png::encode(&rgba, 40, 40, &Default::default()).unwrap(); + let mut d = Document::new(100.0, 100.0); + d.images.insert("half".into(), ImageBlob::new("image/png", png)); + let im = ImageObject { + key: "half".into(), + width: 40, + height: 40, + xf: Affine::translate((30.0, 30.0)), + link: None, + placement: Default::default(), + pixels: None, + }; + let mut n = Node::new(d.alloc_id(), NodeKind::Image(Box::new(im))); + n.appearance.effects = vec![Effect { + id: "stylize.innerGlow".into(), + params: json!({"color": "#ffffff", "mode": "normal", "opacity": 100, "blur": 4}), + visible: true, + }]; + d.insert(Some(d.layers[0].id), 0, n).unwrap(); + let opts = RenderOptions { background: Some([0, 0, 0, 255]), ..Default::default() }; + for threads in [0, 3] { + let mut r = Renderer::new(); + r.threads = threads; + let img = r.render(&d, 100, 100, Affine::IDENTITY, &opts); + for (x, y) in [(31, 50), (40, 31), (45, 50)] { + assert!(lum(img.pixel(x, y)) < 10, "threads {threads}: no glow on the transparent pixels at ({x}, {y}): {:?}", img.pixel(x, y)); + } + assert!(lum(img.pixel(51, 50)) > 60, "threads {threads}: the glow lights the visible pixels' edge: {:?}", img.pixel(51, 50)); + assert!(lum(img.pixel(68, 50)) > 60, "threads {threads}: and the frame's edge where the pixels reach it: {:?}", img.pixel(68, 50)); + assert!(lum(img.pixel(60, 50)) < lum(img.pixel(51, 50)), "threads {threads}: fading inward"); + } +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index dbf3ae1cd7..c53620ef97 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Properties: Quick Actions has Repeat Options for one selected repeat, #5181; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence From 97697420f99e47c26884f19b0b98dc1ca6a81705 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:42:18 -0500 Subject: [PATCH 14/56] Variables: Load Variable Library keeps a bound text variable the library declares (#4136) Loading a variable library deleted every variable of the document with its bindings, including a text variable of the same name that the library declares. Text made dynamic and then given a library's variable name lost its binding, so selecting the library's data sets changed nothing. Such a variable now stays bound, and the library's data sets change its text; other variables are deleted as before. --- crates/engine/src/cmd/variablecmds.rs | 2 +- crates/engine/src/cmd/variablecmds/library.rs | 23 +++++++--- crates/engine/src/tests/variables.rs | 44 +++++++++++++------ docs/mcp.md | 6 ++- docs/target-app-parity.md | 2 +- 5 files changed, 53 insertions(+), 24 deletions(-) diff --git a/crates/engine/src/cmd/variablecmds.rs b/crates/engine/src/cmd/variablecmds.rs index 4806531cde..426479070d 100644 --- a/crates/engine/src/cmd/variablecmds.rs +++ b/crates/engine/src/cmd/variablecmds.rs @@ -856,7 +856,7 @@ pub fn specs() -> Vec { "Load Variable Library…", ["Window", "Variables"], None, - "{path? | xml? | dataBase64?} replace the document's variables and data sets with a variable library's (XML: `variableSets` › `variableSet` › `variables` of `variable` elements with `varName` and `trait`, and `sampleDataSets` of `sampleDataSet` elements with `dataSetName`) in one undo step (none when the document already holds what the library gives). Every variable of the document is deleted with its bindings and values, and every data set is deleted; then variables whose `trait` is `textcontent` are defined as text variables, unbound, and each data set takes a value for a variable from the `p` elements of the element named after it, one paragraph each. Variables of other kinds are left out and named in `skipped` and `warning`. Refused while the variables are locked when it would delete or define a variable → {variables, deleted, deletedDataSets, names, skipped, warning?}", + "{path? | xml? | dataBase64?} replace the document's variables and data sets with a variable library's (XML: `variableSets` › `variableSet` › `variables` of `variable` elements with `varName` and `trait`, and `sampleDataSets` of `sampleDataSet` elements with `dataSetName`) in one undo step (none when the document already holds what the library gives). Every data set is deleted, and every variable of the document is deleted with its bindings and values except a text variable the library also declares, which keeps its bindings; then the library's other variables whose `trait` is `textcontent` are defined as text variables, unbound, and each data set takes a value for a variable from the `p` elements of the element named after it, one paragraph each. Variables of other kinds are left out and named in `skipped` and `warning`. Refused while the variables are locked when it would delete or define a variable → {variables, deleted, deletedDataSets, names, skipped, warning?}", has_doc, load_library ), diff --git a/crates/engine/src/cmd/variablecmds/library.rs b/crates/engine/src/cmd/variablecmds/library.rs index 429a854f4b..54f3689e99 100644 --- a/crates/engine/src/cmd/variablecmds/library.rs +++ b/crates/engine/src/cmd/variablecmds/library.rs @@ -258,24 +258,33 @@ fn parse_library(xml: &str, cmd: &str) -> Result { /// Load Variable Library: replace the document's variables and data sets with a variable library's /// ([`parse_library`]) in one undo step, or none when the document already holds what the library -/// gives. Every variable of the document is deleted with its bindings -/// and values, and every data set is deleted. The library's text variables are then defined, -/// unbound, and its data sets are added. The library's variables of other kinds are left out, named -/// in `skipped` and in a warning. +/// gives. Every data set is deleted, and every variable of the document is deleted with its +/// bindings and values, except a text variable the library also declares: it stays bound to its +/// objects, so the library's data sets change them (#4136; a template's bound variables take a +/// library of the same names: +/// ). The +/// library's other text variables are then defined, unbound, and its data sets are added. The +/// library's variables of other kinds are left out, named in `skipped` and in a warning. pub(super) fn load_library(s: &mut Session, p: &Value) -> Result { const C: &str = "variable.loadLibrary"; let bytes = library_bytes(p, C)?; let xml = std::str::from_utf8(bytes.strip_prefix(b"\xEF\xBB\xBF").unwrap_or(&bytes)).map_err(|_| bad(C, "the variable library is not UTF-8"))?; let lib = parse_library(xml, C)?; let vars = &s.doc()?.doc.variables; - let deleted: Vec = vars.variables.iter().map(|v| v.name.clone()).collect(); + let kept = |v: &Variable| v.kind == VariableKind::Text && lib.text.contains(&v.name); + let deleted: Vec = vars.variables.iter().filter(|v| !kept(v)).map(|v| v.name.clone()).collect(); let deleted_sets: Vec = vars.datasets.iter().map(|d| d.name.clone()).collect(); + let added: Vec = lib + .text + .iter() + .filter(|n| !vars.variables.iter().any(|v| kept(v) && &v.name == *n)) + .map(|n| Variable { name: n.clone(), kind: VariableKind::Text }) + .collect(); // Lock Variables refuses New Variable and Delete Variable, so the load is refused when it would // delete or define a variable. - if !deleted.is_empty() || !lib.text.is_empty() { + if !deleted.is_empty() || !added.is_empty() { variables_unlocked(s).map_err(|why| EngineError::Disabled(C.into(), why))?; } - let added: Vec = lib.text.iter().map(|n| Variable { name: n.clone(), kind: VariableKind::Text }).collect(); let names: Vec = lib.datasets.iter().map(|d| d.name.clone()).collect(); // A load that leaves the variables and data sets as they were adds no undo step. super::edit_variables(s, "Load Variable Library", |vars| { diff --git a/crates/engine/src/tests/variables.rs b/crates/engine/src/tests/variables.rs index e6ef5e69dd..715bae959b 100644 --- a/crates/engine/src/tests/variables.rs +++ b/crates/engine/src/tests/variables.rs @@ -2060,14 +2060,17 @@ fn a_variable_library_defines_text_variables_and_data_sets() { assert_eq!(from_file["names"], json!(["Row 1", "Row 2"])); let bom = [b"\xEF\xBB\xBF".as_slice(), xml.as_bytes()].concat(); let from_base64 = s.execute("variable.loadLibrary", &json!({"dataBase64": vectorcraft_format::base64_encode(&bom)})).unwrap(); - assert_eq!((from_base64["deleted"].clone(), from_base64["deletedDataSets"].clone()), (json!(["Name", "Note"]), json!(["Row 1", "Row 2"]))); + // The library declares the document's text variables: they stay, and only the data sets go. + assert_eq!((from_base64["deleted"].clone(), from_base64["deletedDataSets"].clone()), (json!([]), json!(["Row 1", "Row 2"]))); assert_eq!(s.doc().unwrap().doc.variables.datasets.len(), 2); } /// Load Variable Library replaces the document's variables and data sets: every variable goes with -/// its bindings and values, a text variable of the same name included, and every data set goes, -/// the active one included. The highlight of a variable that went highlights nothing. Undo brings -/// back the variables, bindings, data sets and active data set as they were. +/// its bindings and values, a variable of another kind with a library variable's name included, +/// and every data set goes, the active one included. A text variable the library also declares +/// stays bound (#4136), and the library's data sets then change its text. The highlight of a +/// variable that went highlights nothing. Undo brings back the variables, bindings, data sets and +/// active data set as they were. #[test] fn a_variable_library_replaces_every_variable_and_data_set() { let mut s = session(); @@ -2085,17 +2088,22 @@ fn a_variable_library_replaces_every_variable_and_data_set() { let xml = library(&[("Name", "textcontent"), ("Title", "textcontent")], &[("A", &[("Name", &["New"]), ("Title", &["Heading"])])]); let loaded = s.execute("variable.loadLibrary", &json!({"xml": xml})).unwrap(); - assert_eq!(loaded["deleted"], json!(["Name", "Title", "Kept"])); + assert_eq!(loaded["deleted"], json!(["Title", "Kept"])); assert_eq!((loaded["deletedDataSets"].clone(), loaded["names"].clone()), (json!(["A", "Other"]), json!(["A"]))); let listed = s.execute("variable.list", &json!({})).unwrap(); - assert_eq!(listed["variables"], json!([{"name": "Name", "kind": "text", "bindings": 0}, {"name": "Title", "kind": "text", "bindings": 0}])); + assert_eq!(listed["variables"], json!([{"name": "Name", "kind": "text", "bindings": 1}, {"name": "Title", "kind": "text", "bindings": 0}])); let sets = s.execute("dataset.list", &json!({})).unwrap(); assert_eq!(sets["datasets"].as_array().map(Vec::len), Some(1)); assert_eq!(sets["datasets"][0]["values"], json!({"Name": {"text": "New"}, "Title": {"text": "Heading"}})); assert_eq!(sets["active"], Value::Null); - assert!(s.doc().unwrap().doc.variables.bindings.is_empty(), "the bindings went with the variables"); + let bindings = &s.doc().unwrap().doc.variables.bindings; + assert_eq!(bindings.len(), 1, "the bindings went with the variables, but for Name's"); + assert_eq!(bindings.get(&t).map(|v| v.len()), Some(1)); assert!(s.doc().unwrap().variables_highlight.is_none(), "the highlighted variable went"); assert_eq!(plain(&s, t), "Stays", "loading applies nothing"); + s.execute("dataset.select", &json!({"name": "A"})).unwrap(); + assert_eq!(plain(&s, t), "New", "the library's data set changes the text bound to Name"); + s.execute("edit.undo", &json!({})).unwrap(); s.execute("edit.undo", &json!({})).unwrap(); assert_eq!(s.doc().unwrap().doc.variables, before, "one undo step brings everything back"); @@ -2133,11 +2141,17 @@ fn an_import_or_library_load_that_changes_nothing_records_no_undo_step() { let before = super::history(&s); let r = s.execute("variable.loadLibrary", &json!({"xml": xml})).unwrap(); assert_eq!((super::history(&s), r["names"].clone()), (before, json!(["A", "B"]))); - // Binding the variable makes the next load a change: it deletes the binding. + // A bound variable the library declares keeps its binding: loading it again changes nothing. s.execute("variable.bind", &json!({"variable": "Name", "ids": [t.0]})).unwrap(); super::select_with_a_step_to_redo(&mut s, &[t]); - let undo = super::history(&s).0; + let before = super::history(&s); s.execute("variable.loadLibrary", &json!({"xml": xml})).unwrap(); + assert_eq!(super::history(&s), before); + assert_eq!(s.execute("variable.list", &json!({})).unwrap()["variables"][0]["bindings"], json!(1)); + // A library of other variables is a change: it deletes Name with its binding. + let other = library(&[("Note", "textcontent")], &[("A", &[("Note", &["Hi"])])]); + let undo = super::history(&s).0; + s.execute("variable.loadLibrary", &json!({"xml": other})).unwrap(); assert_eq!(super::history(&s), (undo + 1, 0, true)); // While the variables are locked, a library without text variables still loads its data sets, @@ -2492,9 +2506,10 @@ fn a_saved_variable_library_near_the_size_cap_loads_back() { /// While the variables are locked, a library that would delete or define a variable is refused, as /// Delete Variable and New Variable are, and the document keeps its variables and data sets. That -/// covers a library whose only variable is a text variable the document already has, and one -/// without text variables loaded into a document with variables. A library without text variables -/// loads into a document without variables, replacing its data sets. +/// covers a library without text variables loaded into a document with variables, and one that +/// adds a text variable to the document's. A library of the document's own text variables, and +/// one without text variables loaded into a document without variables, delete and define none: +/// they load, replacing the data sets. #[test] fn locked_variables_refuse_a_library_that_deletes_or_defines_variables() { let mut s = session(); @@ -2502,11 +2517,14 @@ fn locked_variables_refuse_a_library_that_deletes_or_defines_variables() { s.execute("dataset.new", &json!({"name": "A", "values": {"Name": "Old"}})).unwrap(); s.execute("variable.lock", &json!({"locked": true})).unwrap(); let before = s.doc().unwrap().doc.variables.clone(); - for vars in [&[("Name", "textcontent")][..], &[("Shown", "other")][..]] { + for vars in [&[("Shown", "other")][..], &[("Name", "textcontent"), ("Note", "textcontent")][..]] { let e = s.execute("variable.loadLibrary", &json!({"xml": library(vars, &[("B", &[])])})).unwrap_err(); assert!(matches!(&e, EngineError::Disabled(cmd, why) if cmd == "variable.loadLibrary" && why == "variables are locked"), "{e}"); assert_eq!(s.doc().unwrap().doc.variables, before); } + // A library of the document's own text variable deletes and defines none: it loads its data sets. + let r = s.execute("variable.loadLibrary", &json!({"xml": library(&[("Name", "textcontent")], &[("B", &[])])})).unwrap(); + assert_eq!((r["deleted"].clone(), r["deletedDataSets"].clone()), (json!([]), json!(["A"]))); let mut s = session(); s.execute("dataset.new", &json!({"name": "A"})).unwrap(); diff --git a/docs/mcp.md b/docs/mcp.md index 720c0d4e3e..ccc9147b70 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1790,8 +1790,10 @@ already walks Image Trace. Short agent entry points: `dataset.import`, adds no undo step when it leaves the variables and data sets as they were. The library is XML whose `variableSets` element holds `variableSet` elements, each with a `variables` element of `variable` elements (`varName`, `trait`) and a `sampleDataSets` element of `sampleDataSet` elements (`dataSetName`). Every - variable of the document is deleted with its bindings and values, and every data set is deleted. Then the library's - variables whose `trait` is `textcontent` are defined as text variables, unbound. In each data set, the element named + data set is deleted, and every variable of the document is deleted with its bindings and values, except a text + variable the library also declares: it keeps its bindings, so selecting one of the library's data sets changes the + objects bound to it. Then the library's other variables whose `trait` is `textcontent` are defined as text + variables, unbound. In each data set, the element named after a text variable gives its value: the text of its `p` elements, one paragraph each. An element without a `p` element gives no value. Variables of other kinds are left out with their values: the reply lists them in `skipped` (`name`, `trait`), and its `warning` names each `trait` with its count. The reply's `deleted` and `deletedDataSets` diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 0a0061b74e..0c66b06449 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -634,7 +634,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Variables (data merge): text, visibility and image variables bound to objects (an object may carry several), dataset rows applied in one undo step (`variable.*`, `dataset.*`) from a Variables panel and Window › Variables, with dialogs to define, bind and edit, Make Text/Visibility/Image Dynamic, Capture/Update Data Set, CSV import/export (`dataset.import` / `dataset.export`), and a row in italics when an edit leaves the art not matching it; an image dataset value is a file path and apply keeps the object's bounds; bindings let go of deleted art and locked art is left alone; every command, like the rest, is drivable over MCP and the CLI. - Variables: Import Data Sets… (`dataset.import`) reads tab-separated files as well as comma-separated ones. Every header cell is a variable, and the rows replace the document's data sets as Data Set 1, Data Set 2 and so on. An import error about a row's values gives the file line the row starts on. - Variables: Import Data Sets… (`dataset.import`) defines the variables a file's header names that the document lacks, unbound. `#Shown` defines a visibility variable, `@Photo` defines an image variable, and a header without a prefix defines a text variable. A header that is a variable's exact name keeps naming it, and any other `%` header (graph data files) is refused. - - Variables: Load Variable Library… in the Variables panel menu (`variable.loadLibrary`) replaces the document's variables and data sets with a variable library's, read from its XML file, in one undo step: every variable is deleted with its bindings and values, and every data set is deleted; then the library's text variables are defined, unbound, and its data sets take the text of each value's `p` elements, one paragraph each. Variables of other kinds are left out with a warning that names their kinds. + - Variables: Load Variable Library… in the Variables panel menu (`variable.loadLibrary`) replaces the document's variables and data sets with a variable library's, read from its XML file, in one undo step: every data set is deleted, and every variable is deleted with its bindings and values, except a text variable the library also declares, which stays bound so the library's data sets change its objects (#4136); then the library's other text variables are defined, unbound, and its data sets take the text of each value's `p` elements, one paragraph each. Variables of other kinds are left out with a warning that names their kinds. - Variables: Save Variable Library… in the Variables panel menu (`variable.saveLibrary`) writes the document's text variables and data sets as a variable library's XML file, which Load Variable Library reads back with the same text variables, data set names and text values. Variables of other kinds are left out with a warning that names their kinds. - JSON-lines control channel with real egui pointer and keyboard injection. - Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709). From cc0575f15d2c0fa49f88314cb6856d6121b0a845 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 6 Nov 2026 08:10:22 +0700 Subject: [PATCH 15/56] Tests: two canvas tests render on their own thread A document's first frame goes to the render worker, and these read the texture right after it, so under load it had not landed yet. --- crates/ui-egui/src/canvas/tests.rs | 1 + crates/ui-egui/src/graphics.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index dcb9b5312f..ce4c8b9587 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -2879,6 +2879,7 @@ fn pixel_grid_shows_in_pixel_preview_from_600_percent() { #[test] fn grid_and_guides_take_their_preferences() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.canvas.worker_started = true; // render on this thread app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); app.session.execute("guide.add", &json!({"vertical": true, "pos": 100})).unwrap(); app.ui.view.grid = true; diff --git a/crates/ui-egui/src/graphics.rs b/crates/ui-egui/src/graphics.rs index db85972d2a..11f03f5c5e 100644 --- a/crates/ui-egui/src/graphics.rs +++ b/crates/ui-egui/src/graphics.rs @@ -195,6 +195,7 @@ mod tests { #[test] fn the_app_uploads_everything_again_in_a_new_context() { let mut app = app(); + app.canvas.worker_started = true; // render on this thread let old = egui::Context::default(); // Fonts, then the canvas. for _ in 0..3 { From e1439bfe33fb2514dccbbc1bca2eee762f5d22ac Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:53:37 -0500 Subject: [PATCH 16/56] Scrubby labels: the Control bar's Stroke: and Opacity: links scrub their fields (#4088) The Control bar's Stroke: and Opacity: and the Properties panel's Stroke are links to their panels, so a drag on them did nothing while every other field label scrubbed its field. A drag on such a link now scrubs the field after it (same steps and modifiers, one undo step, Escape cancels); a click still opens the panel, and the link's text is not selected by the drag. --- crates/ui-egui/src/chrome/control_bar.rs | 3 +- crates/ui-egui/src/panels/stroke.rs | 6 ++- crates/ui-egui/src/scrub.rs | 52 +++++++++++++++----- crates/ui-egui/src/tests/scrub.rs | 61 ++++++++++++++++++++++++ docs/target-app-parity.md | 5 +- docs/ui-parity.md | 5 +- 6 files changed, 113 insertions(+), 19 deletions(-) diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index 88cc6dde0b..9afbe838eb 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -338,7 +338,8 @@ pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui) { ui.add_space(4.0); ui.separator(); } - if ui.link(egui::RichText::new(tl!("Opacity:")).size(12.0).color(t.text).underline()).clicked() { + // A click opens the Transparency panel; a drag scrubs the field (#4088). + if crate::scrub::link_label(ui, egui::RichText::new(tl!("Opacity:")).size(12.0).color(t.text).underline()).clicked() { app.ui.open_panel = Some("transparency".into()); } if let Some(o) = widgets::plain_field(ui, "cb-opacity", opacity as f64 * 100.0, "%", 0, 56.0) diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rs index fb9269fcfd..f6ece0ac55 100644 --- a/crates/ui-egui/src/panels/stroke.rs +++ b/crates/ui-egui/src/panels/stroke.rs @@ -137,10 +137,12 @@ pub(crate) fn weight_field(app: &mut VectorcraftApp, ui: &mut Ui, id: &str, weig } /// The underlined Stroke link (`label`: the Control bar's "Stroke:", the Properties panel's -/// "Stroke"): a click toggles the Stroke panel in a popover under it. +/// "Stroke"): a click toggles the Stroke panel in a popover under it, and a drag scrubs the weight +/// field after it ([`crate::scrub`]). pub(crate) fn link(app: &mut VectorcraftApp, ui: &mut Ui, label: &str) { let t = Tokens::get(ui.ctx()); - let resp = ui.link(egui::RichText::new(label).size(12.0).color(t.text).underline()).on_hover_text(tl!("Stroke options")); + // A drag on it scrubs the weight field after it (#4088). + let resp = crate::scrub::link_label(ui, egui::RichText::new(label).size(12.0).color(t.text).underline()).on_hover_text(tl!("Stroke options")); widgets::popover(&resp, resp.clicked(), |ui| { ui.set_width(260.0); show(app, ui); diff --git a/crates/ui-egui/src/scrub.rs b/crates/ui-egui/src/scrub.rs index 832b828708..70ceb50606 100644 --- a/crates/ui-egui/src/scrub.rs +++ b/crates/ui-egui/src/scrub.rs @@ -1,8 +1,10 @@ //! Scrubbing numeric fields (#400, beyond Illustrator; Photoshop's scrubby labels): a horizontal //! drag on a numeric field's label (`W:`, `Opacity:`, the Character panel's size icon) steps the //! field's value by one unit every [`PX_PER_STEP`] points, ten with Shift and a tenth with -//! Ctrl/Cmd, as the arrow keys step a focused field; a click on the label focuses the field. The -//! text box itself never scrubs, and a field without a label doesn't. +//! Ctrl/Cmd, as the arrow keys step a focused field; a click on the label focuses the field. A +//! label that is a link (the Control bar's `Stroke:` and `Opacity:`, which open their panels; +//! #4088) scrubs its field the same way, and a click on it still follows the link. The text box +//! itself never scrubs, and a field without a label doesn't. //! //! The panels apply each value the drag passes as they apply a typed one, so the art follows the //! drag live; the app holds an undo group open meanwhile ([`begin_frame`], [`end_frame`]), so the @@ -113,24 +115,44 @@ pub(crate) fn end_frame(app: &mut VectorcraftApp, ctx: &Context) { struct Label { rect: Rect, pass: u64, + /// The label is a link, this widget: a click follows it instead of focusing the field. + link: Option, } /// Note the label (text or icon) drawn at `rect`: a numeric field drawn right after it on the /// same line takes it as its label, which scrubs the field. pub(crate) fn note_label(ui: &Ui, rect: Rect) { + note(ui, rect, None); +} + +/// A link that labels the numeric field drawn after it (it opens a panel when clicked): a drag on +/// it scrubs the field, and a click stays the link's. Its text can't be selected, which a drag +/// across it would otherwise do. +pub(crate) fn link_label(ui: &mut Ui, text: egui::RichText) -> Response { + let link = ui + .scope(|ui| { + ui.style_mut().interaction.selectable_labels = false; + ui.link(text) + }) + .inner; + note(ui, link.rect, Some(link.id)); + link +} + +fn note(ui: &Ui, rect: Rect, link: Option) { let pass = ui.ctx().cumulative_pass_nr(); - ui.data_mut(|d| d.insert_temp(label_id(), Label { rect, pass })); + ui.data_mut(|d| d.insert_temp(label_id(), Label { rect, pass, link })); } /// The label noted just before the field at `field`, on its line. -fn take_label(ui: &Ui, field: Rect) -> Option { +fn take_label(ui: &Ui, field: Rect) -> Option