diff --git a/crates/engine/src/shell_commands.rs b/crates/engine/src/shell_commands.rs index 2bd765673f..79983cb188 100644 --- a/crates/engine/src/shell_commands.rs +++ b/crates/engine/src/shell_commands.rs @@ -7,6 +7,7 @@ /// Shell commands: id, label, menu path, default shortcut. pub const SHELL_COMMANDS: &[(&str, &str, &[&str], Option<&str>)] = &[ + ("layer.selectUnderCursor", "Select Layer Under Cursor", &[], None), ("ui.symmetryTransform", "Transform Symmetry", &[], None), // Right-click the options bar's tool icon (#2825); `tool.resetAll` asks first. ("tool.reset", "Reset Tool", &[], None), diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 7d3e03bae4..22dff389e7 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1015,7 +1015,11 @@ mod tests { let ctx = h.ctx.clone(); crate::menus::invoke(h.state_mut(), &ctx, "file.fileInfo", json!({})).unwrap(); h.run_steps(4); - for (label, key) in [("Description", "description"), ("Keywords", "keywords"), ("Copyright", "copyright")] { + let labels = ["Document Title", "Author", "Author title", "Description", "Keywords", "Copyright status", "Copyright Notice", "Copyright Info URL"]; + for pair in labels.windows(2) { + assert!(h.get_by_label(pair[0]).rect().center().y < h.get_by_label(pair[1]).rect().center().y, "field order: {pair:?}"); + } + for (label, key) in [("Description", "description"), ("Keywords", "keywords"), ("Copyright Notice", "copyright")] { h.get_by_label(label).click(); h.run_steps(1); h.event(egui::Event::Text("First".into())); diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index c73c032df7..494006aa5b 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3808,3 +3808,9 @@ navigator Zoom Zvětšení # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Volná transformace se stále použije; zkuste to znovu, až skončí. The transform couldn't be applied. Transformaci nelze použít. + +# File Info metadata labels + Document Title Název dokumentu + Copyright Notice Oznámení o autorských právech + Copyright Info URL URL informací o autorských právech + Select Layer Under Cursor Vybrat vrstvu pod kurzorem diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index bfa6d5f8f1..ceaaf47aa7 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3202,3 +3202,9 @@ curves Smooth Glätten # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Frei transformieren wird noch angewendet; versuchen Sie es erneut, wenn es fertig ist. The transform couldn't be applied. Die Transformation konnte nicht angewendet werden. + +# File Info metadata labels + Document Title Dokumenttitel + Copyright Notice Urheberrechtsvermerk + Copyright Info URL URL der Urheberrechtsinformationen + Select Layer Under Cursor Ebene unter dem Cursor auswählen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index eccfd0508c..03d4928812 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3900,3 +3900,8 @@ curves Smooth Εξομάλυνση # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Ο Ελεύθερος μετασχηματισμός εφαρμόζεται ακόμη· δοκιμάστε ξανά όταν ολοκληρωθεί. The transform couldn't be applied. Δεν ήταν δυνατή η εφαρμογή του μετασχηματισμού. + +# File Info metadata labels + Document Title Τίτλος εγγράφου + Copyright Notice Σημείωση πνευματικών δικαιωμάτων + Select Layer Under Cursor Επιλογή επιπέδου κάτω από τον δρομέα diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index da9337eaea..3b2b127c77 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4162,3 +4162,8 @@ navigator Zoom Zoom # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Transformación libre aún se está aplicando; inténtelo de nuevo cuando termine. The transform couldn't be applied. No se pudo aplicar la transformación. + +# File Info metadata labels + Document Title Título del documento + Copyright Notice Aviso de copyright + Select Layer Under Cursor Seleccionar capa bajo el cursor diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 8b25af722e..f4b524399f 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3205,3 +3205,8 @@ curves Smooth Lisser # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. La transformation manuelle est encore en cours d'application ; réessayez quand elle sera terminée. The transform couldn't be applied. Impossible d'appliquer la transformation. + +# File Info metadata labels + Document Title Titre du document + Copyright Notice Mention de copyright + Select Layer Under Cursor Sélectionner le calque sous le curseur diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 2870dc6f99..7faea3e02f 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4119,3 +4119,8 @@ cameraRaw Yellow Sárga # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. A szabad alakítás alkalmazása még folyamatban van; próbáld újra, ha befejeződött. The transform couldn't be applied. Az átalakítás nem alkalmazható. + +# File Info metadata labels + Document Title Dokumentum címe + Copyright Notice Szerzői jogi közlemény + Select Layer Under Cursor Kurzor alatti réteg kijelölése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index feca83a9c7..e78ad28bb3 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3192,3 +3192,8 @@ curves Smooth Haluskan # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Transformasi Bebas masih diterapkan; coba lagi setelah selesai. The transform couldn't be applied. Transformasi tidak dapat diterapkan. + +# File Info metadata labels + Document Title Judul Dokumen + Copyright Notice Pemberitahuan Hak Cipta + Select Layer Under Cursor Pilih Lapisan di Bawah Kursor diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index a8796e64e7..80d78e5d7d 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4321,3 +4321,8 @@ shape Appearance Aspetto # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Trasformazione libera è ancora in corso di applicazione; riprova quando è terminata. The transform couldn't be applied. Impossibile applicare la trasformazione. + +# File Info metadata labels + Document Title Titolo del documento + Copyright Notice Avviso di copyright + Select Layer Under Cursor Seleziona livello sotto il cursore diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 13efa7517d..1fb4b67d66 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3876,3 +3876,8 @@ curves Smooth スムーズ # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. 自由変形を適用中です。完了してからもう一度お試しください。 The transform couldn't be applied. 変形を適用できませんでした。 + +# File Info metadata labels + Document Title ドキュメントのタイトル + Copyright Notice 著作権表示 + Select Layer Under Cursor カーソル下のレイヤーを選択 diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 5354b04a31..e84e5c2bc5 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3378,3 +3378,9 @@ curves Smooth 매끄럽게 # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. 자유 변형을 아직 적용하는 중입니다. 완료된 후 다시 시도하세요. The transform couldn't be applied. 변형을 적용할 수 없습니다. + +# File Info metadata labels + Document Title 문서 제목 + Copyright Notice 저작권 고지 + Copyright Info URL 저작권 정보 URL + Select Layer Under Cursor 커서 아래 레이어 선택 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 5a013c7862..d28d1de091 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -3960,3 +3960,8 @@ curves Smooth Vloeiend maken # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Vrije transformatie wordt nog toegepast; probeer het opnieuw als die klaar is. The transform couldn't be applied. De transformatie kon niet worden toegepast. + +# File Info metadata labels + Document Title Documenttitel + Copyright Notice Copyrightvermelding + Select Layer Under Cursor Laag onder cursor selecteren diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 8707b5fb2e..7d9a80e1ef 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3798,3 +3798,8 @@ curves Smooth Wygładź # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Przekształcanie swobodne jest nadal stosowane; spróbuj ponownie, gdy się zakończy. The transform couldn't be applied. Nie można zastosować przekształcenia. + +# File Info metadata labels + Document Title Tytuł dokumentu + Copyright Notice Informacja o prawach autorskich + Select Layer Under Cursor Zaznacz warstwę pod kursorem diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index ef10787ceb..8cfb7c9214 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -3990,3 +3990,8 @@ layerLabel No Color Sem cor # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. A Transformação livre ainda está sendo aplicada; tente novamente quando terminar. The transform couldn't be applied. Não foi possível aplicar a transformação. + +# File Info metadata labels + Document Title Título do documento + Copyright Notice Aviso de direitos autorais + Select Layer Under Cursor Selecionar camada sob o cursor diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 449f741e21..ca73928e95 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3170,3 +3170,8 @@ curves Smooth Сгладить # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Свободное трансформирование ещё применяется; повторите попытку, когда оно завершится. The transform couldn't be applied. Не удалось применить трансформирование. + +# File Info metadata labels + Document Title Название документа + Copyright Notice Уведомление об авторских правах + Select Layer Under Cursor Выбрать слой под курсором diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index 4dedfaf7a1..cbddbaf76b 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -4273,3 +4273,8 @@ shape Appearance Izgled # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Slobodna transformacija se još primenjuje; pokušajte ponovo kad se završi. The transform couldn't be applied. Transformacija nije mogla da se primeni. + +# File Info metadata labels + Document Title Naslov dokumenta + Copyright Notice Obaveštenje o autorskim pravima + Select Layer Under Cursor Izaberi sloj ispod kursora diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f7dc6961fa..f6cf54bdd7 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3930,3 +3930,8 @@ cameraData Lens Lens # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Serbest Dönüştürme hâlâ uygulanıyor; bittiğinde yeniden deneyin. The transform couldn't be applied. Dönüştürme uygulanamadı. + +# File Info metadata labels + Document Title Belge Başlığı + Copyright Notice Telif Hakkı Bildirimi + Select Layer Under Cursor İmlecin Altındaki Katmanı Seç diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 9a018c744a..f1c449e041 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3899,3 +3899,8 @@ curves Smooth Згладити # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Вільне трансформування ще застосовується; спробуйте знову, коли воно завершиться. The transform couldn't be applied. Не вдалося застосувати трансформування. + +# File Info metadata labels + Document Title Назва документа + Copyright Notice Повідомлення про авторські права + Select Layer Under Cursor Вибрати шар під курсором diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index b798849d72..576b2f164c 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3686,3 +3686,9 @@ curves Smooth Làm mượt # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. Biến đổi tự do vẫn đang được áp dụng; hãy thử lại khi hoàn tất. The transform couldn't be applied. Không thể áp dụng phép biến đổi. + +# File Info metadata labels + Document Title Tiêu đề tài liệu + Copyright Notice Thông báo bản quyền + Copyright Info URL URL thông tin bản quyền + Select Layer Under Cursor Chọn lớp dưới con trỏ diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 766497d67b..1c3ee0998c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2816,3 +2816,9 @@ curves Smooth 平滑 # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. 自由变换仍在应用中;请在完成后重试。 The transform couldn't be applied. 无法应用变换。 + +# File Info metadata labels + Document Title 文档标题 + Copyright Notice 版权声明 + Copyright Info URL 版权信息网址 + Select Layer Under Cursor 选择光标下的图层 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 3627c785e8..b8eaf225d6 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2801,3 +2801,9 @@ curves Smooth 平滑 # Free Transform: a new layer while the box is open (#5859) Free Transform is still being applied; try again when it has finished. 任意變形仍在套用中;請在完成後再試一次。 The transform couldn't be applied. 無法套用變形。 + +# File Info metadata labels + Document Title 文件標題 + Copyright Notice 著作權聲明 + Copyright Info URL 著作權資訊網址 + Select Layer Under Cursor 選取游標下的圖層 diff --git a/crates/ui-egui/src/input_tests.rs b/crates/ui-egui/src/input_tests.rs index c489822f2e..598990c551 100644 --- a/crates/ui-egui/src/input_tests.rs +++ b/crates/ui-egui/src/input_tests.rs @@ -1116,3 +1116,51 @@ fn move_tool_controls_rotate_from_just_outside_the_box() { let tilt = (end[1][1] - end[0][1]).atan2(end[1][0] - end[0][0]).to_degrees(); assert!((tilt - 90.0).abs() < 8.0 || (tilt + 270.0).abs() < 8.0, "rotated about a quarter turn, got {tilt}° (zoom {zoom})"); } + +#[test] +fn assignable_pick_layer_shortcut_follows_transformed_canvas_without_editing() { + let mut h = harness(); + let base = h.state().session.active().unwrap().active_layer.unwrap(); + h.state_mut().run("layer.new.layer", json!({"name": "Paint"})).unwrap(); + let paint = h.state().session.active().unwrap().active_layer.unwrap(); + h.state_mut().run("select.rect", json!({"x": 100, "y": 100, "width": 40, "height": 40})).unwrap(); + h.state_mut().run("edit.fill", json!({"color": "#ff0000"})).unwrap(); + h.state_mut().run("select.deselect", json!({})).unwrap(); + h.state_mut().run("layer.new.layer", json!({"name": "Empty"})).unwrap(); + h.state_mut().run("prefs.set", json!({"path": "shortcuts.layer.selectUnderCursor", "value": "Cmd+Alt+K"})).unwrap(); + h.state_mut().ui.tool = crate::state::Tool::Brush; + for (zoom, rotation, flip) in [(1.0, 0.0, false), (2.0, 37.0, true), (0.5, -90.0, false)] { + h.state_mut().ui.views[0].zoom = zoom; + h.state_mut().ui.views[0].rotation = rotation; + h.state_mut().ui.views[0].center = [180.0, 145.0]; + h.state_mut().ui.view.flip_horizontal = flip; + h.run_steps(2); + for (point, expected) in [([120.0, 120.0], paint), ([155.0, 155.0], base)] { + let pos = crate::canvas::ViewXform::active(h.state()).unwrap().to_screen(point[0], point[1]); + let history = h.state().session.active().unwrap().history.past_len(); + h.hover_at(pos); + h.key_press_modifiers(Modifiers::COMMAND | Modifiers::ALT, Key::K); + h.run_steps(2); + assert_eq!(h.state().session.active().unwrap().active_layer, Some(expected)); + assert_eq!(h.state().session.active().unwrap().history.past_len(), history, "picking never adds a document edit"); + assert!(!h.state().session.journal.iter().any(|(id, _)| id == "paint.stroke")); + } + } + h.state_mut().run("layer.setProps", json!({"layer": paint.0, "visible": false})).unwrap(); + let p = crate::canvas::ViewXform::active(h.state()).unwrap().to_screen(120.0, 120.0); + h.hover_at(p); + h.key_press_modifiers(Modifiers::COMMAND | Modifiers::ALT, Key::K); + h.run_steps(2); + assert_eq!(h.state().session.active().unwrap().active_layer, Some(base)); + // Outside the document and modal dialogs preserve the current selection. + h.state_mut().run("layer.select", json!({"layer": paint.0})).unwrap(); + h.hover_at(pos2(0.0, 0.0)); + h.key_press_modifiers(Modifiers::COMMAND | Modifiers::ALT, Key::K); + h.run_steps(2); + assert_eq!(h.state().session.active().unwrap().active_layer, Some(paint)); + open_dialog(&mut h); + h.hover_at(p); + h.key_press_modifiers(Modifiers::COMMAND | Modifiers::ALT, Key::K); + h.run_steps(2); + assert_eq!(h.state().session.active().unwrap().active_layer, Some(paint)); +} diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 2839e51f13..3b3a446063 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -253,6 +253,7 @@ pub(crate) fn invoke_unguarded(app: &mut PhotocraftApp, ctx: &egui::Context, id: ctx.send_viewport_cmd(egui::ViewportCommand::Close); Ok(Value::Null) } + "layer.selectUnderCursor" => select_layer_under_cursor(app, ctx), "file.clearRecent" => { app.clear_recent(); Ok(Value::Null) @@ -640,6 +641,9 @@ fn open_path(app: &mut PhotocraftApp, path: &str) -> Result { } pub fn is_enabled(app: &PhotocraftApp, id: &str) -> bool { + if id == "layer.selectUnderCursor" { + return app.session.active().is_some() && app.drag.is_none() && app.brush_resize.is_none(); + } if crate::tool_shortcuts::tool(id).is_some() { return true; } @@ -2235,3 +2239,25 @@ mod window_documents_tests { assert_eq!(app.session.active_index(), Some(0)); } } + +/// Pointer-dependent shell command; pixel picking and selection remain engine commands. +fn select_layer_under_cursor(app: &mut PhotocraftApp, ctx: &egui::Context) -> Result { + if app.drag.is_some() || app.brush_resize.is_some() { + return Ok(json!({"layer": null})); + } + let Some(xf) = crate::canvas::ViewXform::active(app) else { return Ok(json!({"layer": null})) }; + let Some(pointer) = ctx.pointer_hover_pos().filter(|p| xf.rect.contains(*p)) else { return Ok(json!({"layer": null})) }; + let [x, y] = xf.to_doc(pointer); + let inside = app + .session + .active() + .is_some_and(|st| x.is_finite() && y.is_finite() && x >= 0.0 && y >= 0.0 && x < f64::from(st.doc.size.width) && y < f64::from(st.doc.size.height)); + if !inside { + return Ok(json!({"layer": null})); + } + let picked = app.run("layer.pickAt", json!({"x": x, "y": y, "target": "layer", "select": false}))?; + if let Some(layer) = picked.get("layer").and_then(Value::as_u64) { + app.run("layer.select", json!({"layer": layer, "mode": "replace"}))?; + } + Ok(picked) +} diff --git a/crates/ui-egui/src/view_cmds.rs b/crates/ui-egui/src/view_cmds.rs index 750a08de6c..aa92b97bfb 100644 --- a/crates/ui-egui/src/view_cmds.rs +++ b/crates/ui-egui/src/view_cmds.rs @@ -1065,8 +1065,23 @@ pub fn form_body(ui: &mut egui::Ui, f: &mut Map) { // Data-driven labels (a per-part checkbox shows the part's name, not a catalogue entry) // come from `__labels` verbatim; everything else goes through the catalogue. let labels = f.get("__labels").cloned().unwrap_or(Value::Null); - let label = |k: &str| labels.get(k).and_then(Value::as_str).map_or_else(|| label_of(k), str::to_string); - let keys: Vec = f.keys().filter(|k| !k.starts_with("__")).cloned().collect(); + let file_info = f.get("__command").and_then(Value::as_str) == Some("file.fileInfo"); + let label = |k: &str| { + if file_info { + match k { + "title" => return tl!("Document Title").to_owned(), + "copyright" => return tl!("Copyright Notice").to_owned(), + "copyrightUrl" => return tl!("Copyright Info URL").to_owned(), + _ => {} + } + } + labels.get(k).and_then(Value::as_str).map_or_else(|| label_of(k), str::to_string) + }; + let mut keys: Vec = f.keys().filter(|k| !k.starts_with("__")).cloned().collect(); + if file_info { + const ORDER: &[&str] = &["title", "author", "authorTitle", "description", "keywords", "copyrightStatus", "copyright", "copyrightUrl"]; + keys.sort_by_key(|k| ORDER.iter().position(|field| *field == k).unwrap_or(ORDER.len())); + } egui::Grid::new("form-dialog").num_columns(2).spacing([12.0, 6.0]).show(ui, |ui| { for k in keys { let v = f.get(&k).cloned().unwrap_or(Value::Null); @@ -1124,7 +1139,10 @@ pub fn form_body(ui: &mut egui::Ui, f: &mut Map) { } }); } else { - ui.add(egui::TextEdit::singleline(&mut s).desired_width(260.0)); + let response = ui.add(egui::TextEdit::singleline(&mut s).desired_width(260.0)); + if file_info { + response.labelled_by(field_label.id); + } } } } diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 14d416f19b..a3ff1ee904 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -652,3 +652,7 @@ dock target. The panel menu and icon rail remain available in custom workspaces. `window.panel. {show:true}` always reveals, selects and expands the panel, including when another tab is selected. Workspace snapshots retain custom collapse settings and Timeline visibility. + +### Select the layer under the pointer + +Assign **Select Layer Under Cursor** in Keyboard Shortcuts to choose the topmost visible, pickable layer beneath the canvas pointer. Empty pixels and points outside the document leave the selection unchanged; dialogs, strokes and brush-resize gestures block it. The command follows zoom, pan, view rotation and horizontal flipping. Agents can invoke `ui.menu.invoke {"id":"layer.selectUnderCursor"}` after moving the screen pointer with `ui.move {"x": ..., "y": ...}`. The command has no default shortcut.