Attributes: Panel Options sets how many recent URLs the URL menu lists

The Attributes panel menu gets Panel Options..., whose dialog sets how
many of the recent URLs the URL menu lists, a whole number from 1 to 30
(10 by default). ui.attributesPanelOptions {count} sets it without the
dialog; a count out of range is an error and changes nothing. The count
is kept with the UI state.

The recent URL list now keeps the 30 newest distinct URLs of the
session, so a lower count hides older URLs without removing them.
This commit is contained in:
dotCooCoo
2026-11-16 00:26:27 -08:00
parent ed6f22a84c
commit 10f7206bbe
43 changed files with 339 additions and 11 deletions
+2 -1
View File
@@ -862,7 +862,8 @@ pub use compoundshape::selected_member_modes;
/// Pathfinder Options (`Prefs::pathfinder`).
pub use pathops::{PATHFINDER_PRECISION_RANGE, PathfinderOptions};
/// The Attributes panel's state ([`Session::attributes_info`]).
/// The Attributes panel's state ([`Session::attributes_info`]) and how many recent URLs it keeps.
pub use attributes::RECENT_URLS;
pub use overprint::AttributesInfo;
/// Object → Flatten Transparency settings (`object.flattenTransparency`).
+4 -3
View File
@@ -12,8 +12,9 @@ use super::overprint::{AttributesInfo, apply_overprint, edit_counted, overprint_
use super::path::paths_in;
use super::{CommandSpec, NodeId, Result, Session, bad, cmd, has_doc, str_param, targets};
/// How many URLs the Attributes panel's recent list keeps.
const RECENT_URLS: usize = 10;
/// How many URLs the Attributes panel's recent list keeps: the most its Panel Options lets the
/// URL menu list.
pub const RECENT_URLS: usize = 30;
pub fn specs() -> Vec<CommandSpec> {
vec![
@@ -22,7 +23,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Attributes",
[],
None,
"{overprintFill?: bool, overprintStroke?: bool (aimed as object.setOverprint's fill and stroke, item? too), showCenter?: bool (the canvas shows the selected object's centre point), imageMap?: \"none\"|\"rectangle\"|\"polygon\", url?: string (\"\" removes it; SVG, PDF and .ai export link the object), note?: string, ids?|id?, item?: appearance item index|null, target?: \"object\"|\"contents\"} set the Attributes panel's values on ids or the selection, as one undo step; a URL given joins the recent URLs (attributes.info) → {changed: objects}",
"{overprintFill?: bool, overprintStroke?: bool (aimed as object.setOverprint's fill and stroke, item? too), showCenter?: bool (the canvas shows the selected object's centre point), imageMap?: \"none\"|\"rectangle\"|\"polygon\", url?: string (\"\" removes it; SVG, PDF and .ai export link the object), note?: string, ids?|id?, item?: appearance item index|null, target?: \"object\"|\"contents\"} set the Attributes panel's values on ids or the selection, as one undo step; a URL given joins the recent URLs (attributes.info, newest first, at most 30) → {changed: objects}",
has_doc,
set
),
+1 -1
View File
@@ -30,7 +30,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Attributes",
[],
None,
"{ids?|id?, item?, target?: \"object\"|\"contents\"} → {ids, overprintFill, overprintStroke, showCenter, imageMap: \"none\"|\"rectangle\"|\"polygon\", url, note, fillRule: \"nonZero\"|\"evenOdd\" (of the paths and compound paths in them), reversed (their subpaths run counter-clockwise on screen: Reverse Path Direction On), recentUrls: [newest first]} the Attributes panel's values for `ids` or the selection, overprint aimed as object.setOverprint aims; a value is null where they differ (or nothing has a fill, stroke or path)",
"{ids?|id?, item?, target?: \"object\"|\"contents\"} → {ids, overprintFill, overprintStroke, showCenter, imageMap: \"none\"|\"rectangle\"|\"polygon\", url, note, fillRule: \"nonZero\"|\"evenOdd\" (of the paths and compound paths in them), reversed (their subpaths run counter-clockwise on screen: Reverse Path Direction On), recentUrls: [newest first, at most 30]} the Attributes panel's values for `ids` or the selection, overprint aimed as object.setOverprint aims; a value is null where they differ (or nothing has a fill, stroke or path)",
has_doc,
|s, p| Ok(attributes(s, p)?.to_json())
),
+2 -1
View File
@@ -194,7 +194,8 @@ pub struct Session {
/// `plugin.install` takes `grant` and `allowHeavy` from any request
/// ([`Session::allow_plugin_grants_from_requests`]).
plugin_grants_from_requests: bool,
/// URLs recently given in the Attributes panel (`attributes.set {url}`), newest first; not saved.
/// URLs recently given in the Attributes panel (`attributes.set {url}`), newest first, at most
/// [`cmd::RECENT_URLS`]; not saved.
pub recent_urls: Vec<String>,
/// The saved tracing presets' revision and latest changes ([`Session::trace_presets_revision`]).
pub(crate) trace_preset_changes: cmd::TracePresetChanges,
+17
View File
@@ -90,6 +90,23 @@ fn values_that_differ_read_null_and_recent_urls_keep_the_newest_first() {
assert_eq!(info(&mut s, json!({"ids": [p.0, a.0]}))["showCenter"], Value::Null);
}
/// The recent URLs keep the 30 newest distinct URLs, the most the panel's URL menu can list, and
/// a URL given again moves to the front without taking a second place.
#[test]
fn recent_urls_keep_the_thirty_newest() {
let mut s = session();
rect(&mut s, 0.0);
for i in 0..35 {
run(&mut s, "attributes.set", json!({"url": format!("https://example.com/{i}")}));
}
let want: Vec<String> = (5..35).rev().map(|i| format!("https://example.com/{i}")).collect();
assert_eq!(info(&mut s, json!({}))["recentUrls"], json!(want));
run(&mut s, "attributes.set", json!({"url": "https://example.com/20"}));
let urls = info(&mut s, json!({}))["recentUrls"].as_array().unwrap().clone();
assert_eq!((urls.len(), urls[0].as_str(), urls[1].as_str()), (30, Some("https://example.com/20"), Some("https://example.com/34")));
assert_eq!(urls.iter().filter(|u| *u == "https://example.com/20").count(), 1);
}
/// A five-pointed star drawn as one self-intersecting path (its centre is wound twice).
fn star(s: &mut Session) -> NodeId {
let (c, r) = (50.0f64, 45.0f64);
+6
View File
@@ -1099,6 +1099,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{color?: #rrggbb or a preset name (Light Red, the default, then the layer colors such as \"Light Blue\"), solidDashes?: bool (Draw Dashed Lines as Solid Lines, off by default: the Navigator's thumbnail draws dashed strokes without their dashes; the canvas, printing and exports keep them)} set the Navigator panel's options, the color its view box is drawn in and solid dashes (kept with the UI state) → {color, solidDashes}; with neither, open its Panel Options (dialog `navigatorPanelOptions`, fields color, solidDashes; OK sets them); an error for a value that is not a color or not true or false, which changes nothing",
),
(
"ui.attributesPanelOptions",
"Panel Options…",
"",
"{count?: 1–30 (10 by default)} set how many of the recent URLs (attributes.info › recentUrls, which keeps 30) the Attributes panel's URL menu lists, newest first (kept with the UI state) → {count}; without count, open its Panel Options (dialog `attributesPanelOptions`, field count; OK sets it); an error for a count that is not a whole number from 1 to 30, which changes nothing",
),
(
"ui.layersExpand",
"Expand Layers Panel Rows",
+2
View File
@@ -15,6 +15,7 @@ pub mod action_select_object;
pub mod action_set_options;
pub mod action_stop;
pub mod artboard_options;
pub mod attributes_panel_options;
pub mod blend_options;
mod brush_art_options;
pub mod brush_delete;
@@ -466,6 +467,7 @@ registry! {
LayerOptions: [layer_options::KIND] => layer_options::SPEC,
LayersPanelOptions: [layers_panel_options::KIND] => layers_panel_options::SPEC,
NavigatorPanelOptions: [navigator_panel_options::KIND] => navigator_panel_options::SPEC,
AttributesPanelOptions: [attributes_panel_options::KIND] => attributes_panel_options::SPEC,
PathfinderOptions: [pathfinder_options::KIND] => pathfinder_options::SPEC,
PixelSnapOptions: [pixel_snap_options::KIND] => pixel_snap_options::SPEC,
RearrangeArtboards: [rearrange_artboards::KIND] => rearrange_artboards::SPEC,
@@ -0,0 +1,82 @@
//! Attributes panel › Panel Options…: how many recent URLs the panel's URL menu lists.
//!
//! Field: `count` (1–30). OK runs `ui.attributesPanelOptions` with it (kept with the UI state).
use serde_json::{Value, json};
use super::DialogSpec;
use super::swatch_options::{grid, label};
use crate::panels::attributes::DEFAULT_RECENT_URLS;
use crate::state::Dialog;
use crate::{VectorcraftApp, widgets};
/// The dialog kind of the Attributes Panel Options.
pub const KIND: &str = "attributesPanelOptions";
pub(super) const SPEC: DialogSpec =
DialogSpec { heading: |_| tl!("Attributes Panel Options").into(), body, confirm, min_width: 280.0, ..DialogSpec::FORM };
/// `ui.attributesPanelOptions` without options: open the dialog on the panel's options.
pub fn open(app: &mut VectorcraftApp) -> Result<Value, String> {
let count = app.ui.attributes_panel.shown();
app.ui.dialog = Some(Dialog::new(KIND, json!({ "count": count })));
Ok(Value::Null)
}
fn body(_: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
grid(ui, |ui| {
label(ui, tl!("Number of Recent URLs:"));
let v = d.f64("count", f64::from(DEFAULT_RECENT_URLS));
let max = vectorcraft_engine::cmd::RECENT_URLS as f64;
if let Some(v) = widgets::range_field(ui, "attributes-recent-urls", v, 1.0..=max, "", 0, 60.0) {
d.fields.insert("count".into(), json!(v));
}
ui.end_row();
});
false
}
/// OK: set the count; a count that is refused leaves the dialog open.
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
let params = json!({ "count": d.fields.get("count").cloned().unwrap_or(Value::Null) });
let r = app.run("ui.attributesPanelOptions", params)?;
app.ui.dialog = None;
Ok(r)
}
#[cfg(test)]
mod tests {
use super::*;
use vectorcraft_engine::Session;
/// The dialog opens on the panel's count (10 by default), OK sets it, kept with the UI state,
/// and a count out of range is refused, leaving the dialog open and the count as it was.
#[test]
fn panel_options_set_the_recent_url_count() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("ui.attributesPanelOptions", json!({})).unwrap();
let d = app.ui.dialog.as_ref().unwrap();
assert_eq!((d.kind.as_str(), d.f64("count", 0.0)), (KIND, 10.0));
// Drawn headlessly in the shared frame.
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
let mut out = ctx.run_ui(Default::default(), |ui| super::super::show(&mut app, ui.ctx()));
out.textures_delta.clear();
let set = |app: &mut VectorcraftApp, count: Value| {
app.ui.dialog.as_mut().unwrap().fields.insert("count".into(), count);
super::super::confirm(app)
};
assert_eq!(set(&mut app, json!(25.0)).unwrap(), json!({"count": 25}));
assert!(app.ui.dialog.is_none());
assert_eq!(app.ui.attributes_panel.recent_urls, 25);
app.run("ui.attributesPanelOptions", json!({})).unwrap();
assert_eq!(app.ui.dialog.as_ref().unwrap().f64("count", 0.0), 25.0, "opens on the current count");
assert!(set(&mut app, json!(31)).is_err());
assert!(app.ui.dialog.is_some() && app.ui.attributes_panel.recent_urls == 25, "a refused count changes nothing");
// Cancel closes the dialog without applying what was typed.
app.ui.dialog.as_mut().unwrap().fields.insert("count".into(), json!(3));
super::super::cancel(&mut app);
assert!(app.ui.dialog.is_none());
assert_eq!(app.ui.attributes_panel.recent_urls, 25);
}
}
+3
View File
@@ -2113,6 +2113,9 @@ font-technology Variable Променливи
Navigate Навигация
Navigator Навигатор
Navigator Panel Options Опции за панела „Навигатор“
Attributes Panel Options Опции за панела „Атрибути“
Number of Recent URLs: Брой скорошни URL адреси:
@msg `count` must be a whole number from 1 to 30 `count` трябва да е цяло число от 1 до 30
Draw Dashed Lines as Solid Lines Изчертаване на прекъснатите линии като плътни
Needs the desktop app Изисква десктоп приложение
Neutral Gradients Неутрални градиенти
Can't render this file because it is too large.
+3
View File
@@ -766,6 +766,9 @@
Magic Wand Čarobni štapić
Navigator Navigator
Navigator Panel Options Opcije panela navigatora
Attributes Panel Options Opcije panela atributa
Number of Recent URLs: Broj nedavnih URL-ova:
@msg `count` must be a whole number from 1 to 30 `count` mora biti cijeli broj od 1 do 30
Draw Dashed Lines as Solid Lines Crtaj isprekidane linije kao pune
Pattern Options Opcije uzorka
Properties Svojstva
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -2776,6 +2776,9 @@ digits Malayalam Malaiàlam
Navigate Navega
Navigator Navegador
Navigator Panel Options Opcions del panell Navegador
Attributes Panel Options Opcions del panell Atributs
Number of Recent URLs: Nombre d’URL recents:
@msg `count` must be a whole number from 1 to 30 `count` ha de ser un nombre enter d’1 a 30
Draw Dashed Lines as Solid Lines Dibuixa les línies discontínues com a contínues
Needs a choice Necessita una tria
Needs a key Necessita una clau
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -779,6 +779,9 @@
Magic Wand Kouzelná hůlka
Navigator Navigátor
Navigator Panel Options Možnosti panelu Navigátor
Attributes Panel Options Možnosti panelu Atributy
Number of Recent URLs: Počet nedávných URL:
@msg `count` must be a whole number from 1 to 30 `count` musí být celé číslo od 1 do 30
Draw Dashed Lines as Solid Lines Kreslit čárkované čáry jako plné
Pattern Options Možnosti vzorku
Properties Vlastnosti
Can't render this file because it is too large.
+3
View File
@@ -3398,6 +3398,9 @@ liquify-list-end {0}, {1} {0} og {1}
Magic Wand Magisk tryllestav
Navigator Navigator
Navigator Panel Options Indstillinger for navigatorpanelet
Attributes Panel Options Indstillinger for attributpanelet
Number of Recent URLs: Antal seneste URL'er:
@msg `count` must be a whole number from 1 to 30 `count` skal være et heltal fra 1 til 30
Draw Dashed Lines as Solid Lines Tegn stiplede linjer som hele linjer
Pattern Options Mønsterindstillinger
Properties Egenskaber
Can't render this file because it is too large.
+3
View File
@@ -2193,6 +2193,9 @@ file-filter Templates Vorlagen
Navigate Navigieren
Navigator Navigator
Navigator Panel Options Optionen für das Navigatorbedienfeld
Attributes Panel Options Optionen für das Attributebedienfeld
Number of Recent URLs: Anzahl zuletzt verwendeter URLs:
@msg `count` must be a whole number from 1 to 30 `count` muss eine ganze Zahl von 1 bis 30 sein
Draw Dashed Lines as Solid Lines Gestrichelte Linien als durchgezogene Linien zeichnen
Needs the desktop app Erfordert die Desktop-App
Neutral Gradients Neutrale Verläufe
Can't render this file because it is too large.
+3
View File
@@ -1888,6 +1888,9 @@ font-technology Variable Μεταβλητές
Name: Όνομα:
Navigator Πλοήγηση
Navigator Panel Options Επιλογές πίνακα πλοήγησης
Attributes Panel Options Επιλογές πίνακα χαρακτηριστικών
Number of Recent URLs: Αριθμός πρόσφατων διευθύνσεων URL:
@msg `count` must be a whole number from 1 to 30 Το `count` πρέπει να είναι ακέραιος από 1 έως 30
Draw Dashed Lines as Solid Lines Σχεδίαση διακεκομμένων γραμμών ως συνεχών
New Νέο
Scatter: Διασπορά:
Can't render this file because it is too large.
+3
View File
@@ -2194,6 +2194,9 @@ font-technology Variable Variables
Navigate Navegar
Navigator Navegador
Navigator Panel Options Opciones del panel Navegador
Attributes Panel Options Opciones del panel Atributos
Number of Recent URLs: Número de URL recientes:
@msg `count` must be a whole number from 1 to 30 `count` debe ser un número entero entre 1 y 30
Draw Dashed Lines as Solid Lines Dibujar líneas discontinuas como continuas
Needs the desktop app Requiere la aplicación de escritorio
Neutral Gradients Degradados neutros
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -770,6 +770,9 @@
Magic Wand Taikasauva
Navigator Navigaattori
Navigator Panel Options Navigaattori-paneelin asetukset
Attributes Panel Options Määritteet-paneelin asetukset
Number of Recent URLs: Viimeisimpien URL-osoitteiden määrä:
@msg `count` must be a whole number from 1 to 30 `count` on oltava kokonaisluku 1–30
Draw Dashed Lines as Solid Lines Piirrä katkoviivat yhtenäisinä viivoina
Pattern Options Kuvion asetukset
Properties Ominaisuudet
Can't render this file because it contains an unexpected character in line 2 and column 73.
+3
View File
@@ -2184,6 +2184,9 @@ font-technology Variable Variables
Navigate Naviguer
Navigator Navigation
Navigator Panel Options Options du panneau Navigation
Attributes Panel Options Options du panneau Options d’objet
Number of Recent URLs: Nombre d’URL récentes :
@msg `count` must be a whole number from 1 to 30 `count` doit être un nombre entier compris entre 1 et 30
Draw Dashed Lines as Solid Lines Dessiner les pointillés en traits pleins
Needs the desktop app Nécessite l’application de bureau
Neutral Gradients Dégradés neutres
Can't render this file because it is too large.
+3
View File
@@ -2278,6 +2278,9 @@
Navigate નેવિગેટ કરો
Navigator નેવિગેટર
Navigator Panel Options નેવિગેટર પૅનલ વિકલ્પો
Attributes Panel Options ગુણધર્મો પૅનલ વિકલ્પો
Number of Recent URLs: તાજેતરના URLની સંખ્યા:
@msg `count` must be a whole number from 1 to 30 `count` 1 થી 30 સુધીની પૂર્ણ સંખ્યા હોવી જોઈએ
Needs Attention Only માત્ર ધ્યાન માગતા
Needs a choice પસંદગી જરૂરી
Needs a key કીની જરૂર છે
Can't render this file because it contains an unexpected character in line 72 and column 5.
+3
View File
@@ -3032,6 +3032,9 @@ antiAlias Sharp शार्प
Navigate नेविगेट करें
Navigator नेविगेटर
Navigator Panel Options नेविगेटर पैनल ऑप्शन्स
Attributes Panel Options एट्रिब्यूट्स पैनल ऑप्शन्स
Number of Recent URLs: हाल के URL की संख्या:
@msg `count` must be a whole number from 1 to 30 `count` 1 से 30 तक पूरी संख्या होना चाहिए
Nearly Closed Paths लगभग बंद पाथ
Nearly Coincident Anchors लगभग Coincident एंकर
Needless Clipping Groups अनावश्यक क्लिपिंग समूह
Can't render this file because it is too large.
+3
View File
@@ -2737,6 +2737,9 @@ file-filter Templates Sablonok
Navigate Navigálás
Navigator Navigátor
Navigator Panel Options Navigátor panel beállításai
Attributes Panel Options Attribútumok panel beállításai
Number of Recent URLs: Legutóbbi URL-ek száma:
@msg `count` must be a whole number from 1 to 30 `count`: 1 és 30 közötti egész szám kell
Draw Dashed Lines as Solid Lines Szaggatott vonalak rajzolása folytonosként
Needs the desktop app Az asztali alkalmazás kell hozzá
Negative Negatív
Can't render this file because it is too large.
+3
View File
@@ -724,6 +724,9 @@
Magic Wand Tongkat ajaib
Navigator Navigator
Navigator Panel Options Opsi panel navigator
Attributes Panel Options Opsi panel atribut
Number of Recent URLs: Jumlah URL terbaru:
@msg `count` must be a whole number from 1 to 30 `count` harus bilangan bulat dari 1 sampai 30
Draw Dashed Lines as Solid Lines Gambar garis putus-putus sebagai garis utuh
Pattern Options Opsi pola
Properties Properti
1 # Indonesian (id) catalog. Same format as zh-hant.tsv: context <TAB> source <TAB> translation
724
725
726
727
728 @msg
729
730
731
732
+3
View File
@@ -2230,6 +2230,9 @@ file-filter Templates Modelli
Navigate Naviga
Navigator Navigatore
Navigator Panel Options Opzioni pannello Navigatore
Attributes Panel Options Opzioni pannello Attributi
Number of Recent URLs: Numero di URL recenti:
@msg `count` must be a whole number from 1 to 30 `count` deve essere un numero intero compreso tra 1 e 30
Draw Dashed Lines as Solid Lines Disegna le linee tratteggiate come linee continue
Needs the desktop app Richiede l'app desktop
Neutral Gradients Sfumature neutre
Can't render this file because it is too large.
+3
View File
@@ -798,6 +798,9 @@ digits Malayalam マラヤーラム数字
Magic Wand 自動選択
Navigator ナビゲーター
Navigator Panel Options ナビゲーターパネルオプション
Attributes Panel Options 属性パネルオプション
Number of Recent URLs: 最近使った URL の数:
@msg `count` must be a whole number from 1 to 30 `count` には 1 から 30 までの整数を指定してください
Draw Dashed Lines as Solid Lines 破線を実線で表示
Pattern Options パターンオプション
Properties プロパティ
Can't render this file because it is too large.
+3
View File
@@ -2773,6 +2773,9 @@
Magic Wand ჯადოსნური ჯოხი
Navigator ნავიგატორი
Navigator Panel Options ნავიგატორის პანელის პარამეტრები
Attributes Panel Options ატრიბუტების პანელის პარამეტრები
Number of Recent URLs: ბოლოდროინდელი URL-ების რაოდენობა:
@msg `count` must be a whole number from 1 to 30 `count` უნდა იყოს მთელი რიცხვი 1-დან 30-მდე
Draw Dashed Lines as Solid Lines ტირეებიანი ხაზების უწყვეტ ხაზებად დახატვა
Pattern Options პატერნის პარამეტრები
Properties თვისებები
Can't render this file because it is too large.
+3
View File
@@ -791,6 +791,9 @@ digits Malayalam 말라얄람어
Magic Wand 마술봉
Navigator 내비게이터
Navigator Panel Options 내비게이터 패널 옵션
Attributes Panel Options 속성 패널 옵션
Number of Recent URLs: 최근 URL 수:
@msg `count` must be a whole number from 1 to 30 `count`은(는) 1에서 30 사이의 정수여야 합니다
Draw Dashed Lines as Solid Lines 점선을 실선으로 그리기
Pattern Options 패턴 옵션
Properties 속성
Can't render this file because it is too large.
+3
View File
@@ -1292,6 +1292,9 @@ liquify-list-end {0}, {1} {0} en {1}
Magic Wand Magische toverstaf
Navigator Navigator
Navigator Panel Options Opties voor het paneel Navigator
Attributes Panel Options Opties voor het paneel Kenmerken
Number of Recent URLs: Aantal recente URL's:
@msg `count` must be a whole number from 1 to 30 `count` moet een geheel getal van 1 tot 30 zijn
Draw Dashed Lines as Solid Lines Streepjeslijnen als doorgetrokken lijnen tekenen
Pattern Options Patroonopties
Properties Eigenschappen
Can't render this file because it is too large.
+3
View File
@@ -726,6 +726,9 @@
Magic Wand Różdżka
Navigator Nawigator
Navigator Panel Options Opcje panelu Nawigator
Attributes Panel Options Opcje panelu Atrybuty
Number of Recent URLs: Liczba ostatnich adresów URL:
@msg `count` must be a whole number from 1 to 30 `count` musi być liczbą całkowitą od 1 do 30
Draw Dashed Lines as Solid Lines Rysuj linie przerywane jako ciągłe
Pattern Options Opcje wzorka
Properties Właściwości
Can't render this file because it is too large.
+3
View File
@@ -1829,6 +1829,9 @@ antiAlias Sharp Nítido
Navigate Navegar
Navigator Navegador
Navigator Panel Options Opções do painel Navegador
Attributes Panel Options Opções do painel Atributos
Number of Recent URLs: Número de URLs Recentes:
@msg `count` must be a whole number from 1 to 30 `count` deve ser um número inteiro de 1 a 30
Draw Dashed Lines as Solid Lines Desenhar linhas tracejadas como linhas sólidas
Needs the desktop app Requer o aplicativo de desktop
Neutral Gradients Gradientes Neutros
Can't render this file because it is too large.
+3
View File
@@ -2221,6 +2221,9 @@ file-filter Templates Шаблоны
Navigate Навигация
Navigator Навигатор
Navigator Panel Options Параметры панели «Навигатор»
Attributes Panel Options Параметры панели «Атрибуты»
Number of Recent URLs: Число последних URL:
@msg `count` must be a whole number from 1 to 30 `count` должно быть целым числом от 1 до 30
Draw Dashed Lines as Solid Lines Рисовать штриховые линии сплошными
Needs the desktop app Требуется настольное приложение
Neutral Gradients Нейтральные градиенты
Can't render this file because it is too large.
+3
View File
@@ -2129,6 +2129,9 @@ font-technology Variable Variabla
Navigate Navigera
Navigator Navigator
Navigator Panel Options Alternativ för panelen Navigator
Attributes Panel Options Alternativ för panelen Attribut
Number of Recent URLs: Antal senaste URL:er:
@msg `count` must be a whole number from 1 to 30 `count` måste vara ett heltal från 1 till 30
Draw Dashed Lines as Solid Lines Rita streckade linjer som heldragna linjer
Needs the desktop app Kräver skrivbordsappen
Neutral Gradients Neutrala gradienter
Can't render this file because it is too large.
+16
View File
@@ -434,6 +434,22 @@ fn font_height_reference_labels_are_in_complete_catalogs() {
}
}
/// The Attributes Panel Options dialog's heading and field, and the error for a count out of range.
#[test]
fn attributes_panel_options_strings_are_in_complete_catalogs() {
for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) {
for label in ["Attributes Panel Options", "Number of Recent URLs:"] {
assert!(lang.catalog().plain(label).is_some(), "{} is missing {label}", lang.code);
}
}
let range = "`count` must be a whole number from 1 to 30";
assert!(message_literals().contains(range));
for code in COMPLETE_MESSAGES {
let lang = Lang::from_code(code).expect("registered");
assert_ne!(message(lang, range), range, "{code}");
}
}
/// The Objects on Path Options section's Detach button, its undo step and the message for a
/// Detach with no object chosen.
#[test]
+3
View File
@@ -2009,6 +2009,9 @@ font-technology Variable Değişken
Navigate Gezin
Navigator Gezgin
Navigator Panel Options Gezgin Paneli Seçenekleri
Attributes Panel Options Nitelikler Paneli Seçenekleri
Number of Recent URLs: Son URL Sayısı:
@msg `count` must be a whole number from 1 to 30 `count` 1 ile 30 arasında bir tam sayı olmalıdır
Draw Dashed Lines as Solid Lines Kesikli Çizgileri Düz Çizgi Olarak Çiz
Needs the desktop app Masaüstü uygulaması gerekiyor
Neutral Gradients Nötr Degradeler
Can't render this file because it is too large.
+3
View File
@@ -2224,6 +2224,9 @@ file-filter Templates Шаблони
Navigate Навігація
Navigator Навігатор
Navigator Panel Options Параметри панелі «Навігатор»
Attributes Panel Options Параметри панелі «Атрибути»
Number of Recent URLs: Кількість останніх URL:
@msg `count` must be a whole number from 1 to 30 `count` має бути цілим числом від 1 до 30
Draw Dashed Lines as Solid Lines Малювати штрихові лінії суцільними
Needs the desktop app Потрібен настільний додаток
Neutral Gradients Нейтральні градієнти
Can't render this file because it is too large.
+3
View File
@@ -2555,6 +2555,9 @@ digits Hindi Hindi
Navigate Dẫn hướng
Navigator Bộ dẫn hướng
Navigator Panel Options Tùy chọn bảng bộ dẫn hướng
Attributes Panel Options Tùy chọn bảng thuộc tính
Number of Recent URLs: Số URL gần đây:
@msg `count` must be a whole number from 1 to 30 `count` phải là số nguyên từ 1 đến 30
Draw Dashed Lines as Solid Lines Vẽ đường nét đứt thành đường liền
Needs the desktop app Cần ứng dụng máy tính để bàn
Neutral Gradients Chuyển sắc trung tính
Can't render this file because it contains an unexpected character in line 205 and column 5.
+3
View File
@@ -2096,6 +2096,9 @@ file-filter Templates 模板
Navigate 导航
Navigator 导航器
Navigator Panel Options 导航器面板选项
Attributes Panel Options 属性面板选项
Number of Recent URLs: 最近使用的网址数量:
@msg `count` must be a whole number from 1 to 30 `count` 必须是 1 到 30 之间的整数
Draw Dashed Lines as Solid Lines 将虚线绘制为实线
Needs the desktop app 需要桌面应用
Neutral Gradients 中性渐变
Can't render this file because it is too large.
+3
View File
@@ -3352,6 +3352,9 @@ liquify-list-end {0}, {1} {0}和{1}
Navigate 導覽
Navigator 導覽器
Navigator Panel Options 導覽器面板選項
Attributes Panel Options 屬性面板選項
Number of Recent URLs: 最近使用的網址數量:
@msg `count` must be a whole number from 1 to 30 `count` 必須是 1 到 30 之間的整數
Draw Dashed Lines as Solid Lines 將虛線繪製為實線
Needs the desktop app 需要桌面版應用程式
Neutral Gradients 中性漸層
Can't render this file because it is too large.
+1
View File
@@ -838,6 +838,7 @@ fn run_ui_part8(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
"artboard.selectAll" => crate::panels::artboards::select_all_command(app),
"ui.layersPanelOptions" => crate::dialogs::layers_panel_options::open(app),
"ui.navigatorPanelOptions" => crate::panels::navigator::set_options(app, p),
"ui.attributesPanelOptions" => crate::panels::attributes::set_options(app, p),
"ui.layersExpand" => crate::panels::layers::expand(app, p),
"ui.layersFilter" => crate::panels::layers::set_filter(app, p),
"ui.panelView" => crate::panels::set_view(app, p),
+6
View File
@@ -1100,6 +1100,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{color?: #rrggbb or a preset name (Light Red, the default, then the layer colors such as \"Light Blue\"), solidDashes?: bool (Draw Dashed Lines as Solid Lines, off by default: the Navigator's thumbnail draws dashed strokes without their dashes; the canvas, printing and exports keep them)} set the Navigator panel's options, the color its view box is drawn in and solid dashes (kept with the UI state) → {color, solidDashes}; with neither, open its Panel Options (dialog `navigatorPanelOptions`, fields color, solidDashes; OK sets them); an error for a value that is not a color or not true or false, which changes nothing",
),
(
"ui.attributesPanelOptions",
"Panel Options…",
"",
"{count?: 1–30 (10 by default)} set how many of the recent URLs (attributes.info › recentUrls, which keeps 30) the Attributes panel's URL menu lists, newest first (kept with the UI state) → {count}; without count, open its Panel Options (dialog `attributesPanelOptions`, field count; OK sets it); an error for a count that is not a whole number from 1 to 30, which changes nothing",
),
(
"ui.layersExpand",
"Expand Layers Panel Rows",
+102 -5
View File
@@ -1,13 +1,15 @@
//! Attributes panel: Overprint Fill / Overprint Stroke, Show / Don't Show Center, Reverse Path
//! Direction Off / On, the fill rule (non-zero winding or even-odd), Image Map, URL (with the
//! recent URLs and a Browser button) and the note. The menu hides the options and shows the note.
//! recent URLs and a Browser button) and the note. The menu hides the options and shows the note,
//! and its Panel Options… sets how many recent URLs the URL menu lists ([`PanelOptions`]).
//! Everything reads `attributes.info` ([`vectorcraft_engine::Session::attributes_info`]) and acts
//! through `attributes.set`, `path.reverse` and `path.setFillRule`.
use egui::Ui;
use serde::{Deserialize, Deserializer, Serialize};
use serde_json::{Value, json};
use vectorcraft_doc::{ImageMap, NodeId, NodeKind};
use vectorcraft_engine::cmd::AttributesInfo;
use vectorcraft_engine::cmd::{AttributesInfo, RECENT_URLS};
use vectorcraft_geom::FillRule;
use super::{pstate, selection_len, set_pstate};
@@ -20,6 +22,63 @@ const HIDE_OPTIONS: &str = "attr-hide-options";
const HIDE_NOTE: &str = "attr-hide-note";
const LABEL_W: f32 = 70.0;
/// How many recent URLs the URL menu lists by default (VectorCraft's own value).
pub const DEFAULT_RECENT_URLS: u8 = 10;
/// Attributes panel options (≡ › Panel Options…), kept with the UI state.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct PanelOptions {
/// How many of the recent URLs the URL menu lists, 1 to [`RECENT_URLS`]. A saved value that is
/// not a whole number in that range reads as [`DEFAULT_RECENT_URLS`].
#[serde(deserialize_with = "saved_count")]
pub recent_urls: u8,
}
impl Default for PanelOptions {
fn default() -> Self {
Self { recent_urls: DEFAULT_RECENT_URLS }
}
}
impl PanelOptions {
/// How many recent URLs the URL menu lists: [`Self::recent_urls`], or the default when it is
/// out of range.
pub fn shown(&self) -> usize {
Some(usize::from(self.recent_urls)).filter(|n| (1..=RECENT_URLS).contains(n)).unwrap_or(usize::from(DEFAULT_RECENT_URLS))
}
}
/// A saved count of recent URLs: a whole number from 1 to [`RECENT_URLS`], anything else the default.
fn saved_count<'de, D: Deserializer<'de>>(d: D) -> Result<u8, D::Error> {
let v = Value::deserialize(d)?;
Ok(count(&v).unwrap_or(DEFAULT_RECENT_URLS))
}
/// `v` as a count of recent URLs, when it is a whole number from 1 to [`RECENT_URLS`].
fn count(v: &Value) -> Option<u8> {
let n = v.as_f64().filter(|n| n.fract() == 0.0 && (1.0..=RECENT_URLS as f64).contains(n))?;
u8::try_from(n as u64).ok()
}
/// `ui.attributesPanelOptions {count?}`: without `count`, open Panel Options on the panel's
/// options; otherwise set how many recent URLs the URL menu lists and answer the options. A count
/// that is not a whole number from 1 to 30 is an error, and nothing changes.
pub fn set_options(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
let Some(c) = p.get("count") else {
return crate::dialogs::attributes_panel_options::open(app);
};
let n = count(c).ok_or("`count` must be a whole number from 1 to 30")?;
app.ui.attributes_panel.recent_urls = n;
Ok(json!({ "count": n }))
}
/// The recent URLs the URL menu lists, newest first: as many as Panel Options sets.
fn menu_urls(app: &VectorcraftApp) -> &[String] {
let urls = &app.session.recent_urls;
&urls[..urls.len().min(app.ui.attributes_panel.shown())]
}
/// The panel's values and whether the targets hold paths (direction and fill rule apply),
/// recomputed only when the document or the selection changes.
fn state(app: &VectorcraftApp, ctx: &egui::Context) -> (AttributesInfo, bool) {
@@ -133,13 +192,13 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
}
}
/// The recent URLs button: a menu of the URLs given lately; picking one sets it.
/// The recent URLs button: a menu of the URLs given lately ([`menu_urls`]); picking one sets it.
fn recent_urls(app: &mut VectorcraftApp, ui: &mut Ui) {
let resp = widgets::icon_button_enabled(ui, "chevron-down", tl!("Recent URLs"), false, !app.session.recent_urls.is_empty(), 20.0);
let mut chosen = None;
egui::Popup::menu(&resp).show(|ui| {
ui.set_min_width(220.0);
for u in &app.session.recent_urls {
for u in menu_urls(app) {
if widgets::menu_item_name(ui, u, true, false) {
chosen = Some(u.clone());
}
@@ -150,13 +209,16 @@ fn recent_urls(app: &mut VectorcraftApp, ui: &mut Ui) {
}
}
pub fn menu(_app: &mut VectorcraftApp, ui: &mut Ui) {
pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) {
for (key, hide, show) in [(HIDE_OPTIONS, tl!("Hide Options"), tl!("Show Options")), (HIDE_NOTE, tl!("Hide Note"), tl!("Show Note"))] {
let hidden: bool = pstate(ui.ctx(), key);
if menu_item(ui, if hidden { show } else { hide }, true, false) {
set_pstate(ui.ctx(), key, !hidden);
}
}
if menu_item(ui, tl!("Panel Options…"), true, false) {
app.run("ui.attributesPanelOptions", json!({})).ok();
}
}
/// `attributes.openUrl {url?}`: open `url`, else the selection's URL, in the web browser.
@@ -257,4 +319,39 @@ mod tests {
open_url(&mut app, &json!({"url": "https://example.com/b"})).unwrap();
assert_eq!(*opened.borrow(), ["https://example.com/b"]);
}
/// The URL menu lists the newest 10 recent URLs by default, and `ui.attributesPanelOptions`
/// sets how many it lists, from 1 to 30, kept with the UI state. A lower count hides the older
/// URLs without forgetting them, and a count that is not a whole number from 1 to 30 is an
/// error that changes nothing.
#[test]
fn panel_options_set_how_many_recent_urls_the_menu_lists() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
run(&mut app, "file.new", json!({"width": 100, "height": 100}));
run(&mut app, "shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50}));
for i in 0..32 {
run(&mut app, "attributes.set", json!({"url": format!("https://example.com/{i}")}));
}
assert!(frame(&mut app).iter().any(|t| t == " Panel Options…"));
assert_eq!((menu_urls(&app).len(), menu_urls(&app)[0].as_str()), (10, "https://example.com/31"));
assert_eq!(app.run("ui.attributesPanelOptions", json!({"count": 1})).unwrap(), json!({"count": 1}));
assert_eq!(menu_urls(&app), ["https://example.com/31"]);
app.run("ui.attributesPanelOptions", json!({"count": 30.0})).unwrap();
assert_eq!((menu_urls(&app).len(), menu_urls(&app)[29].as_str()), (30, "https://example.com/2"));
for bad in [json!(0), json!(31), json!(2.5), json!(-1), json!("5"), Value::Null] {
assert!(app.run("ui.attributesPanelOptions", json!({"count": bad})).is_err(), "{bad}");
}
assert_eq!(app.ui.attributes_panel.recent_urls, 30, "a refused count changes nothing");
assert_eq!(app.session.recent_urls.len(), 30);
// Kept with the UI state; UI state saved without it, or with a count out of range, lists 10.
let back: crate::UiState = serde_json::from_value(serde_json::to_value(&app.ui).unwrap()).unwrap();
assert_eq!(back.attributes_panel.recent_urls, 30);
let old: crate::UiState = serde_json::from_value(json!({})).unwrap();
assert_eq!(old.attributes_panel, PanelOptions::default());
for saved in [json!(0), json!(99), json!(1000), json!(4.5), json!("12"), Value::Null] {
let s: crate::UiState = serde_json::from_value(json!({"attributes_panel": {"recentUrls": saved}})).unwrap();
assert_eq!(s.attributes_panel.shown(), 10, "{saved}");
}
assert_eq!(PanelOptions { recent_urls: 200 }.shown(), 10);
}
}
+4
View File
@@ -853,6 +853,9 @@ pub struct UiState {
/// Navigator panel › Panel Options… (the view box color, Draw Dashed Lines as Solid Lines).
#[serde(default)]
pub navigator_panel: crate::panels::navigator::PanelOptions,
/// Attributes panel › Panel Options… (how many recent URLs the URL menu lists).
#[serde(default)]
pub attributes_panel: crate::panels::attributes::PanelOptions,
/// The Layers panel's Filter (`ui.layersFilter`). It is not saved and lasts the session, as the
/// Search All text does.
#[serde(skip)]
@@ -1273,6 +1276,7 @@ impl Default for UiState {
trace_hold_source: None,
layers_panel: Default::default(),
navigator_panel: Default::default(),
attributes_panel: Default::default(),
layers_filter: Default::default(),
swatches_view: Default::default(),
graphic_styles_view: Default::default(),
+9
View File
@@ -5692,9 +5692,18 @@ paths and compound paths, and `path.reverse {reversed?}` makes subpaths run coun
(false). When every subpath of a path or compound path turns alike, its strokes' width profiles (left and right swapped) and pen
pressure, tilt, bearing and rotation turn with it, so the strokes draw as before. SVG export wraps an object with a URL in `<a xlink:href>`, and SVG import reads `<a href>` links back.
`recentUrls` keeps the 30 newest distinct URLs given in the session, newest first. The panel's URL menu lists the
first 10 of them by default; the panel menu's Panel Options… opens the `attributesPanelOptions` dialog (field `count`),
and `ui.attributesPanelOptions {count}` sets the number without it, a whole number from 1 to 30 → `{count}`. A lower
count hides the older URLs without removing them from `recentUrls`. The count is kept with the UI state; a count out of
range is an error and changes nothing. The help page
[Create image maps for web graphics](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/create-image-maps-for-web-graphics.html)
describes the same 1 to 30 range; the default of 10 is VectorCraft's own value.
```json
{"name":"run_command","arguments":{"command":"attributes.set","params":{"ids":[12],"url":"https://example.com","imageMap":"rectangle"}}}
{"name":"run_command","arguments":{"command":"path.setFillRule","params":{"rule":"evenOdd"}}}
{"name":"invoke_menu","arguments":{"command":"ui.attributesPanelOptions","params":{"count":20}}}
```
## SVG interactivity
+1
View File
@@ -1332,6 +1332,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Artboard click-to-fit (#1227):** a plain click fits the topmost editable object or group to a new artboard, including its stroke like Fit to Selected Art, and makes the new artboard active. Art and its selection stay unchanged; creation is one undo step. Handles, modified clicks, drags, Escape and tool changes retain their meaning. Tested inside an artboard and on the pasteboard (`crates/engine/tests/it/artboard_click.rs`); the public [CS6 Printing Guide](https://helpx.adobe.com/content/dam/help/en/indesign/pdf/CS6_PrintGuide.pdf) documents the object-click gesture. This legacy gesture adds evidence without regrading the 2026 canvas controls.
- **Rotated views:** with the view rotated, Fit Artboard in Window, Fit All in Window and the status bar's artboard navigator fit the artboard or the art as the view turns it, and a Zoom tool marquee (Animated Zoom or GPU Performance off) zooms to the area dragged across. Ruler guides on no artboard turn with the view. The canvas draws the selection marquee where the tools select, Show Hidden Characters draws the marks of type partly inside the canvas, the Contextual Task Bar stays under the selection, and the Navigator's red box outlines what the window shows.
- **Navigator panel options:** the Navigator panel menu's Panel Options… sets the color the view box is drawn in, from a preset list (VectorCraft's own: Light Red, the default, then the layer colors) or a custom color, and Draw Dashed Lines as Solid Lines, off by default, which draws dashed strokes without their dashes in the panel's thumbnail only (`ui.navigatorPanelOptions`; kept with the UI state; behavior reference: [View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)).
- **Attributes panel options:** the Attributes panel menu's Panel Options… sets how many recent URLs the URL menu lists, a whole number from 1 to 30 (10 by default, VectorCraft's own value); the panel keeps the 30 newest URLs of the session, so a lower count hides older URLs without removing them (`ui.attributesPanelOptions`; kept with the UI state; behavior reference: [Create image maps for web graphics](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/create-image-maps-for-web-graphics.html); test `panel_options_set_how_many_recent_urls_the_menu_lists`).
- **Views:** the status bar's artboard navigator (first, previous, next, last; `view.goToArtboard`) goes to an artboard, fits it and synchronizes the Artboard tool selection when that tool is active; ordinary object selection is preserved. Its four buttons are also commands of their own (`view.firstArtboard`, `view.previousArtboard`, `view.nextArtboard`, `view.lastArtboard`), listed in Edit › Keyboard Shortcuts without a default key, so a user can give them keys such as Page Up and Page Down (#5218). Actual Next-button regressions cover keyboard/Properties deletion and Undo in `chrome.rs`. Fit Artboard in Window and Actual Size show the navigator's artboard. The Artboards panel highlights that active artboard: clicking a row makes it active (the Artboard tool's too, while it is chosen) as does clicking an artboard with the Artboard tool, double-clicking its number also fits it in the window and double-clicking its name renames it. Duplicate Artboards, or a row dragged onto New Artboard, copies the artboard with its art (#446). Escape leaves Presentation Mode, `view.screenMode` from it goes back to Normal Screen Mode, and the screen mode isn't saved with the preferences: the app always starts in Normal Screen Mode with its menus and panels (#472). View › Pixel Preview shows the art as the document pixels it rasterizes to, one per point and hard-edged when magnified, turning with a rotated view (it used to draw the smooth vectors, with only the pixel grid over them). In Outline view a template layer keeps drawing in Preview, dimmed, so a picture placed to be traced stays visible under the outlines (#1505, fixes #1486). Outline view draws on a white canvas in every interface brightness and Canvas Color, pasteboard included, with the artboards as their edges and no paper (VectorCraft's own rule), so the black outlines of art on the pasteboard show.
In Presentation Mode, → and ← go to the next and the previous artboard, and a click anywhere goes to the next one, as the status bar navigator's Next and Previous do (`view.goToArtboard`): on the last artboard → and a click leave the view as it is, and so does ← on the first. The arrow keys do not move the selection there, and the tool does not receive a click, so a click selects and draws nothing (behavior reference: [View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)).
Full Screen Mode and Presentation Mode put the window full screen, covering the taskbar and the window's frame, and Normal Screen Mode or Full Screen Mode with Menu Bar puts it back (#4365); a window the user made full screen stays so.