diff --git a/crates/engine/src/cmd/pathops.rs b/crates/engine/src/cmd/pathops.rs index 46bf4a37..fe33554f 100644 --- a/crates/engine/src/cmd/pathops.rs +++ b/crates/engine/src/cmd/pathops.rs @@ -503,6 +503,7 @@ fn offset_path(s: &mut Session, p: &Value) -> Result { let roots = selected_roots(s)?; let ids = s.edit("Offset Path", |d, sel| { let (mut out, mut above) = (vec![], vec![]); + let mut paths = false; for id in &roots { let Some(n) = d.node(*id).cloned() else { continue }; let mut lv = vec![]; @@ -510,6 +511,7 @@ fn offset_path(s: &mut Session, p: &Value) -> Result { let mut made = vec![]; for l in lv.iter().filter(|l| !matches!(l.kind, NodeKind::Text(_))) { let Some((path, rule)) = node_path(l) else { continue }; + paths = true; let base = if matches!(l.kind, NodeKind::Compound { .. }) && path.is_closed() { po::normalize(&path, rule) } else { path }; let off = po::offset_path(&base, delta, join, miter); if off.is_empty() { @@ -532,6 +534,9 @@ fn offset_path(s: &mut Session, p: &Value) -> Result { out.push(new.id); above.push((*id, vec![new])); } + if out.is_empty() && paths { + return Err(EngineError::Other("Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes)".into())); + } if out.is_empty() { return Err(EngineError::Other("Offset Path: select paths".into())); } diff --git a/crates/engine/src/tests_pathops.rs b/crates/engine/src/tests_pathops.rs index 4f0ab4c3..9220223d 100644 --- a/crates/engine/src/tests_pathops.rs +++ b/crates/engine/src/tests_pathops.rs @@ -919,3 +919,14 @@ fn trim_merge_and_crop_remove_strokes() { } } } + +/// #1590: an inset larger than the shape leaves nothing, and the error says so rather than asking +/// for paths that are selected. +#[test] +fn offset_path_that_leaves_nothing_says_so() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + let e = s.execute("object.path.offsetPath", &json!({"offset": -20})).unwrap_err().to_string(); + assert!(e.contains("leaves nothing") && !e.contains("select paths"), "{e}"); +} diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 38fb02b0..e258b116 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3739,6 +3739,7 @@ imageTrace Outline Obrys @msg No saved selections (Select → Save Selection…) Žádné uložené výběry (Výběr → Uložit výběr…) @msg No saved views (View → New View…) Žádná uložená zobrazení (Zobrazení → Nové zobrazení…) @msg Offset Path: select paths Odsadit cestu: vyberte cesty +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Odsadit cestu: po odsazení z vybraných cest nic nezbude (odsazení dovnitř větší než tvary) @msg Opened with {_1} note(s): {_2} Otevřeno, poznámky ({_1}): {_2} @msg Opened {url} Otevřeno {url} @msg Outline Stroke: no stroked paths selected Převést tah na obrys: nejsou vybrány žádné cesty s tahem diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 88802b6c..582042a8 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3340,6 +3340,7 @@ theme Appearance Erscheinungsbild @msg No saved selections (Select → Save Selection…) Keine gespeicherten Auswahlen (Auswahl → Auswahl speichern…) @msg No saved views (View → New View…) Keine gespeicherten Ansichten (Ansicht → Neue Ansicht…) @msg Offset Path: select paths Pfad verschieben: Wählen Sie Pfade aus +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Pfad verschieben: Der Versatz lässt von den ausgewählten Pfaden nichts übrig (ein Versatz nach innen, der größer ist als die Formen) @msg Opened with {_1} note(s): {_2} Mit {_1} Hinweis(en) geöffnet: {_2} @msg Opened {url} {url} geöffnet @msg Outline Stroke: no stroked paths selected Konturlinie: keine Pfade mit Kontur ausgewählt diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index f17b182b..1f2df341 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3440,6 +3440,7 @@ axis Both Ambos @msg No saved selections (Select → Save Selection…) No hay selecciones guardadas (Selección → Guardar selección…) @msg No saved views (View → New View…) No hay vistas guardadas (Ver → Nueva vista…) @msg Offset Path: select paths Desplazar trazado: selecciona trazados +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Desplazar trazado: el desplazamiento no deja nada de los trazados seleccionados (un desplazamiento hacia dentro mayor que las formas) @msg Opened with {_1} note(s): {_2} Se abrió con {_1} nota(s): {_2} @msg Opened {url} Se abrió {url} @msg Outline Stroke: no stroked paths selected Contornear trazo: no hay trazados con trazo seleccionados diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index a0f8de67..918ba23a 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3437,6 +3437,7 @@ axis Both Les deux @msg No saved selections (Select → Save Selection…) Aucune sélection enregistrée (Sélection → Enregistrer la sélection…) @msg No saved views (View → New View…) Aucune vue enregistrée (Affichage → Nouvelle vue…) @msg Offset Path: select paths Décalage : sélectionnez des tracés +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Décalage : le décalage ne laisse rien des tracés sélectionnés (un décalage vers l’intérieur plus grand que les formes) @msg Opened with {_1} note(s): {_2} Ouvert avec {_1} remarque(s) : {_2} @msg Opened {url} {url} ouvert @msg Outline Stroke: no stroked paths selected Vectoriser le contour : aucun tracé avec contour sélectionné diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0587a798..efa4718a 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4338,6 +4338,7 @@ imageTrace Outline Körvonal @msg object {id} is not a selected top-level object az objektum nem kijelölt legfelső szintű objektum: {id} @msg objects with several fills or strokes, effects or brushes came in as their drawn look ({_1}): their appearance isn't editable yet a több kitöltésű vagy körvonalú, effektusos vagy ecsetes objektumok a megrajzolt kinézetükkel kerültek be ({_1}): a megjelenésük még nem szerkeszthető @msg Offset Path: select paths Útvonal eltolása: jelölj ki útvonalakat +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Útvonal eltolása: az eltolás után semmi sem marad a kijelölt útvonalakból (a befelé eltolás nagyobb az alakzatoknál) @msg onto must name a floating panel az onto egy lebegő panelt kell megnevezzen @msg onto must name a panel floating in another group az onto egy másik csoportban lebegő panelt kell megnevezzen @msg Opened with {_1} note(s): {_2} Megnyitva; megjegyzések: {_1}: {_2} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 073ebe69..0b171d48 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3440,6 +3440,7 @@ axis Both Entrambi @msg No saved selections (Select → Save Selection…) Nessuna selezione salvata (Selezione → Salva selezione…) @msg No saved views (View → New View…) Nessuna vista salvata (Visualizza → Nuova vista…) @msg Offset Path: select paths Sposta tracciato: seleziona tracciati +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Sposta tracciato: lo spostamento non lascia nulla dei tracciati selezionati (uno spostamento verso l’interno maggiore delle forme) @msg Opened with {_1} note(s): {_2} Aperto con {_1} nota/e: {_2} @msg Opened {url} Aperto {url} @msg Outline Stroke: no stroked paths selected Contorna traccia: nessun tracciato con traccia selezionato diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 6b630b8c..4affc1e8 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3597,6 +3597,7 @@ theme Appearance 外観 @msg Divide Objects Below: select a path 背面のオブジェクトで型抜き: パスを選択してください @msg Divide Objects Below: select exactly one path 背面のオブジェクトで型抜き: パスを 1 つだけ選択してください @msg Offset Path: select paths パスのオフセット: パスを選択してください +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) パスのオフセット: オフセットすると選択したパスが何も残りません (内側へのオフセットがシェイプより大きい) @msg Outline Stroke: no stroked paths selected パスのアウトライン: 線のあるパスが選択されていません @msg Split Into Grid: select paths large enough for the grid グリッドに分割: グリッドが収まる大きさのパスを選択してください @msg empty cutter 型抜きに使うパスが空です diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index b63378f3..c6234fc4 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3575,6 +3575,7 @@ theme Appearance 외관 @msg Divide Objects Below: select a path 아래 개체 분할: 패스를 선택하세요 @msg Divide Objects Below: select exactly one path 아래 개체 분할: 패스를 하나만 선택하세요 @msg Offset Path: select paths 패스 오프셋: 패스를 선택하세요 +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) 패스 오프셋: 오프셋을 적용하면 선택한 패스가 남지 않습니다(안쪽 오프셋이 모양보다 큼) @msg Outline Stroke: no stroked paths selected 선 윤곽선화: 선이 있는 패스가 선택되지 않았습니다 @msg Split Into Grid: select paths large enough for the grid 격자로 분할: 격자에 충분한 크기의 패스를 선택하세요 @msg empty cutter 빈 커터입니다 diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index aead02fa..019bf50e 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3605,6 +3605,7 @@ imageTrace Outline Kontur @msg No saved selections (Select → Save Selection…) Brak zapisanych zaznaczeń (Zaznacz → Zapisz zaznaczenie…) @msg No saved views (View → New View…) Brak zapisanych widoków (Widok → Nowy widok…) @msg Offset Path: select paths Odsuń ścieżkę: zaznacz ścieżki +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Odsuń ścieżkę: po odsunięciu nic nie zostaje z zaznaczonych ścieżek (odsunięcie do wewnątrz większe niż kształty) @msg Opened with {_1} note(s): {_2} Otwarto, uwagi ({_1}): {_2} @msg Opened {url} Otwarto {url} @msg Outline Stroke: no stroked paths selected Obrys konturu: nie zaznaczono ścieżek z obrysem diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 1667c76d..a7898322 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -3094,6 +3094,7 @@ axis Both Ambos @msg No saved selections (Select → Save Selection…) Nenhuma seleção salva (Selecionar → Salvar seleção…) @msg No saved views (View → New View…) Nenhuma vista salva (Exibir → Nova vista…) @msg Offset Path: select paths Deslocar traçado: selecione traçados +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Deslocar traçado: o deslocamento não deixa nada dos traçados selecionados (um deslocamento para dentro maior que as formas) @msg Opened with {_1} note(s): {_2} Aberto com {_1} observação(ões): {_2} @msg Opened {url} {url} aberto @msg Outline Stroke: no stroked paths selected Contornar traço: nenhum traçado com traço selecionado diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 87438525..e39d6362 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3436,6 +3436,7 @@ axis Both Оба @msg No saved selections (Select → Save Selection…) Нет сохранённых выделений (Выделение → Сохранить выделение…) @msg No saved views (View → New View…) Нет сохранённых видов (Просмотр → Новый вид…) @msg Offset Path: select paths Смещение контура: выделите контуры +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Смещение контура: после смещения от выделенных контуров ничего не остаётся (смещение внутрь больше самих фигур) @msg Opened with {_1} note(s): {_2} Открыто с примечаниями ({_1}) : {_2} @msg Opened {url} Открыто {url} @msg Outline Stroke: no stroked paths selected Обводка контура: не выделены контуры с обводкой diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0c5ec5ed..5ee73c1f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3424,6 +3424,7 @@ axis Both Обидві @msg No saved selections (Select → Save Selection…) Немає збережених виділень (Виділення → Зберегти виділення…) @msg No saved views (View → New View…) Немає збережених видів (Перегляд → Новий вид…) @msg Offset Path: select paths Зміщення контуру: виділіть контури +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Зміщення контуру: після зміщення від виділених контурів нічого не лишається (зміщення всередину більше за самі фігури) @msg Opened with {_1} note(s): {_2} Відкрито із примітками ({_1}) : {_2} @msg Opened {url} Відкрито {url} @msg Outline Stroke: no stroked paths selected Обведення контуру: не виділено контури з обведенням diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index c44e6f66..62b1d8e5 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3967,6 +3967,7 @@ theme Appearance Giao diện @msg object {id} is not a selected top-level object đối tượng {id} không phải là đối tượng cấp cao nhất đã chọn @msg objects with several fills or strokes, effects or brushes came in as their drawn look ({_1}): their appearance isn't editable yet đối tượng có nhiều tô hoặc nét, hiệu ứng hoặc cọ đã vào dưới dạng bề ngoài ({_1}): diện mạo chưa thể chỉnh sửa @msg Offset Path: select paths Đường dẫn độ lệch: hãy chọn đường dẫn +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Đường dẫn độ lệch: độ lệch không để lại gì từ các đường dẫn đã chọn (độ lệch vào trong lớn hơn hình) @msg onto must name a floating panel onto phải đặt tên bảng đang thả nổi @msg onto must name a panel floating in another group onto phải đặt tên bảng đang thả nổi trong nhóm khác @msg Opened with {_1} note(s): {_2} Đã mở với {_1} ghi chú: {_2}