PhotoCraft: An open-source, photo editor written by scratch in pure Rust
UI.9: refresh shared panel integration against current main
skylar taylor-barrick77f50330c600
diff --cc crates/ui-egui/src/dock.rsindex 25cfa4ff2,667cb19ea..69056fbcc--- a/crates/ui-egui/src/dock.rs+++ b/crates/ui-egui/src/dock.rs@@@ -110,12 -111,13 +111,13 @@@ impl Group}}- /// Tabs that lay out their own scrolling list and footer (they fill the group).+ /// Tabs that lay out their own scrolling list and footer, or size themselves to the group+ /// (the Navigator's preview grows with it, as in Photoshop: #2726).pub fn scrolls_itself(self, tab: usize) -> bool {- matches!((self, tab), (Group::Layers, 0) | (Group::History, 0))+ matches!((self, tab), (Group::Layers, 0) | (Group::History, 0) | (Group::Navigator, 0))}- fn tab_mut(self, tabs: &mut DockTabs) -> &mut usize {+ pub(crate) fn tab_mut(self, tabs: &mut DockTabs) -> &mut usize {match self {Group::Color => &mut tabs.color,Group::Properties => &mut tabs.properties,@@@ -456,12 -517,20 +522,21 @@@ pub fn show(app: &mut PhotocraftApp, uiif resp.strip.double_clicked() || resp.tab_double_clicked || (collapsed && resp.tab_clicked) {actions.push(Action::ToggleCollapse(g));}- if !locked && resp.strip.dragged() {+ // The strip uses visible indices; reorder in original ones.+ if !locked+ && let Some((from, before)) = resp.tab_reorder+ && let Some(&tab) = indices.get(from)+ {+ actions.push(Action::MoveTab(g, tab, before.and_then(|b| indices.get(b).copied())));+ }+ // A tab dragged off its strip moves the whole group, as the strip itself does.- if !locked && (resp.strip.dragged() || resp.tab_dragging_out) {++ if !locked && app.ui.docking.is_none() && (resp.strip.dragged() || resp.tab_dragging_out) {dragging = Some(g);}if !locked- && resp.strip.drag_stopped()- && let Some(p) = ui.ctx().pointer_interact_pos()++ && app.ui.docking.is_none()+ && (resp.strip.drag_stopped() || resp.tab_dropped_out)+ && let Some(p) = ui.ctx().pointer_interact_pos().or_else(|| ui.ctx().pointer_latest_pos()){actions.push(Action::Move(g, drop_before(&order, &rects, g, p.y)));}@@@ -639,12 -729,10 +738,15 @@@ pub fn restore(app: &mut PhotocraftApp/// (a workspace or `panelLayout`). Missing or invalid dock parts are left alone; old/// layouts without Timeline visibility restore it closed.pub fn apply(app: &mut PhotocraftApp, v: &Value) {+ app.ui.docking_collapsed = v.get("dockingCollapsed").and_then(|v| serde_json::from_value(v.clone()).ok()).unwrap_or_default();+ app.ui.docking_reveal = None;+ app.ui.docking_generation = app.ui.docking_generation.wrapping_add(1);+ app.ui.docking_hidden = v.get("dockingHidden").and_then(|v| serde_json::from_value(v.clone()).ok()).unwrap_or_default();+ app.ui.docking = v.get("docking").and_then(|d| serde_json::from_value(d.clone()).ok()).filter(crate::panel_docking::valid);- if let Some(p) = v.get("panels").and_then(|p| serde_json::from_value(p.clone()).ok()) {+ if let Some(mut p) = v.get("panels").and_then(|p| serde_json::from_value::<Panels>(p.clone()).ok()) {+ // The embedding host owns these flags, including for layouts that serialize them.+ p.menu_bar = app.ui.panels.menu_bar;+ p.rail = app.ui.panels.rail;app.ui.panels = p;}if let Some(t) = v.get("dockTabs").and_then(|t| serde_json::from_value(t.clone()).ok()) {diff --cc crates/ui-egui/src/i18n/cs.tsvindex d8fb21025,23339c72f..a506161e6--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@@ -2406,15 -2433,11 +2433,23 @@@ fontWeight Italic KurzívQuick Selection found nothing there Rychlý výběr zde nic nenašelObject Selection found nothing there — try a tighter rectangle Výběr objektu zde nic nenašel — zkuste těsnější obdélníkNo subject found — try a rectangle around the object Nebyl nalezen žádný objekt — zkuste obdélník kolem objektu+# Shared panel docking+ Activate Panel Aktivovat panel+ Change Panel Group Změnit skupinu panelů+ Change Panel Layout Změnit rozložení panelů+ Close Panel Zavřít panel+ Dock Panel Ukotvit panel+ Float Panel Plovoucí panel+ Move Panel Přesunout panel+ Group with Seskupit s+ Panel menu Nabídka panelu+ Resize panel window Změnit velikost okna panelu+ Resize panels Změnit velikost panelů+ Use Classic Mode Použít klasický režim+ Auto Center Preview Automaticky vystředit náhled+ Next Document Další dokument+ Previous Document Předchozí dokument+ W x H x Resolution Š x V x Rozlišení+ Front Image Přední obraz+ Search settings… Hledat nastavení…+ No matching settings Žádná odpovídající nastavenídiff --cc crates/ui-egui/src/i18n/de.tsvindex fe3163101,fa9bd5bf0..dba14c693--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@@ -2445,15 -2471,11 +2471,23 @@@ fontWeight Italic KursiQuick Selection found nothing there Die Schnellauswahl hat dort nichts gefundenObject Selection found nothing there — try a tighter rectangle Die Objektauswahl hat dort nichts gefunden — versuchen Sie ein engeres RechteckNo subject found — try a rectangle around the object Kein Motiv gefunden — versuchen Sie ein Rechteck um das Objekt+# Shared panel docking+ Activate Panel Bedienfeld aktivieren+ Change Panel Group Bedienfeldgruppe ändern+ Change Panel Layout Bedienfeldlayout ändern+ Close Panel Bedienfeld schließen+ Dock Panel Bedienfeld andocken+ Float Panel Schwebendes Bedienfeld+ Move Panel Bedienfeld verschieben+ Group with Gruppieren mit+ Panel menu Bedienfeldmenü+ Resize panel window Bedienfeldfenstergröße ändern+ Resize panels Bedienfeldgröße ändern+ Use Classic Mode Classic-Modus verwenden+ Auto Center Preview Automatische zentrierte Vorschau+ Next Document Nächstes Dokument+ Previous Document Vorheriges Dokument+ W x H x Resolution B x H x Auflösung+ Front Image Vorderes Bild+ Search settings… Einstellungen durchsuchen…+ No matching settings Keine passenden Einstellungendiff --cc crates/ui-egui/src/i18n/el.tsvindex b3d785613,4c7931714..bc85440b1--- a/crates/ui-egui/src/i18n/el.tsv+++ b/crates/ui-egui/src/i18n/el.tsv@@@ -3514,15 -3540,11 +3540,23 @@@ fontWeight Thin Πολύ λεπτ�Quick Selection found nothing there Η Γρήγορη επιλογή δεν βρήκε τίποτα εκείObject Selection found nothing there — try a tighter rectangle Η Επιλογή αντικειμένου δεν βρήκε τίποτα εκεί — δοκιμάστε ένα πιο στενό ορθογώνιοNo subject found — try a rectangle around the object Δεν βρέθηκε θέμα — δοκιμάστε ένα ορθογώνιο γύρω από το αντικείμενο+# Shared panel docking+ Activate Panel Ενεργοποίηση πάνελ+ Change Panel Group Αλλαγή ομάδας πάνελ+ Change Panel Layout Αλλαγή διάταξης πάνελ+ Close Panel Κλείσιμο πάνελ+ Dock Panel Αγκύρωση πάνελ+ Float Panel Αιωρούμενο πάνελ+ Move Panel Μετακίνηση πάνελ+ Group with Ομαδοποίηση με+ Panel menu Μενού πάνελ+ Resize panel window Αλλαγή μεγέθους παραθύρου πάνελ+ Resize panels Αλλαγή μεγέθους πάνελ+ Use Classic Mode Χρήση κλασικής λειτουργίας+ Auto Center Preview Αυτόματο κεντράρισμα προεπισκόπησης+ Next Document Επόμενο έγγραφο+ Previous Document Προηγούμενο έγγραφο+ W x H x Resolution Π x Υ x Ανάλυση+ Front Image Μπροστινή εικόνα+ Search settings… Αναζήτηση ρυθμίσεων…+ No matching settings Δεν βρέθηκαν ρυθμίσειςdiff --cc crates/ui-egui/src/i18n/es.tsvindex 1dac1a7eb,a8be679f2..a9281a120--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@@ -2474,15 -2500,23 +2500,35 @@@ fontWeight Italic CursivQuick Selection found nothing there Selección rápida no encontró nada ahíObject Selection found nothing there — try a tighter rectangle Selección de objeto no encontró nada ahí — pruebe un rectángulo más ajustadoNo subject found — try a rectangle around the object No se encontró ningún sujeto — pruebe un rectángulo alrededor del objeto+# Shared panel docking+ Activate Panel Activar panel+ Change Panel Group Cambiar grupo de paneles+ Change Panel Layout Cambiar disposición de paneles+ Close Panel Cerrar panel+ Dock Panel Acoplar panel+ Float Panel Panel flotante+ Move Panel Mover panel+ Group with Agrupar con+ Panel menu Menú del panel+ Resize panel window Cambiar tamaño de la ventana del panel+ Resize panels Cambiar tamaño de los paneles++ # Add Noise, Reduce Noise and Smart Sharpen dialog controls (Filter > Noise, Filter > Sharpen).+ Distribution Distribución+ Uniform Uniforme+ Gaussian Gaussiana+ Monochromatic Monocromático+ Seed Semilla+ Strength Intensidad+ Reduce Color Noise Reducir ruido de color+ Remove Jpeg Artifact Quitar artefactos JPEG+ Sharpen Details Enfocar detalles+ Reduce Noise Reducir ruido+ Use Classic Mode Usar modo clásico+ Auto Center Preview Centrar previsualización automáticamente+ Next Document Documento siguiente+ Previous Document Documento anterior+ W x H x Resolution An. x Al. x Resolución+ Front Image Imagen frontal+ Search settings… Buscar ajustes…+ No matching settings No hay ajustes que coincidandiff --cc crates/ui-egui/src/i18n/fr.tsvindex 49aa622bc,25c8e0f37..2d340befd--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@@ -2825,15 -2850,11 +2850,23 @@@ fontWeight Italic ItaliquQuick Selection found nothing there La Sélection rapide n'a rien trouvé à cet endroitObject Selection found nothing there — try a tighter rectangle La Sélection d'objet n'a rien trouvé à cet endroit — essayez un rectangle plus serréNo subject found — try a rectangle around the object Aucun sujet trouvé — essayez un rectangle autour de l'objet+# Shared panel docking+ Activate Panel Activer le panneau+ Change Panel Group Modifier le groupe de panneaux+ Change Panel Layout Modifier la disposition des panneaux+ Close Panel Fermer le panneau+ Dock Panel Ancrer le panneau+ Float Panel Panneau flottant+ Move Panel Déplacer le panneau+ Group with Grouper avec+ Panel menu Menu du panneau+ Resize panel window Redimensionner la fenêtre du panneau+ Resize panels Redimensionner les panneaux+ Use Classic Mode Utiliser le mode classique+ Auto Center Preview Centrer automatiquement l'aperçu+ Next Document Document suivant+ Previous Document Document précédent+ W x H x Resolution L x H x Résolution+ Front Image Image de premier plan+ Search settings… Rechercher des réglages…+ No matching settings Aucun réglage correspondantdiff --cc crates/ui-egui/src/i18n/id.tsvindex 8033d8279,9030e7252..25fd766db--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@@ -2812,15 -2837,11 +2837,23 @@@ fontWeight Italic MirinQuick Selection found nothing there Seleksi Cepat tidak menemukan apa pun di sanaObject Selection found nothing there — try a tighter rectangle Seleksi Objek tidak menemukan apa pun di sana — coba persegi panjang yang lebih rapatNo subject found — try a rectangle around the object Subjek tidak ditemukan — coba persegi panjang di sekitar objek+# Shared panel docking+ Activate Panel Aktifkan Panel+ Change Panel Group Ubah Grup Panel+ Change Panel Layout Ubah Tata Letak Panel+ Close Panel Tutup Panel+ Dock Panel Tambatkan Panel+ Float Panel Panel Mengambang+ Move Panel Pindahkan Panel+ Group with Kelompokkan dengan+ Panel menu Menu panel+ Resize panel window Ubah ukuran jendela panel+ Resize panels Ubah ukuran panel+ Use Classic Mode Gunakan Mode Klasik+ Auto Center Preview Pusatkan Pratinjau Otomatis+ Next Document Dokumen Berikutnya+ Previous Document Dokumen Sebelumnya+ W x H x Resolution L x T x Resolusi+ Front Image Gambar Depan+ Search settings… Cari pengaturan…+ No matching settings Tidak ada pengaturan yang cocokdiff --cc crates/ui-egui/src/i18n/it.tsvindex 94cfd708b,9993449c5..fb1bc73b2--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@@ -2476,15 -2502,11 +2502,23 @@@ fontWeight Italic CorsivQuick Selection found nothing there Selezione rapida non ha trovato nulla lìObject Selection found nothing there — try a tighter rectangle Selezione oggetto non ha trovato nulla lì — prova un rettangolo più strettoNo subject found — try a rectangle around the object Nessun soggetto trovato — prova un rettangolo attorno all'oggetto+# Shared panel docking+ Activate Panel Attiva pannello+ Change Panel Group Cambia gruppo di pannelli+ Change Panel Layout Cambia disposizione dei pannelli+ Close Panel Chiudi pannello+ Dock Panel Aggancia pannello+ Float Panel Pannello mobile+ Move Panel Sposta pannello+ Group with Raggruppa con+ Panel menu Menu del pannello+ Resize panel window Ridimensiona finestra del pannello+ Resize panels Ridimensiona pannelli+ Use Classic Mode Usa modalità classica+ Auto Center Preview Centra anteprima automaticamente+ Next Document Documento successivo+ Previous Document Documento precedente+ W x H x Resolution L x A x Risoluzione+ Front Image Immagine in primo piano+ Search settings… Cerca impostazioni…+ No matching settings Nessuna impostazione corrispondentediff --cc crates/ui-egui/src/i18n/ja.tsvindex 7f76f2549,310650e1d..3614d38be--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@@ -3426,15 -3451,11 +3451,23 @@@ fontWeight Italic 斜�Quick Selection found nothing there クイック選択ではそこに何も見つかりませんでしたObject Selection found nothing there — try a tighter rectangle オブジェクト選択ではそこに何も見つかりませんでした — より狭い長方形で試してくださいNo subject found — try a rectangle around the object 被写体が見つかりません — オブジェクトを囲む長方形を試してください+# Shared panel docking+ Activate Panel パネルをアクティブにする+ Change Panel Group パネルグループを変更+ Change Panel Layout パネルレイアウトを変更+ Close Panel パネルを閉じる+ Dock Panel パネルをドッキング+ Float Panel パネルをフロート+ Move Panel パネルを移動+ Group with グループ化するパネル+ Panel menu パネルメニュー+ Resize panel window パネルウィンドウのサイズを変更+ Resize panels パネルのサイズを変更+ Use Classic Mode クラシックモードを使用+ Auto Center Preview プレビューを自動的に中央に配置+ Next Document 次のドキュメント+ Previous Document 前のドキュメント+ W x H x Resolution 幅 x 高さ x 解像度+ Front Image 前面の画像+ Search settings… 設定を検索…+ No matching settings 一致する設定はありませんdiff --cc crates/ui-egui/src/i18n/ko.tsvindex 40fdb4ccd,21cf014d5..0f11c22f5--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@@ -2984,15 -3011,11 +3011,23 @@@ fontWeight Italic 기울�Quick Selection found nothing there 빠른 선택으로 해당 위치에서 아무것도 찾지 못했습니다Object Selection found nothing there — try a tighter rectangle 개체 선택으로 해당 위치에서 아무것도 찾지 못했습니다 — 더 좁은 사각형을 사용해 보세요No subject found — try a rectangle around the object 피사체를 찾을 수 없습니다 — 개체 주위에 사각형을 그려 보세요+# Shared panel docking+ Activate Panel 패널 활성화+ Change Panel Group 패널 그룹 변경+ Change Panel Layout 패널 레이아웃 변경+ Close Panel 패널 닫기+ Dock Panel 패널 도킹+ Float Panel 패널 띄우기+ Move Panel 패널 이동+ Group with 다음과 그룹화+ Panel menu 패널 메뉴+ Resize panel window 패널 창 크기 조절+ Resize panels 패널 크기 조절+ Use Classic Mode 클래식 모드 사용+ Auto Center Preview 미리 보기 자동 가운데 맞춤+ Next Document 다음 문서+ Previous Document 이전 문서+ W x H x Resolution 폭 x 높이 x 해상도+ Front Image 전면 이미지+ Search settings… 설정 검색…+ No matching settings 일치하는 설정 없음diff --cc crates/ui-egui/src/i18n/nl.tsvindex a7a99f396,20370b432..f9e2ccdc0--- a/crates/ui-egui/src/i18n/nl.tsv+++ b/crates/ui-egui/src/i18n/nl.tsv@@@ -3585,15 -3609,12 +3609,24 @@@ cameraRaw Whites WitteQuick Selection found nothing there Snelle selectie heeft daar niets gevondenObject Selection found nothing there — try a tighter rectangle Objectselectie heeft daar niets gevonden — probeer een krappere rechthoekNo subject found — try a rectangle around the object Geen onderwerp gevonden — probeer een rechthoek rond het object+# Shared panel docking+ Activate Panel Paneel activeren+ Change Panel Group Paneelgroep wijzigen+ Change Panel Layout Paneelindeling wijzigen+ Close Panel Paneel sluiten+ Dock Panel Paneel vastzetten+ Float Panel Zwevend paneel+ Move Panel Paneel verplaatsen+ Group with Groeperen met+ Panel menu Paneelmenu+ Resize panel window Paneelvenster vergroten of verkleinen+ Resize panels Panelen vergroten of verkleinen+ Use Classic Mode Klassieke modus gebruiken+ Auto Center Preview Voorvertoning automatisch centreren+ Next Document Volgend document+ Previous Document Vorig document+ W x H x Resolution B x H x Resolutie+ Front Image Voorste afbeelding+ Search settings… Instellingen zoeken…+ No matching settings Geen overeenkomende instellingen+ PhotoCraft — Screen Color Picker PhotoCraft — Schermkleurkiezerdiff --cc crates/ui-egui/src/i18n/pl.tsvindex a97c8ac91,ac086df7a..08fa9c9fd--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@@ -3426,15 -3451,11 +3451,23 @@@ cameraRaw Roughness Chropowatoś�Quick Selection found nothing there Szybkie zaznaczanie nic tam nie znalazłoObject Selection found nothing there — try a tighter rectangle Zaznaczanie obiektu nic tam nie znalazło — spróbuj ciaśniejszego prostokątaNo subject found — try a rectangle around the object Nie znaleziono obiektu — spróbuj prostokąta wokół obiektu+# Shared panel docking+ Activate Panel Aktywuj panel+ Change Panel Group Zmień grupę paneli+ Change Panel Layout Zmień układ paneli+ Close Panel Zamknij panel+ Dock Panel Dokuj panel+ Float Panel Panel pływający+ Move Panel Przenieś panel+ Group with Grupuj z+ Panel menu Menu panelu+ Resize panel window Zmień rozmiar okna panelu+ Resize panels Zmień rozmiar paneli+ Use Classic Mode Użyj trybu klasycznego+ Auto Center Preview Automatycznie wyśrodkuj podgląd+ Next Document Następny dokument+ Previous Document Poprzedni dokument+ W x H x Resolution Szer. x Wys. x Rozdzielczość+ Front Image Obraz na wierzchu+ Search settings… Szukaj ustawień…+ No matching settings Brak pasujących ustawieńdiff --cc crates/ui-egui/src/i18n/pt-br.tsvindex 809b4d2fa,a664352cc..ac6a0d71c--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@@ -2833,15 -2858,11 +2858,23 @@@ fontWeight Italic ItálicQuick Selection found nothing there A Seleção rápida não encontrou nada aliObject Selection found nothing there — try a tighter rectangle A Seleção de objeto não encontrou nada ali — tente um retângulo mais justoNo subject found — try a rectangle around the object Nenhum assunto encontrado — tente um retângulo ao redor do objeto+# Shared panel docking+ Activate Panel Ativar painel+ Change Panel Group Alterar grupo de painéis+ Change Panel Layout Alterar disposição dos painéis+ Close Panel Fechar painel+ Dock Panel Encaixar painel+ Float Panel Painel flutuante+ Move Panel Mover painel+ Group with Agrupar com+ Panel menu Menu do painel+ Resize panel window Redimensionar janela do painel+ Resize panels Redimensionar painéis+ Use Classic Mode Usar modo clássico+ Auto Center Preview Centralizar visualização automaticamente+ Next Document Próximo documento+ Previous Document Documento anterior+ W x H x Resolution L x A x Resolução+ Front Image Imagem frontal+ Search settings… Pesquisar configurações…+ No matching settings Nenhuma configuração encontradadiff --cc crates/ui-egui/src/i18n/ru.tsvindex 5380a144c,f7d3cee40..fde0abc57--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@@ -2690,15 -2715,13 +2715,25 @@@ fontWeight Italic Курси�Missing delete command Отсутствует команда удаленияInvalid delete command Недопустимая команда удаленияLayer deleted, but confirmation preference could not be saved: {error} Слой удалён, но не удалось сохранить настройку подтверждения: {error}+# Shared panel docking+ Activate Panel Активировать панель+ Change Panel Group Изменить группу панелей+ Change Panel Layout Изменить расположение панелей+ Close Panel Закрыть панель+ Dock Panel Закрепить панель+ Float Panel Сделать панель плавающей+ Move Panel Переместить панель+ Group with Сгруппировать с+ Panel menu Меню панели+ Resize panel window Изменить размер окна панели+ Resize panels Изменить размер панелей+ Use Classic Mode Использовать классический режим+ Auto Center Preview Автоматически центрировать просмотр+ Next Document Следующий документ+ Previous Document Предыдущий документ+ W x H x Resolution Ш x В x Разрешение+ Front Image Изображение переднего плана+ Swaps height and width Меняет местами высоту и ширину+ Rasterize Layer Style Растрировать стиль слоя+ Search settings… Поиск настроек…+ No matching settings Нет подходящих настроекdiff --cc crates/ui-egui/src/i18n/uk.tsvindex 374d56531,1f9a076d8..9a76d6836--- a/crates/ui-egui/src/i18n/uk.tsv+++ b/crates/ui-egui/src/i18n/uk.tsv@@@ -3513,15 -3537,12 +3537,24 @@@ cameraRaw Masking Маскуванн�Quick Selection found nothing there Швидке виділення нічого тут не знайшлоObject Selection found nothing there — try a tighter rectangle Виділення об'єктів нічого тут не знайшло — спробуйте вужчий прямокутникNo subject found — try a rectangle around the object Об'єкт не знайдено — спробуйте прямокутник навколо об'єкта+# Shared panel docking+ Activate Panel Активувати панель+ Change Panel Group Змінити групу панелей+ Change Panel Layout Змінити розташування панелей+ Close Panel Закрити панель+ Dock Panel Закріпити панель+ Float Panel Зробити панель плаваючою+ Move Panel Перемістити панель+ Group with Згрупувати з+ Panel menu Меню панелі+ Resize panel window Змінити розмір вікна панелі+ Resize panels Змінити розмір панелей+ Use Classic Mode Використовувати класичний режим+ Auto Center Preview Автоматично центрувати перегляд+ Next Document Наступний документ+ Previous Document Попередній документ+ W x H x Resolution Ш x В x Роздільна здатність+ Front Image Зображення переднього плану+ Search settings… Пошук налаштувань…+ No matching settings Немає відповідних налаштувань+ PhotoCraft — Screen Color Picker PhotoCraft — Піпетка кольору екранаdiff --cc crates/ui-egui/src/i18n/zh-hans.tsvindex 3c57e090a,de1d2dcac..06a73fa0d--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@@ -2414,15 -2440,11 +2440,23 @@@ fontWeight Italic 斜�Quick Selection found nothing there 快速选择在该处未找到任何内容Object Selection found nothing there — try a tighter rectangle 对象选择在该处未找到任何内容 — 请尝试更紧凑的矩形No subject found — try a rectangle around the object 未找到主体 — 请尝试在对象周围绘制矩形+# Shared panel docking+ Activate Panel 激活面板+ Change Panel Group 更改面板组+ Change Panel Layout 更改面板布局+ Close Panel 关闭面板+ Dock Panel 停靠面板+ Float Panel 浮动面板+ Move Panel 移动面板+ Group with 与此面板分组+ Panel menu 面板菜单+ Resize panel window 调整面板窗口大小+ Resize panels 调整面板大小+ Use Classic Mode 使用经典模式+ Auto Center Preview 自动居中预览+ Next Document 下一个文档+ Previous Document 上一个文档+ W x H x Resolution 宽 x 高 x 分辨率+ Front Image 前面的图像+ Search settings… 搜索设置…+ No matching settings 没有匹配的设置diff --cc crates/ui-egui/src/i18n/zh-hant.tsvindex acaae595d,697e5312c..4256b8ffc--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@@ -2383,15 -2410,11 +2410,23 @@@ fontWeight Italic 斜�Quick Selection found nothing there 快速選取在該處找不到任何內容Object Selection found nothing there — try a tighter rectangle 物件選取在該處找不到任何內容 — 請嘗試更緊密的矩形No subject found — try a rectangle around the object 找不到主體 — 請嘗試在物件周圍繪製矩形+# Shared panel docking+ Activate Panel 啟用面板+ Change Panel Group 變更面板群組+ Change Panel Layout 變更面板配置+ Close Panel 關閉面板+ Dock Panel 停駐面板+ Float Panel 浮動面板+ Move Panel 移動面板+ Group with 與此面板分組+ Panel menu 面板選單+ Resize panel window 調整面板視窗大小+ Resize panels 調整面板大小+ Use Classic Mode 使用傳統模式+ Auto Center Preview 自動置中預視+ Next Document 下一個文件+ Previous Document 上一個文件+ W x H x Resolution 寬 x 高 x 解析度+ Front Image 前面的影像+ Search settings… 搜尋設定…+ No matching settings 沒有符合的設定diff --cc crates/ui-egui/src/layer_props_ui.rsindex 104201c2e,12554c872..76d35bb0f--- a/crates/ui-egui/src/layer_props_ui.rs+++ b/crates/ui-egui/src/layer_props_ui.rs@@@ -38,9 -38,9 +38,9 @@@ fn field(ui: &mut egui::Ui, id: &str, llet t = Tokens::get(ui.ctx());let (r, _) = ui.allocate_exact_size(vec2(LABEL_W, 22.0), Sense::hover());ui.painter().text(pos2(r.right() - 2.0, r.center().y), egui::Align2::RIGHT_CENTER, tl!(label), egui::FontId::proportional(12.0), t.text_dim);- let key = egui::Id::new(("layer-props-field", id));+ let key = ui.make_persistent_id(("layer-props-field", id));- let mut v = ui.data(|d| d.get_temp::<f32>(key)).unwrap_or(current);- let resp = widgets::value_field(ui, &mut v, -300_000.0..=300_000.0, "px", width);+ let mut v = ui.data(|d| d.get_temp::<f32>(key)).unwrap_or_else(|| u.shown(f64::from(current), extent));+ let resp = widgets::value_field(ui, &mut v, -300_000.0..=300_000.0, u.unit.suffix(), width);if resp.dragged() || resp.has_focus() {ui.data_mut(|d| d.insert_temp(key, v));return None;diff --cc crates/ui-egui/src/menus.rsindex 49907e80d,9e2aa0f5f..a717a1219--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -592,9 -608,7 +618,9 @@@ pub fn is_enabled(app: &PhotocraftApp,return e;}match id {+ "window.panel.activate" | "window.panel.layout" => true,+ "window.panel.group" | "window.panel.move" | "window.panel.float" | "window.panel.dock" | "window.panel.close" => !app.session.prefs().workspace_locked,- "file.open" | "file.exit" | "file.clearRecent" | "help.about" | "help.systemInfo" | "edit.search" => true,+ "file.open" | "file.exit" | "file.clearRecent" | "file.removeRecent" | "help.about" | "help.systemInfo" | "edit.search" => true,i if i.starts_with("file.openRecent.") => true,i if crate::links::url_for(i).is_some() => true,i if i.starts_with("window.theme.") => true,diff --cc crates/ui-egui/src/panel_docking.rsindex 3c7ffe61d,000000000..8c219bdd6mode 100644,000000..100644--- a/crates/ui-egui/src/panel_docking.rs+++ b/crates/ui-egui/src/panel_docking.rs@@@ -1,996 -1,0 +1,1009 @@@+//! Application-owned panel IDs and commands around the shared docking layout.++use crate::dock::Group;+use craft_ui::docking::{Action, Floating, Layout, Node, Placement, Zone};+use craft_ui::layout::{SplitAxis, SplitSize};+use serde_json::{Value, json};++use crate::PhotocraftApp;++const PANELS: &[(&str, &str, Group)] = &[+ ("color", "Color", Group::Color),+ ("swatches", "Swatches", Group::Color),+ ("gradients", "Gradients", Group::Color),+ ("patterns", "Patterns", Group::Color),+ ("properties", "Properties", Group::Properties),+ ("adjustments", "Adjustments", Group::Properties),+ ("character", "Character", Group::Character),+ ("paragraph", "Paragraph", Group::Character),+ ("navigator", "Navigator", Group::Navigator),+ ("histogram", "Histogram", Group::Navigator),+ ("info", "Info", Group::Navigator),+ ("history", "History", Group::History),+ ("actions", "Actions", Group::History),+ ("layerComps", "Layer Comps", Group::History),+ ("layers", "Layers", Group::Layers),+ ("channels", "Channels", Group::Layers),+ ("paths", "Paths", Group::Layers),+];+#[derive(Clone, Default)]+struct LegacyDrag {+ generation: u64,+ layout: Option<Layout<String>>,+ tabs: crate::state::DockTabs,+ hidden: std::collections::BTreeMap<String, craft_ui::docking::Location<String>>,+}++fn cancel_legacy_drag(app: &mut PhotocraftApp, ctx: &egui::Context) -> bool {+ let key = egui::Id::new("photocraft-panel-docking").with("legacy-origin");+ let previous = ctx.data_mut(|data| data.remove_temp::<LegacyDrag>(key));+ if let Some(previous) = previous {+ craft_ui::docking::cancel_drag::<String>(ctx, egui::Id::new("photocraft-panel-docking"));+ if previous.generation != app.ui.docking_generation {+ return false;+ }+ app.ui.dock_tabs = previous.tabs;+ app.ui.docking = previous.layout;+ app.ui.docking_hidden = previous.hidden;+ true+ } else {+ false+ }+}++fn normalize(raw: &str) -> Option<&'static str> {+ PANELS.iter().find(|(id, label, _)| id.eq_ignore_ascii_case(raw.trim()) || label.eq_ignore_ascii_case(raw.trim())).map(|p| p.0)+}++pub(crate) fn valid(layout: &Layout<String>) -> bool {+ layout.validate().is_ok() && layout.panels().iter().all(|id| normalize(id) == Some(id.as_str()))+}++fn legacy(app: &PhotocraftApp) -> Layout<String> {+ legacy_layout(app, false)+}++fn legacy_layout(app: &PhotocraftApp, all: bool) -> Layout<String> {+ let pro = matches!(app.ui.theme, crate::theme::ThemeKind::Pro | crate::theme::ThemeKind::ProMedium);+ let mut layout = Layout::default();+ for group in app.ui.dock.order().into_iter().rev().filter(|g| all || g.shown(&app.ui.panels)) {+ let labels = group.tabs(pro);+ let visible = if all { group.tabs(pro).iter().copied().enumerate().collect() } else { app.ui.dock.visible_tabs(group, pro) };+ let panels: Vec<String> = visible.iter().filter_map(|(_, label)| normalize(label).map(str::to_owned)).collect();+ if panels.is_empty() {+ continue;+ }+ let selected = match group {+ Group::Color => app.ui.dock_tabs.color,+ Group::Properties => app.ui.dock_tabs.properties,+ Group::Character => app.ui.dock_tabs.character,+ Group::Navigator => app.ui.dock_tabs.navigator,+ Group::History => app.ui.dock_tabs.history,+ Group::Layers => app.ui.dock_tabs.layers,+ };+ let active = labels.get(selected).and_then(|label| normalize(label)).and_then(|id| panels.iter().position(|p| p == id)).unwrap_or(0);+ if group == Group::Properties && !pro {+ layout.floating.push(Floating { panels, active, rect: [120.0, 160.0, 320.0, 440.0] });+ continue;+ }+ let node = Node::Tabs { panels, active };+ layout.root = Some(match layout.root.take() {+ Some(second) => Node::Split {+ axis: SplitAxis::Vertical,+ size: SplitSize::FixedFirst(app.ui.dock.height(group)),+ first: Box::new(node),+ second: Box::new(second),+ },+ None => node,+ });+ }+ layout+}++// Native collapse flags remain app-owned. An intact native tab group keeps its collapsed+// presentation when the workspace first becomes customizable; mixed custom groups are expanded.+fn collapsed_members(app: &PhotocraftApp, layout: &Layout<String>) -> std::collections::HashSet<String> {+ let mut collapsed: std::collections::HashSet<String> = app.ui.docking_collapsed.iter().cloned().collect();+ let mut pending: Vec<_> = layout.root.iter().collect();+ while let Some(node) = pending.pop() {+ match node {+ Node::Split { first, second, .. } => pending.extend([first.as_ref(), second.as_ref()]),+ Node::Tabs { panels, .. } => {+ let group = panels.first().and_then(|id| PANELS.iter().find(|p| p.0 == id)).map(|p| p.2);+ if let Some(group) = group.filter(|group| app.ui.dock.is_collapsed(*group)) {+ let pro = matches!(app.ui.theme, crate::theme::ThemeKind::Pro | crate::theme::ThemeKind::ProMedium);+ let native: Vec<_> = app.ui.dock.visible_tabs(group, pro).iter().filter_map(|(_, name)| normalize(name)).collect();+ if panels.len() == native.len() && panels.iter().all(|panel| native.contains(&panel.as_str())) {+ collapsed.extend(panels.iter().cloned());+ }+ }+ }+ _ => {}+ }+ }+ collapsed+}++fn first_root(layout: &Layout<String>, except: &str) -> Option<String> {+ let root = Layout { root: layout.root.clone(), floating: Vec::new() };+ root.panels().into_iter().find(|p| p.as_str() != except).cloned()+}++fn ensure(layout: &mut Layout<String>, panel: &str) -> Result<(), String> {+ let anchor = first_root(layout, panel);+ layout.apply(Action::Open { panel: panel.into(), anchor }).map_err(|e| e.to_string())+}++fn number(params: &Value, key: &str, default: f32) -> Result<f32, String> {+ match params.get(key) {+ None => Ok(default),+ Some(v) => v.as_f64().filter(|v| v.is_finite() && v.abs() <= 1_000_000.0).map(|v| v as f32).ok_or_else(|| format!("{key} must be a finite coordinate")),+ }+}++fn placement(params: &Value) -> Result<Placement<String>, String> {+ if let Some(before) = params.get("before") {+ let id = before.as_str().and_then(normalize).ok_or("before must name a panel")?;+ return Ok(Placement::Tab { before: Some(id.into()) });+ }+ let zone = match params.get("zone") {+ None => "tab",+ Some(value) => value.as_str().ok_or("zone must be a string")?,+ };+ Ok(match zone {+ "tab" => Placement::Tab { before: None },+ "center" => Placement::Split(Zone::Center),+ "left" => Placement::Split(Zone::Left),+ "right" => Placement::Split(Zone::Right),+ "top" => Placement::Split(Zone::Top),+ "bottom" => Placement::Split(Zone::Bottom),+ _ => return Err("zone must be tab, center, left, right, top or bottom".into()),+ })+}++pub(crate) fn command(app: &mut PhotocraftApp, id: &str, params: &Value) -> Option<Result<Value, String>> {+ if id == "window.panel.group" {+ return Some(group_command(app, params));+ }+ if id == "window.panel.layout" {+ return Some(+ params+ .get("action")+ .ok_or_else(|| "action is required".to_string())+ .and_then(|value| serde_json::from_value::<Action<String>>(value.clone()).map_err(|error| error.to_string()))+ .and_then(|action| apply_action(app, action)),+ );+ }+ if let Some(layout) = &app.ui.docking+ && let Some(panel) = id.strip_prefix("window.panel.").or_else(|| id.strip_prefix("window.toggle.")).and_then(normalize)+ {+ let showing = layout.contains(&panel.to_string());+ let show = match params.get("show").or_else(|| params.get("on")) {+ None => !showing || !panel_active(layout, panel) || collapsed_members(app, layout).contains(panel),+ Some(value) => match value.as_bool() {+ Some(show) => show,+ None => return Some(Err("show must be a boolean".into())),+ },+ };+ return Some(change(app, if show { "activate" } else { "close" }, &json!({"panel":panel})));+ }+ let operation = match id {+ "window.panel.move" => "move",+ "window.panel.float" => "float",+ "window.panel.dock" => "dock",+ "window.panel.activate" => "activate",+ "window.panel.close" => "close",+ "window.panel" if app.ui.docking.is_some() => "activate",+ _ => return None,+ };+ Some(change(app, operation, params))+}++pub(crate) fn checked(app: &PhotocraftApp, id: &str) -> Option<bool> {+ let layout = app.ui.docking.as_ref()?;+ let panel = id.strip_prefix("window.panel.").or_else(|| id.strip_prefix("window.toggle.")).and_then(normalize)?;+ Some(layout.contains(&panel.to_string()))+}++// UI output and automation share this atomic dispatcher. The application owns the registry+// and saved return locations; craft-ui owns tree validation and structural changes.+fn apply_action(app: &mut PhotocraftApp, action: Action<String>) -> Result<Value, String> {+ if app.session.prefs().workspace_locked && !matches!(action, Action::Activate { .. }) {+ return Err("workspace is locked".into());+ }+ let registered = |id: &String| normalize(id) == Some(id.as_str());+ let known = match &action {+ Action::Move { panel, anchor, placement } | Action::OpenAt { panel, anchor, placement } => {+ registered(panel)+ && registered(anchor)+ && match placement {+ Placement::Tab { before: Some(id) } => registered(id),+ _ => true,+ }+ }+ Action::Open { panel, anchor } => registered(panel) && anchor.as_ref().is_none_or(registered),+ Action::Float { panel, .. }+ | Action::Close { panel }+ | Action::Activate { panel }+ | Action::MoveFloating { panel, .. }+ | Action::SetStackOpen { panel, .. }+ | Action::ResizeStack { panel, .. } => registered(panel),+ Action::ResizeSplit { path, .. } => path.len() <= craft_ui::docking::MAX_DEPTH,+ };+ if !known {+ return Err("docking action contains an unknown panel or an excessive split path".into());+ }+ if app.ui.docking.as_ref().is_some_and(|layout| !valid(layout)) {+ return Err("saved panel layout is invalid; reset the workspace first".into());+ }+ let mut layout = app.ui.docking.clone().unwrap_or_else(|| legacy(app));+ let returning = match &action {+ Action::Close { panel } => layout.location(panel).ok().map(|location| (panel.clone(), location)),+ Action::Float { panel, .. } => layout.location(panel).ok().filter(|location| location.floating.is_none()).map(|location| (panel.clone(), location)),+ _ => None,+ };+ let reveal = match &action {+ Action::Activate { panel } => Some(panel.clone()),+ _ => None,+ };+ let activate = match &action {+ Action::Activate { panel } => PANELS.iter().find(|p| p.0 == panel).map(|p| p.2),+ _ => None,+ };+ layout.apply(action).map_err(|error| error.to_string())?;+ if let Some(group) = activate {+ app.ui.dock.set_collapsed(group, false);+ }+ if let Some((panel, location)) = returning {+ app.ui.docking_hidden.insert(panel, location);+ }+ if app.ui.docking.is_none() {+ app.ui.docking_hidden.extend(migration_hidden(app, &layout));+ }+ app.ui.docking = Some(layout);+ app.ui.panels.dock = true;+ sync_visibility(app);+ if let Some(panel) = reveal {+ app.ui.docking_reveal = Some(panel.clone());+ reveal_group(app, &panel);+ }+ Ok(json!({"layout": app.ui.docking}))+}++fn change(app: &mut PhotocraftApp, operation: &str, params: &Value) -> Result<Value, String> {+ if app.session.prefs().workspace_locked && operation != "activate" {+ return Err("workspace is locked".into());+ }+ let panel = params.get("panel").and_then(Value::as_str).and_then(normalize).ok_or("panel must name a registered panel")?;+ if app.ui.docking.as_ref().is_some_and(|layout| !valid(layout)) {+ return Err("saved panel layout is invalid; reset the workspace first".into());+ }+ let mut layout = app.ui.docking.clone().unwrap_or_else(|| legacy(app));+ let migrated = if app.ui.docking.is_none() { migration_hidden(app, &layout) } else { app.ui.docking_hidden.clone() };+ let mut hidden: std::collections::BTreeMap<_, _> =+ migrated.iter().filter(|(id, _)| normalize(id).is_some()).take(64).map(|(id, at)| (id.clone(), at.clone())).collect();+ let mut restored = false;+ if operation == "dock"+ && params.get("anchor").or_else(|| params.get("onto")).is_none()+ && let Some(location) = hidden.get(panel).filter(|location| {+ location.floating.is_none()+ && location.anchor.as_ref().is_none_or(|anchor| Layout { root: layout.root.clone(), floating: Vec::new() }.contains(anchor))+ })+ {+ let mut candidate = layout.clone();+ if candidate.contains(&panel.to_string()) {+ candidate.apply(Action::Close { panel: panel.into() }).map_err(|e| e.to_string())?;+ }+ if candidate.restore(panel.into(), location).is_ok() {+ layout = candidate;+ restored = true;+ hidden.remove(panel);+ }+ }+ match operation {+ "dock" if restored => {}+ "float" => {+ let rect = [number(params, "x", 400.0)?, number(params, "y", 140.0)?, number(params, "width", 300.0)?, number(params, "height", 400.0)?];+ ensure(&mut layout, panel)?;+ if let Ok(location) = layout.location(&panel.to_string())+ && location.floating.is_none()+ {+ hidden.insert(panel.into(), location);+ }+ layout.apply(Action::Float { panel: panel.into(), rect }).map_err(|e| e.to_string())?;+ }+ "move" | "dock" => {+ if operation == "move" && params.get("anchor").or_else(|| params.get("onto")).is_none() {+ return Err("move requires a destination panel".into());+ }+ let anchor = match params.get("anchor").or_else(|| params.get("onto")) {+ Some(v) => Some(v.as_str().and_then(normalize).ok_or("anchor must name a registered panel")?.to_string()),+ None => first_root(&layout, panel),+ };+ let placement = placement(params)?;+ if let Some(anchor) = anchor {+ ensure(&mut layout, panel)?;+ layout.apply(Action::Move { panel: panel.into(), anchor, placement }).map_err(|e| e.to_string())?;+ } else if operation == "dock" {+ if layout.contains(&panel.to_string()) {+ layout.apply(Action::Close { panel: panel.into() }).map_err(|e| e.to_string())?;+ }+ layout.apply(Action::Open { panel: panel.into(), anchor: None }).map_err(|e| e.to_string())?;+ } else {+ return Err("move requires an existing destination panel".into());+ }+ }+ "close" => {+ hidden.insert(panel.into(), layout.location(&panel.to_string()).map_err(|e| e.to_string())?);+ layout.apply(Action::Close { panel: panel.into() }).map_err(|e| e.to_string())?;+ }+ _ => {+ if !layout.contains(&panel.to_string()) && hidden.contains_key(panel) {+ // A missing neighbor is allowed: the normal visible dock becomes the fallback.+ restore_hidden(&mut layout, &mut hidden, panel);+ }+ ensure(&mut layout, panel)?;+ layout.apply(Action::Activate { panel: panel.into() }).map_err(|e| e.to_string())?;+ hidden.remove(panel);+ }+ }+ app.ui.docking = Some(layout);+ app.ui.docking_hidden = hidden;+ app.ui.panels.dock = true;+ sync_visibility(app);+ if operation == "activate"+ && let Some((_, _, group)) = PANELS.iter().find(|p| p.0 == panel)+ {+ app.ui.dock.set_collapsed(*group, false);+ app.ui.docking_reveal = Some(panel.to_owned());+ reveal_group(app, panel);+ }+ Ok(json!({"panel": panel, "layout": app.ui.docking}))+}++pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) -> bool {+ let area = egui::Id::new("photocraft-panel-docking");+ let stale_origin =+ ui.ctx().data_mut(|data| data.get_temp::<LegacyDrag>(area.with("legacy-origin")).is_some_and(|origin| origin.generation != app.ui.docking_generation));+ let changed_workspace = ui.ctx().data_mut(|data| {+ let previous = data.get_temp::<u64>(area.with("generation"));+ data.insert_temp(area.with("generation"), app.ui.docking_generation);+ previous.is_some_and(|generation| generation != app.ui.docking_generation)+ });+ if changed_workspace || stale_origin {++ ui.ctx().data_mut(|data| data.insert_temp(area.with("legacy-suppressed"), true));+ craft_ui::docking::cancel_drag::<String>(ui.ctx(), area);+ ui.ctx().data_mut(|data| data.remove::<LegacyDrag>(area.with("legacy-origin")));+ }++ let cancelled =+ ui.input(|input| !input.focused || input.key_pressed(egui::Key::Escape) || (!input.pointer.primary_down() && !input.pointer.any_released()));- if cancelled && cancel_legacy_drag(app, ui.ctx()) && app.ui.docking.is_none() {- return false;++ if cancelled && cancel_legacy_drag(app, ui.ctx()) {++ ui.ctx().data_mut(|data| data.insert_temp(area.with("legacy-suppressed"), true));++ if app.ui.docking.is_none() {++ return false;++ }+ }+ let Some(layout) = app.ui.docking.as_ref() else { return false };+ if !valid(layout) {+ app.ui.docking = None;+ app.ui.status = "Invalid panel layout; restored the default dock".into();+ return false;+ }+ let layout = layout.clone();+ let reveal = app.ui.docking_reveal.take();+ let t = crate::theme::Tokens::get(ui.ctx());+ let locked = app.session.prefs().workspace_locked;+ let collapsed = collapsed_members(app, &layout);+ let requested_width = ui.ctx().data_mut(|data| data.remove_temp::<f32>(crate::panels::dock_width_id()));+ let mut commands = Vec::new();+ let mut targets = Vec::new();+ let mut draw = |ui: &mut egui::Ui| {+ let mut style = craft_ui::docking::DockStyle::from_ui(ui);+ style.tab_height = if t.pro { 28.0 } else { 40.0 };+ style.min_pane = 0.0;+ style.background = t.card;+ style.tab_background = t.tab_strip;+ style.active_background = t.card;+ style.text = t.text;+ style.inactive_text = t.text_dim;+ style.border = egui::Stroke::new(1.0, t.card_border);+ style.accent = t.accent;+ style.float_label = tl!("Float Panel").to_string();+ style.close_label = tl!("Close Panel").to_string();+ style.move_label = tl!("Group with").to_string();+ style.panels_label = tl!("Panels").to_string();+ style.resize_label = tl!("Resize panels").to_string();+ style.resize_window_label = tl!("Resize panel window").to_string();+ let mut area = craft_ui::docking::DockArea::new(egui::Id::new("photocraft-panel-docking"));+ if let Some(panel) = &reveal {+ area = area.raise_panel(panel.clone());+ }+ area.show_customized(+ ui,+ &layout,+ &style,+ |id| PANELS.iter().find(|p| p.0 == id).map(|p| tl!(p.1).to_string()).unwrap_or_else(|| id.clone()),+ |_| craft_ui::docking::Permissions { movable: !locked, floatable: !locked, closable: !locked, accepts_tabs: !locked },+ |id| {+ if collapsed.contains(id) {+ craft_ui::docking::PanelLimits { min: egui::vec2(220.0, 0.0), max: egui::vec2(1_000_000.0, 0.0) }+ } else {+ // Layers owns its row scroll and footer; leave room for its fixed controls+ // plus a scrolling row area instead of clipping the footer after a split.+ let height = if id == "layers" { 220.0 } else { 80.0 };+ craft_ui::docking::PanelLimits { min: egui::vec2(220.0, height), ..Default::default() }+ }+ },+ &mut PanelContent { app, collapsed: &collapsed, commands: &mut commands, targets: &mut targets },+ )+ };+ let output = if layout.root.is_some() {+ let mut panel = egui::Panel::right("shared-panel-dock")+ .default_size(if t.pro { 290.0 } else { 300.0 })+ .size_range(crate::panels::DOCK_WIDTH)+ .resizable(!locked)+ .frame(egui::Frame::NONE.fill(t.card));+ if let Some(width) = requested_width {+ panel = panel.exact_size(width);+ }+ panel.show(ui, &mut draw).inner+ } else {+ draw(ui)+ };+ if let Some(error) = output.error {+ app.ui.status = error.to_string();+ }+ if ui.input(|input| input.pointer.any_released()) {+ if !output.actions.iter().any(|action| matches!(action, Action::Move { .. } | Action::Float { .. })) && cancel_legacy_drag(app, ui.ctx()) {+ return app.ui.docking.is_some();+ }+ ui.ctx().data_mut(|data| data.remove::<LegacyDrag>(egui::Id::new("photocraft-panel-docking").with("legacy-origin")));+ }+ if let Some(panel) = output.group_drag.as_ref()+ && let Some(pointer) = ui.ctx().pointer_interact_pos()+ {+ let members = group_members(&layout, panel);+ let eligible: Vec<_> = targets.iter().filter(|target| !members.contains(&target.anchor)).cloned().collect();+ if let Some(proposal) = craft_ui::docking::resolve_drop(panel, pointer, &eligible) {+ ui.painter().rect_stroke(proposal.preview, 0.0, egui::Stroke::new(2.0, t.accent), egui::StrokeKind::Inside);+ }+ }+ if let Some((panel, pointer)) = output.group_drop {+ let members = group_members(&layout, &panel);+ let eligible: Vec<_> = targets.iter().filter(|target| !members.contains(&target.anchor)).cloned().collect();+ if let Some(proposal) = craft_ui::docking::resolve_drop(&panel, pointer, &eligible) {+ commands.push(("window.panel.group", json!({"panel":panel,"operation":"move","anchor":proposal.anchor,"placement":proposal.placement})));+ }+ }+ for action in output.actions {+ if let Err(error) = app.run("window.panel.layout", json!({"action": action})) {+ app.ui.status = error;+ }+ }+ for (id, params) in commands {+ if let Err(error) = app.run(id, params) {+ app.ui.status = error;+ }+ }+ crate::dock::persist(app, ui.ctx());+ true+}++pub(crate) fn legacy_tab(app: &mut PhotocraftApp, ui: &mut egui::Ui, panel: &str, response: &egui::Response) {- if app.session.prefs().workspace_locked {++ let suppressed = egui::Id::new("photocraft-panel-docking").with("legacy-suppressed");++ if ui.input(|input| input.pointer.button_pressed(egui::PointerButton::Primary)) {++ ui.ctx().data_mut(|data| data.remove::<bool>(suppressed));++ }++ if ui.ctx().data(|data| data.get_temp::<bool>(suppressed)).unwrap_or(false) || app.session.prefs().workspace_locked {+ return;+ }+ let Some(panel) = normalize(panel) else { return };- if response.drag_started()++ // Native tab reordering and vertical whole-group moves stay in the dock.++ // Crossing the dock column horizontally detaches through the shared layout.++ let strip = egui::Rect::from_min_max(egui::pos2(ui.max_rect().left(), response.rect.top()), egui::pos2(ui.max_rect().right(), response.rect.bottom()));++ if response.dragged()++ && ui.input(|input| input.focused && input.pointer.primary_down() && !input.key_pressed(egui::Key::Escape))++ && ui.ctx().pointer_interact_pos().is_some_and(|position| position.x < strip.left() - 24.0 || position.x > strip.right() + 24.0)+ && let Some(id) = normalize(panel)+ {+ let mut layout = app.ui.docking.clone().unwrap_or_else(|| legacy(app));+ let bounds = ui.max_rect();+ let source = egui::Rect::from_min_size(+ egui::pos2(bounds.left(), response.rect.top()),+ egui::vec2(bounds.width().clamp(240.0, 600.0), bounds.height().clamp(200.0, 600.0)),+ );+ if ensure(&mut layout, id).is_ok() && craft_ui::docking::begin_drag(ui.ctx(), egui::Id::new("photocraft-panel-docking"), id.to_string(), source) {+ ui.ctx().data_mut(|data| {+ data.insert_temp(+ egui::Id::new("photocraft-panel-docking").with("legacy-origin"),+ LegacyDrag {+ generation: app.ui.docking_generation,+ layout: app.ui.docking.clone(),+ tabs: app.ui.dock_tabs,+ hidden: app.ui.docking_hidden.clone(),+ },+ )+ });+ if app.ui.docking.is_none() {+ app.ui.docking_hidden = migration_hidden(app, &layout);+ }+ app.ui.docking = Some(layout);+ }+ }+}++fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: &str) {+ let Some((_, label, group)) = PANELS.iter().find(|p| p.0 == id) else { return };+ let pro = crate::theme::Tokens::get(ui.ctx()).pro;+ let Some(tab) = group.tabs(pro).iter().position(|name| name == label) else { return };+ *group.tab_mut(&mut app.ui.dock_tabs) = tab;+ if group.scrolls_itself(tab) {+ crate::panels::dock_body(app, ui, *group, tab);+ } else {+ egui::ScrollArea::vertical()+ .id_salt(("shared-panel-body", id))+ .auto_shrink([false, false])+ .show(ui, |ui| crate::panels::dock_body(app, ui, *group, tab));+ }+ let selected = *group.tab_mut(&mut app.ui.dock_tabs);+ if selected != tab+ && let Some(label) = group.tabs(pro).get(selected)+ {+ let _ = app.run("window.panel.activate", json!({"panel":label}));+ }+}++#[cfg(test)]+#[path = "panel_docking_tests.rs"]+mod tests;++/// Return positions for panels already hidden in a legacy workspace.+fn migration_hidden(app: &PhotocraftApp, visible: &Layout<String>) -> std::collections::BTreeMap<String, craft_ui::docking::Location<String>> {+ let full = legacy_layout(app, true);+ PANELS+ .iter()+ .filter(|(id, _, _)| !visible.contains(&id.to_string()))+ .filter_map(|(id, _, _)| full.location(&id.to_string()).ok().map(|at| ((*id).to_owned(), at)))+ .collect()+}++fn group_members(layout: &Layout<String>, panel: &str) -> Vec<String> {+ let mut pending: Vec<_> = layout.root.iter().collect();+ while let Some(node) = pending.pop() {+ match node {+ Node::Split { first, second, .. } => pending.extend([second.as_ref(), first.as_ref()]),+ Node::Tabs { panels, .. } if panels.iter().any(|id| id == panel) => return panels.clone(),+ Node::Stack { entries } if entries.iter().any(|entry| entry.panel == panel) => return vec![panel.to_owned()],+ _ => {}+ }+ }+ layout.floating.iter().find(|group| group.panels.iter().any(|id| id == panel)).map(|group| group.panels.clone()).unwrap_or_default()+}++fn reveal_group(app: &mut PhotocraftApp, panel: &str) {+ if let Some(layout) = &app.ui.docking {+ let members = group_members(layout, panel);+ app.ui.docking_collapsed.retain(|id| !members.contains(id));+ for id in members {+ if let Some((_, _, group)) = PANELS.iter().find(|p| p.0 == id) {+ app.ui.dock.set_collapsed(*group, false);+ }+ }+ }+}++pub(crate) fn rail_on(app: &PhotocraftApp, group: Group) -> bool {+ app.ui.docking.as_ref().is_some_and(|layout| {+ let collapsed = collapsed_members(app, layout);+ PANELS.iter().filter(|p| p.2 == group).any(|p| layout.contains(&p.0.to_owned()) && !collapsed.contains(p.0))+ })+}++pub(crate) fn rail_click(app: &mut PhotocraftApp, group: Group) {+ let Some(layout) = app.ui.docking.as_ref() else { return };+ let existing = PANELS.iter().find(|p| p.2 == group && layout.contains(&p.0.to_owned())).map(|p| p.0);+ let panel = existing.or_else(|| {+ group+ .tabs(matches!(app.ui.theme, crate::theme::ThemeKind::Pro | crate::theme::ThemeKind::ProMedium))+ .get(*group.tab_mut(&mut app.ui.dock_tabs))+ .and_then(|label| normalize(label))+ });+ if let Some(panel) = panel {+ let result = if existing.is_some() && rail_on(app, group) {+ group_command(app, &json!({"panel": panel, "operation":"collapse"}))+ } else {+ change(app, "activate", &json!({"panel":panel}))+ };+ if let Err(error) = result {+ app.ui.status = error;+ }+ }+}++fn root_groups(layout: &Layout<String>) -> Vec<Vec<String>> {+ let mut out = Vec::new();+ let mut pending: Vec<_> = layout.root.iter().collect();+ while let Some(node) = pending.pop() {+ match node {+ Node::Split { first, second, .. } => pending.extend([second.as_ref(), first.as_ref()]),+ Node::Tabs { panels, .. } => out.push(panels.clone()),+ Node::Stack { entries } => out.extend(entries.iter().map(|e| vec![e.panel.clone()])),+ }+ }+ out+}++fn group_command(app: &mut PhotocraftApp, params: &Value) -> Result<Value, String> {+ let panel = params.get("panel").and_then(Value::as_str).and_then(normalize).ok_or("panel must name a registered panel")?;+ let operation = params.get("operation").and_then(Value::as_str).ok_or("operation is required")?;+ if app.session.prefs().workspace_locked {+ return Err("workspace is locked".into());+ }+ let mut layout = app.ui.docking.clone().unwrap_or_else(|| legacy(app));+ if !valid(&layout) {+ return Err("invalid panel layout".into());+ }+ let members = group_members(&layout, panel);+ if members.is_empty() {+ return Err("panel is hidden".into());+ }+ let mut hidden = if app.ui.docking.is_none() { migration_hidden(app, &layout) } else { app.ui.docking_hidden.clone() };+ let mut collapsed = collapsed_members(app, &layout);+ match operation {+ "close" => {+ for id in &members {+ hidden.insert(id.clone(), layout.location(id).map_err(|e| e.to_string())?);+ layout.apply(Action::Close { panel: id.clone() }).map_err(|e| e.to_string())?;+ }+ collapsed.retain(|id| !members.contains(id));+ }+ "collapse" => {+ collapsed.extend(members.iter().cloned());+ }+ "expand" => {+ collapsed.retain(|id| !members.contains(id));+ }+ "move" => {+ let anchor = params.get("anchor").and_then(Value::as_str).and_then(normalize).ok_or("anchor must name a registered panel")?;+ let placement = params+ .get("placement")+ .map(|v| serde_json::from_value::<Placement<String>>(v.clone()).map_err(|e| e.to_string()))+ .unwrap_or_else(|| placement(params))?;+ if members.iter().any(|id| id == anchor) {+ return Err("group cannot be moved into itself".into());+ }+ let first = members.first().ok_or("group is empty")?;+ layout.apply(Action::Move { panel: first.clone(), anchor: anchor.to_owned(), placement }).map_err(|e| e.to_string())?;+ let destination = group_members(&layout, first);+ let before = destination.iter().position(|id| id == first).and_then(|index| destination.get(index + 1)).cloned();+ for id in members.iter().skip(1) {+ layout+ .apply(Action::Move { panel: id.clone(), anchor: first.clone(), placement: Placement::Tab { before: before.clone() } })+ .map_err(|e| e.to_string())?;+ }+ layout.apply(Action::Activate { panel: panel.to_owned() }).map_err(|e| e.to_string())?;+ }+ "up" | "down" => {+ let groups = root_groups(&layout);+ let index = groups.iter().position(|g| g.contains(&panel.to_owned())).ok_or("floating groups cannot move within the dock")?;+ let neighbor = if operation == "up" { index.checked_sub(1) } else { index.checked_add(1).filter(|i| *i < groups.len()) };+ let anchor = neighbor.and_then(|i| groups.get(i)).and_then(|g| g.first()).ok_or("group is already at the edge")?;+ let first = members.first().ok_or("group is empty")?;+ layout+ .apply(Action::Move {+ panel: first.clone(),+ anchor: anchor.clone(),+ placement: Placement::Split(if operation == "up" { Zone::Top } else { Zone::Bottom }),+ })+ .map_err(|e| e.to_string())?;+ for id in members.iter().skip(1) {+ layout+ .apply(Action::Move { panel: id.clone(), anchor: first.clone(), placement: Placement::Tab { before: None } })+ .map_err(|e| e.to_string())?;+ }+ layout.apply(Action::Activate { panel: panel.to_owned() }).map_err(|e| e.to_string())?;+ }+ _ => return Err("operation must be close, collapse, expand, move, up or down".into()),+ }+ app.ui.docking = Some(layout);+ app.ui.docking_hidden = hidden;+ app.ui.docking_collapsed = collapsed.into_iter().collect();+ sync_visibility(app);+ // Native collapse flags must not re-collapse a custom group after explicit expansion.+ if operation == "expand" || operation == "move" {+ reveal_group(app, panel);+ }+ Ok(json!({"layout":app.ui.docking}))+}++pub(crate) struct LegacyUpdate {+ layout: Layout<String>,+ hidden: std::collections::BTreeMap<String, craft_ui::docking::Location<String>>,+ clear_collapse: Vec<Group>,+}++/// Validate and stage the legacy controls before ui.set commits any fields.+pub(crate) fn prepare_legacy_update(+ app: &PhotocraftApp,+ request: &Value,+ panels: Option<&crate::state::Panels>,+ tabs: Option<&crate::state::DockTabs>,+ dock: Option<&crate::dock::DockLayout>,+ pro: bool,+) -> Result<Option<LegacyUpdate>, String> {+ let Some(current) = &app.ui.docking else { return Ok(None) };+ if panels.is_none() && tabs.is_none() && dock.is_none() {+ return Ok(None);+ }+ if !valid(current) {+ return Err("invalid panel layout; reset the workspace first".into());+ }+ // A legacy flat-column replacement cannot represent arbitrary custom splits. Reject it+ // explicitly instead of accepting a command whose requested order/height is ignored.+ if let Some(dock) = dock+ && (dock.order != app.ui.dock.order || dock.heights != app.ui.dock.heights)+ {+ return Err("dock order/heights cannot replace a customized layout; use window.panel.layout".into());+ }+ if app.session.prefs().workspace_locked {+ return Err("workspace is locked".into());+ }+ let clear_collapse: Vec<_> =+ dock.map(|d| Group::ALL.into_iter().filter(|g| d.is_collapsed(*g) != app.ui.dock.is_collapsed(*g)).collect()).unwrap_or_default();+ if !clear_collapse.is_empty()+ && root_groups(current).iter().any(|ids| {+ let groups: std::collections::HashSet<_> = ids.iter().filter_map(|id| PANELS.iter().find(|p| p.0 == id).map(|p| p.2)).collect();+ groups.len() > 1+ })+ {+ return Err("legacy collapse settings cannot replace mixed custom groups; use window.panel.group".into());+ }+ let mut layout = current.clone();+ let mut hidden = app.ui.docking_hidden.clone();+ for group in Group::ALL {+ let visibility = request.get("panels").and_then(|p| p.get(group.key())).and_then(Value::as_bool);+ let selected = request.get("dockTabs").and_then(|p| p.get(group.key())).is_some();+ let group_panels: Vec<_> = PANELS.iter().filter(|p| p.2 == group).collect();+ for &&(id, label, _) in &group_panels {+ let explicitly_hidden = dock.is_some_and(|d| d.hidden_tabs.get(&group).is_some_and(|names| names.iter().any(|name| name == label)));+ let explicitly_shown = dock.is_some() && !explicitly_hidden;+ if visibility == Some(false) || explicitly_hidden {+ if layout.contains(&id.to_owned()) {+ hidden.insert(id.to_owned(), layout.location(&id.to_owned()).map_err(|e| e.to_string())?);+ layout.apply(Action::Close { panel: id.to_owned() }).map_err(|e| e.to_string())?;+ }+ } else if (visibility == Some(true) || explicitly_shown) && !layout.contains(&id.to_owned()) {+ if hidden.contains_key(id) {+ restore_hidden(&mut layout, &mut hidden, id);+ }+ ensure(&mut layout, id)?;+ }+ }+ if selected {+ let tabs = tabs.ok_or("dockTabs is missing")?;+ let index = match group {+ Group::Color => tabs.color,+ Group::Properties => tabs.properties,+ Group::Character => tabs.character,+ Group::Navigator => tabs.navigator,+ Group::History => tabs.history,+ Group::Layers => tabs.layers,+ };+ let id = group.tabs(pro).get(index).and_then(|label| normalize(label)).ok_or("dockTabs index is outside the panel group")?;+ if visibility == Some(false) {+ return Err("cannot select a tab in a hidden group".into());+ }+ if !layout.contains(&id.to_owned()) {+ if hidden.contains_key(id) {+ restore_hidden(&mut layout, &mut hidden, id);+ }+ ensure(&mut layout, id)?;+ }+ layout.apply(Action::Activate { panel: id.to_owned() }).map_err(|e| e.to_string())?;+ }+ }+ Ok(Some(LegacyUpdate { layout, hidden, clear_collapse }))+}++pub(crate) fn commit_legacy_update(app: &mut PhotocraftApp, update: LegacyUpdate, request: &Value) {+ for group in update.clear_collapse {+ let ids: Vec<_> = PANELS.iter().filter(|p| p.2 == group).map(|p| p.0).collect();+ app.ui.docking_collapsed.retain(|id| !ids.contains(&id.as_str()));+ }+ app.ui.docking = Some(update.layout);+ app.ui.docking_hidden = update.hidden;+ sync_visibility(app);+ for group in Group::ALL {+ if request.get("dockTabs").and_then(|p| p.get(group.key())).is_some()+ || request.get("panels").and_then(|p| p.get(group.key())).and_then(Value::as_bool) == Some(true)+ {+ let ids: Vec<_> = PANELS.iter().filter(|p| p.2 == group).map(|p| p.0).collect();+ app.ui.docking_collapsed.retain(|id| !ids.contains(&id.as_str()));+ app.ui.dock.set_collapsed(group, false);+ }+ }+}++struct PanelContent<'a> {+ app: &'a mut PhotocraftApp,+ collapsed: &'a std::collections::HashSet<String>,+ commands: &'a mut Vec<(&'static str, Value)>,+ targets: &'a mut Vec<craft_ui::docking::DropTarget<String>>,+}++fn panel_menu(app: &mut PhotocraftApp, ui: &mut egui::Ui, panel: &str) {+ match panel {+ "layers" => {+ crate::layer_row_ui::panel_menu(app, ui);+ ui.separator();+ }+ "swatches" => {+ crate::swatches_ui::panel_menu(app, ui);+ ui.separator();+ }+ _ => {}+ }+}++impl craft_ui::docking::DockContent<String> for PanelContent<'_> {+ fn body(&mut self, ui: &mut egui::Ui, id: &String) {+ if let Some(target) = self.targets.iter_mut().find(|target| target.anchor == *id) {+ target.rect = target.rect.union(ui.max_rect());+ if let Some(strip) = target.tab_strip.as_mut() {+ strip.min.x = target.rect.left();+ strip.max.x = target.rect.right();+ }+ let members = self.app.ui.docking.as_ref().map(|layout| group_members(layout, id)).unwrap_or_default();+ target.tabs = members+ .into_iter()+ .filter_map(|panel| {+ ui.ctx().read_response(egui::Id::new("photocraft-panel-docking").with(("tab", &panel))).map(|response| (panel, response.rect))+ })+ .collect();+ }+ if !self.collapsed.contains(id) {+ egui::Frame::NONE.inner_margin(egui::Margin::same(8)).show(ui, |ui| body(self.app, ui, id));+ }+ }+ fn panel_menu(&mut self, ui: &mut egui::Ui, id: &String) {+ panel_menu(self.app, ui, id);+ }+ fn group_header_width(&self, _panels: &[String], _active: &String, _floating: bool) -> f32 {+ 28.0+ }+ fn group_header(&mut self, ui: &mut egui::Ui, panels: &[String], active: &String, floating: bool) {+ if !floating {+ let rect = ui.max_rect();+ self.targets.push(craft_ui::docking::DropTarget {+ anchor: active.clone(),+ rect,+ tab_strip: Some(rect),+ tabs: Vec::new(),+ allow_splits: true,+ accepts_tabs: !self.app.session.prefs().workspace_locked,+ });+ }+ let collapsed = panels.iter().all(|id| self.collapsed.contains(id));+ let locked = self.app.session.prefs().workspace_locked;+ let resp = crate::icons::button(ui, "ellipsis", ui.available_height().min(28.0), false, tl!("Panel menu"));+ egui::Popup::menu(&resp).show(|ui| {+ ui.set_min_width(180.0);+ panel_menu(self.app, ui, active);+ if ui.add_enabled(!locked, egui::Button::new(if collapsed { tl!("Expand Panel Group") } else { tl!("Collapse Panel Group") })).clicked() {+ self.commands.push(("window.panel.group", json!({"panel":active,"operation":if collapsed {"expand"} else {"collapse"}})));+ ui.close();+ }+ if !floating {+ let groups = self.app.ui.docking.as_ref().map(root_groups).unwrap_or_default();+ let index = groups.iter().position(|g| g.contains(active));+ for (operation, label, enabled) in+ [("up", tl!("Move Group Up"), index.is_some_and(|i| i > 0)), ("down", tl!("Move Group Down"), index.is_some_and(|i| i + 1 < groups.len()))]+ {+ if ui.add_enabled(!locked && enabled, egui::Button::new(label)).clicked() {+ self.commands.push(("window.panel.group", json!({"panel":active,"operation":operation})));+ ui.close();+ }+ }+ }+ ui.separator();+ if ui.add_enabled(!locked, egui::Button::new(tl!("Close Tab Group"))).clicked() {+ self.commands.push(("window.panel.group", json!({"panel":active,"operation":"close"})));+ ui.close();+ }+ });+ }+}++pub(crate) fn sync_visibility(app: &mut PhotocraftApp) {+ if let Some(layout) = &app.ui.docking {+ if !valid(layout) {+ return;+ }+ let pro = matches!(app.ui.theme, crate::theme::ThemeKind::Pro | crate::theme::ThemeKind::ProMedium);+ for group in Group::ALL {+ *group.shown_mut(&mut app.ui.panels) = PANELS.iter().filter(|p| p.2 == group).any(|p| layout.contains(&p.0.to_owned()));+ for (index, label) in group.tabs(pro).iter().enumerate() {+ if let Some(id) = normalize(label) {+ if layout.contains(&id.to_owned()) {+ app.ui.dock.show_tab(group, index, pro);+ } else {+ app.ui.dock.hide_tab(group, index, pro);+ }+ }+ }+ let previous = *group.tab_mut(&mut app.ui.dock_tabs);+ if !group.tabs(pro).get(previous).and_then(|name| normalize(name)).is_some_and(|id| panel_active(layout, id))+ && let Some(selected) = group.tabs(pro).iter().position(|name| normalize(name).is_some_and(|id| panel_active(layout, id)))+ {+ *group.tab_mut(&mut app.ui.dock_tabs) = selected;+ }+ }+ }+}++fn panel_active(layout: &Layout<String>, panel: &str) -> bool {+ let mut pending: Vec<_> = layout.root.iter().collect();+ while let Some(node) = pending.pop() {+ match node {+ Node::Split { first, second, .. } => pending.extend([first.as_ref(), second.as_ref()]),+ Node::Tabs { panels, active } if panels.iter().any(|p| p == panel) => return panels.get(*active).is_some_and(|p| p == panel),+ Node::Stack { entries } if entries.iter().any(|e| e.panel == panel) => return true,+ _ => {}+ }+ }+ layout.floating.iter().any(|g| g.panels.get(g.active).is_some_and(|p| p == panel))+}++/// Extra legacy menu choices use the same commands as the customized renderer.+pub(crate) fn legacy_menu(app: &mut PhotocraftApp, ui: &mut egui::Ui, label: &str) {+ let Some(panel) = normalize(label) else { return };+ let locked = app.session.prefs().workspace_locked;+ ui.add_enabled_ui(!locked, |ui| {+ if ui.button(tl!("Float Panel")).clicked() {+ if let Err(error) = app.run("window.panel.float", json!({"panel":panel})) {+ app.ui.status = error;+ }+ ui.close();+ }+ ui.menu_button(tl!("Group with"), |ui| {+ for &(anchor, label, _) in PANELS {+ if anchor != panel && ui.button(tl!(label)).clicked() {+ let result = app+ .run("window.panel.activate", json!({"panel":anchor}))+ .and_then(|_| app.run("window.panel.move", json!({"panel":panel,"anchor":anchor})));+ if let Err(error) = result {+ app.ui.status = error;+ }+ ui.close();+ }+ }+ });+ });+}++// A closed group forms a bounded chain of hidden tab neighbors. Restore just the requested+// panel at the first surviving return position, then let the remaining tabs rejoin it.+fn restore_hidden(layout: &mut Layout<String>, hidden: &mut std::collections::BTreeMap<String, craft_ui::docking::Location<String>>, panel: &str) {+ let Some(mut at) = hidden.get(panel).cloned() else { return };+ let mut terminal = panel.to_owned();+ let mut seen = vec![terminal.clone()];+ while let Some(anchor) = at.anchor.as_ref().filter(|id| !layout.contains(id)).cloned() {+ if seen.len() >= PANELS.len() || seen.contains(&anchor) {+ return;+ }+ let Some(next) = hidden.get(&anchor).cloned() else { return };+ seen.push(anchor.clone());+ terminal = anchor;+ at = next;+ }+ if layout.restore(panel.to_owned(), &at).is_ok()+ && terminal != panel+ && let Some(last) = hidden.get_mut(&terminal)+ {+ last.anchor = Some(panel.to_owned());+ last.placement = Placement::Tab { before: None };+ last.size = None;+ last.sibling.clear();+ }+}diff --cc crates/ui-egui/src/panel_docking_tests.rsindex 2d2436ccb,000000000..6980a8a93mode 100644,000000..100644--- a/crates/ui-egui/src/panel_docking_tests.rs+++ b/crates/ui-egui/src/panel_docking_tests.rs@@@ -1,628 -1,0 +1,661 @@@+use super::*;+use egui::{Event, Modifiers, PointerButton, Pos2, vec2};+use egui_kittest::{Harness, kittest::Queryable};++fn app() -> PhotocraftApp {+ PhotocraftApp::new(photocraft_engine::Session::new(), Default::default())+}++#[test]+fn panel_commands_group_split_reorder_float_and_restore_without_duplicate_ownership() {+ let mut app = app();+ app.run("window.panel.move", json!({"panel":"swatches", "anchor":"layers", "zone":"top"})).unwrap();+ app.run("window.panel.move", json!({"panel":"properties", "anchor":"swatches", "before":"swatches"})).unwrap();+ let before_float = app.ui.docking.clone().unwrap();+ app.run("window.panel.float", json!({"panel":"properties", "x":50,"y":70,"width":330,"height":410})).unwrap();+ assert!(app.ui.docking.as_ref().unwrap().floating.iter().any(|g| g.panels == ["properties"]));+ app.run("window.panel.dock", json!({"panel":"properties"})).unwrap();+ assert_eq!(app.ui.docking.as_ref().unwrap(), &before_float);+ app.run("window.panel.close", json!({"panel":"properties"})).unwrap();+ assert!(!app.ui.docking.as_ref().unwrap().contains(&"properties".into()));+ app.run("window.panel.activate", json!({"panel":"properties"})).unwrap();+ assert_eq!(app.ui.docking.as_ref().unwrap(), &before_float);+ let layout = app.ui.docking.as_ref().unwrap();+ assert!(valid(layout));+ let unique: std::collections::HashSet<_> = layout.panels().into_iter().collect();+ assert_eq!(unique.len(), layout.panels().len());+ let saved = serde_json::to_value(&app.ui).unwrap();+ let restored: crate::state::UiState = serde_json::from_value(saved).unwrap();+ assert_eq!(restored.docking, app.ui.docking);+ assert_eq!(restored.docking_hidden, app.ui.docking_hidden);+}++#[test]+fn invalid_panel_requests_are_atomic_and_do_not_enter_a_custom_workspace() {+ let mut app = app();+ for (id, params) in [+ ("window.panel.move", json!({"panel":"layers","anchor":"unknown"})),+ ("window.panel.move", json!({"panel":"layers","anchor":"properties","before":"unknown"})),+ ("window.panel.move", json!({"panel":"layers","anchor":"properties","zone":42})),+ ("window.panel.float", json!({"panel":"layers","width":-10})),+ ("window.panel.float", json!({"panel":"unknown"})),+ ("window.panel.float", json!({"panel":"layers","x":"invalid"})),+ ] {+ let old = app.ui.docking.clone();+ let hidden = app.ui.docking_hidden.clone();+ assert!(app.run(id, params).is_err(), "{id}");+ assert_eq!(app.ui.docking, old);+ assert_eq!(app.ui.docking_hidden, hidden);+ }+}++fn harness(app: PhotocraftApp, size: egui::Vec2) -> Harness<'static, PhotocraftApp> {+ let mut ready = false;+ let mut harness = Harness::builder().with_size(size).with_step_dt(1.0 / 60.0).build_ui_state(+ move |ui, app: &mut PhotocraftApp| {+ if !ready {+ PhotocraftApp::setup_context(ui.ctx(), crate::theme::ThemeKind::ProMedium);+ ready = true;+ return;+ }+ crate::panels::right_dock(app, ui);+ egui::CentralPanel::default().show(ui, |_| {});+ },+ app,+ );+ harness.run_steps(4);+ harness+}++fn drag(h: &mut Harness<'static, PhotocraftApp>, from: Pos2, to: Pos2) {+ h.event(Event::PointerMoved(from));+ h.run_steps(1);+ h.event(Event::PointerButton { pos: from, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });+ h.run_steps(1);+ for step in 1..=8 {+ h.event(Event::PointerMoved(from + (to - from) * (step as f32 / 8.0)));+ h.run_steps(1);+ }+ h.event(Event::PointerButton { pos: to, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });+ h.run_steps(3);+}++#[test]+fn ordinary_panel_tab_drag_enters_shared_docking_and_can_redock_into_another_tab_group() {+ let mut h = harness(app(), vec2(1280.0, 800.0));+ let source = h.query_all_by_label("Layers").find(|node| node.rect().height() <= 45.0).unwrap().rect().center();+ drag(&mut h, source, egui::pos2(160.0, 140.0));+ let layout = h.state().ui.docking.as_ref().expect("ordinary tab drag starts shared docking");+ assert!(layout.floating.iter().any(|g| g.panels.contains(&"layers".into())), "{layout:?}");+ let source = h.ctx.read_response(egui::Id::new("photocraft-panel-docking").with(("tab", &"layers".to_string()))).unwrap().rect.center();+ let destination = h.ctx.read_response(egui::Id::new("photocraft-panel-docking").with(("tab", &"properties".to_string()))).unwrap().rect.center();+ drag(&mut h, source, destination);+ let layout = h.state().ui.docking.as_ref().unwrap();+ assert!(!layout.floating.iter().any(|g| g.panels.contains(&"layers".into())));+ assert!(valid(layout));+}++#[test]+fn saved_workspace_restores_the_custom_tree_and_hidden_panel_placement() {+ let mut app = app();+ let ctx = egui::Context::default();+ app.run("window.panel.move", json!({"panel":"swatches","anchor":"layers","zone":"top"})).unwrap();+ app.run("window.panel.float", json!({"panel":"properties","x":50,"y":80})).unwrap();+ app.run("window.panel.close", json!({"panel":"swatches"})).unwrap();+ let layout = app.ui.docking.clone();+ let hidden = app.ui.docking_hidden.clone();+ crate::menus::invoke(&mut app, &ctx, "window.workspace.newWorkspace", json!({"name":"Custom docking"})).unwrap();+ crate::menus::invoke(&mut app, &ctx, "window.workspace.essentials", json!({})).unwrap();+ assert!(app.ui.docking.is_none());+ crate::menus::invoke(&mut app, &ctx, "window.workspace.select", json!({"name":"Custom docking"})).unwrap();+ assert_eq!(app.ui.docking, layout);+ assert_eq!(app.ui.docking_hidden, hidden);+}++#[test]+fn shared_layout_keeps_panel_identity_across_themes_and_respects_workspace_lock() {+ let mut app = app();+ app.run("window.panel.move", json!({"panel":"color","anchor":"layers"})).unwrap();+ let layout = app.ui.docking.clone();+ app.ui.theme = crate::theme::ThemeKind::Studio;+ assert_eq!(app.ui.docking, layout);+ app.session.prefs.edit(|prefs| prefs.workspace_locked = true);+ assert!(app.run("window.panel.float", json!({"panel":"color"})).is_err());+ assert_eq!(app.ui.docking, layout);+ assert!(app.run("window.panel.activate", json!({"panel":"color"})).is_ok());+}++/// Explicit offscreen evidence; this creates no native windows.+#[test]+fn capture_custom_panel_docking_visual_fixtures() {+ let Some(directory) = std::env::var_os("CRAFT_UI_DOCKING_FIXTURES").map(std::path::PathBuf::from) else { return };+ std::fs::create_dir_all(&directory).unwrap();+ for theme in crate::theme::ThemeKind::ALL {+ for width in [800.0, 1280.0] {+ for scale in [1.0, 1.5, 2.0] {+ let mut app = app();+ app.run("file.new", json!({})).unwrap();+ app.run("window.panel.move", json!({"panel":"swatches", "anchor":"layers", "zone":"top"})).unwrap();+ app.run("window.panel.float", json!({"panel":"properties","x":30,"y":90,"width":300,"height":440})).unwrap();+ let mut ready = false;+ let mut harness = Harness::builder().with_size(vec2(width, 800.0)).with_pixels_per_point(scale).wgpu().build_ui_state(+ move |ui, app: &mut PhotocraftApp| {+ if !ready {+ PhotocraftApp::setup_context(ui.ctx(), theme);+ app.ui.theme = theme;+ ready = true;+ return;+ }+ crate::panels::right_dock(app, ui);+ egui::CentralPanel::default().show(ui, |ui| {+ ui.label("Custom panel workspace");+ });+ },+ app,+ );+ harness.input_mut().max_texture_side = Some(8192);+ harness.run_steps(5);+ assert!(valid(harness.state().ui.docking.as_ref().unwrap()));+ harness.render().unwrap().save(directory.join(format!("photocraft-shared-docking-{}-{width}-{scale}x.png", theme.id()))).unwrap();+ }+ }+ }+}++#[test]+fn escape_cancels_the_first_drag_without_replacing_the_legacy_workspace() {+ let mut h = harness(app(), vec2(1280.0, 800.0));+ let source = h.query_all_by_label("Layers").find(|node| node.rect().height() <= 45.0).unwrap().rect().center();+ h.event(Event::PointerMoved(source));+ h.run_steps(1);+ h.event(Event::PointerButton { pos: source, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });+ h.run_steps(1);+ h.event(Event::PointerMoved(source - vec2(90.0, 0.0)));+ h.run_steps(2);+ assert!(h.state().ui.docking.is_some());+ h.event(Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE });+ h.run_steps(1);+ assert!(h.state().ui.docking.is_none());+ h.event(Event::PointerButton { pos: source, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });+ h.run_steps(2);+ assert!(h.state().ui.docking.is_none());+}++#[test]+fn serialized_layout_actions_cover_geometry_reorder_accordion_and_atomic_rejection() {+ let mut app = app();+ app.run("window.panel.move", json!({"panel":"swatches","anchor":"layers","zone":"top"})).unwrap();+ app.run("window.panel.layout", json!({"action":{"ResizeSplit":{"path":[],"size":{"Ratio":0.35}}}})).unwrap();+ assert!(+ matches!(app.ui.docking.as_ref().unwrap().root, Some(Node::Split { size: craft_ui::layout::SplitSize::Ratio(value), .. }) if (value - 0.35).abs() < 0.001)+ );+ app.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ app.run("window.panel.layout", json!({"action":{"MoveFloating":{"panel":"properties","rect":[44,66,360,450]}}})).unwrap();+ assert_eq!(+ app.ui.docking.as_ref().unwrap().floating.iter().find(|group| group.panels.iter().any(|p| p == "properties")).unwrap().rect,+ [44.0, 66.0, 360.0, 450.0]+ );+ app.run("window.panel.layout", json!({"action":{"Move":{"panel":"properties","anchor":"swatches","placement":{"Tab":{"before":"swatches"}}}}})).unwrap();+ assert_eq!(group_members_for_test(app.ui.docking.as_ref().unwrap(), "swatches"), ["properties", "swatches"]);+ let before = app.ui.docking.clone();+ let hidden = app.ui.docking_hidden.clone();+ for action in [+ json!({"MoveFloating":{"panel":"properties","rect":[0,0,-5,30]}}),+ json!({"ResizeSplit":{"path":[true,true,true],"size":{"Ratio":0.2}}}),+ json!({"Open":{"panel":"unknown","anchor":null}}),+ json!({"Move":{"panel":"properties","anchor":"swatches","placement":{"Tab":{"before":"unknown"}}}}),+ ] {+ assert!(app.run("window.panel.layout", json!({"action":action})).is_err());+ assert_eq!(app.ui.docking, before);+ assert_eq!(app.ui.docking_hidden, hidden);+ }+ app.ui.docking = Some(Layout {+ root: Some(Node::Stack { entries: vec![craft_ui::docking::StackEntry { panel: "layers".into(), open: true, height: Some(100.0) }] }),+ floating: Vec::new(),+ });+ app.run("window.panel.layout", json!({"action":{"SetStackOpen":{"panel":"layers","open":false}}})).unwrap();+ app.run("window.panel.layout", json!({"action":{"ResizeStack":{"panel":"layers","height":150}}})).unwrap();+ let Some(Node::Stack { entries }) = &app.ui.docking.as_ref().unwrap().root else { panic!("expected stack") };+ assert!(!entries[0].open);+ assert_eq!(entries[0].height, Some(150.0));+}++fn group_members_for_test(layout: &Layout<String>, panel: &str) -> Vec<String> {+ let mut pending: Vec<_> = layout.root.iter().collect();+ while let Some(node) = pending.pop() {+ match node {+ Node::Tabs { panels, .. } if panels.iter().any(|p| p == panel) => return panels.clone(),+ Node::Split { first, second, .. } => pending.extend([first.as_ref(), second.as_ref()]),+ _ => {}+ }+ }+ Vec::new()+}++#[test]+fn customization_retains_native_collapsed_groups_until_their_tab_is_activated() {+ let mut app = app();+ app.ui.dock.set_collapsed(Group::Color, true);+ app.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ let layout = app.ui.docking.as_ref().unwrap();+ assert!(collapsed_members(&app, layout).contains("swatches"));+ let saved = serde_json::to_value(&app.ui).unwrap();+ let restored: crate::state::UiState = serde_json::from_value(saved).unwrap();+ assert!(restored.dock.is_collapsed(Group::Color));+ app.run("window.panel.layout", json!({"action":{"Activate":{"panel":"swatches"}}})).unwrap();+ assert!(!app.ui.dock.is_collapsed(Group::Color));+}++#[test]+fn splitting_a_short_column_keeps_the_layers_footer_visible_and_usable() {+ let mut app = app();+ app.run("file.new", json!({"width":480,"height":360})).unwrap();+ app.run("window.panel.move", json!({"panel":"swatches","anchor":"layers","zone":"top"})).unwrap();+ app.run("window.panel.float", json!({"panel":"properties","x":30,"y":90,"width":300,"height":440})).unwrap();+ let mut h = harness(app, vec2(800.0, 800.0));+ let button = h.get_by_label("Create a new layer").rect();+ assert!(button.bottom() <= 800.0, "Layers footer is clipped below the viewport: {button:?}");+ let before = h.state().session.active().unwrap().doc.layers.len();+ let at = button.center();+ h.hover_at(at);+ h.run_steps(1);+ for pressed in [true, false] {+ h.event(Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE });+ h.run_steps(1);+ }+ assert_eq!(h.state().session.active().unwrap().doc.layers.len(), before + 1);+}++#[test]+fn populated_canvas_keeps_a_real_opacity_edit_after_floating_and_redocking() {+ let mut app = app();+ app.ui.theme = crate::theme::ThemeKind::Studio;+ app.run("file.new", json!({"width":480,"height":360})).unwrap();+ app.run("layer.new.layer", json!({"name":"Docking sample"})).unwrap();+ app.run("select.rect", json!({"x":80,"y":70,"width":250,"height":160})).unwrap();+ app.run("edit.fill", json!({"color":"#5297bb"})).unwrap();+ app.run("select.deselect", json!({})).unwrap();+ let layer = app.session.active().unwrap().active_layer.unwrap();+ app.run("window.panel.float", json!({"panel":"properties","x":40,"y":140,"width":310,"height":490})).unwrap();+ let directory = std::env::var_os("CRAFT_UI_DOCKING_FIXTURES").map(std::path::PathBuf::from);+ let builder = Harness::builder().with_size(vec2(1280.0, 800.0));+ let builder = if directory.is_some() { builder.wgpu() } else { builder };+ let mut ready = false;+ let mut h = builder.build_ui_state(+ move |ui, app: &mut PhotocraftApp| {+ if !ready {+ PhotocraftApp::setup_context(ui.ctx(), crate::theme::ThemeKind::Studio);+ ready = true;+ return;+ }+ crate::panels::title_bar(app, ui);+ crate::panels::options_bar(app, ui);+ crate::panels::toolbar(app, ui);+ crate::panels::right_dock(app, ui);+ egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));+ },+ app,+ );+ h.input_mut().max_texture_side = Some(8192);+ h.run_steps(5);+ let floating = h.ctx.memory(|m| m.area_rect(egui::Id::new("photocraft-panel-docking").with(("floating", &"properties".to_string())))).unwrap();+ let mut sliders: Vec<_> = h.ctx.viewport(|vp| {+ vp.prev_pass+ .widgets+ .layers()+ .flat_map(|(_, widgets)| widgets.iter())+ .filter(|widget| widget.sense.senses_drag() && widget.rect.height() == 18.0 && floating.contains_rect(widget.rect))+ .map(|widget| widget.rect)+ .collect()+ });+ sliders.sort_by(|a, b| a.top().total_cmp(&b.top()));+ let at = sliders.first().expect("Properties opacity slider").center();+ h.hover_at(at);+ h.run_steps(1);+ for pressed in [true, false] {+ h.event(Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE });+ h.run_steps(1);+ }+ h.run_steps(2);+ let opacity = h.state().session.active().unwrap().doc.layer(layer).unwrap().opacity;+ assert!((opacity - 0.5).abs() < 0.03, "actual opacity {opacity}");+ if let Some(directory) = &directory {+ std::fs::create_dir_all(directory).unwrap();+ h.render().unwrap().save(directory.join("photocraft-populated-opacity-floating.png")).unwrap();+ }+ let from = h.ctx.read_response(egui::Id::new("photocraft-panel-docking").with(("tab", &"properties".to_string()))).unwrap().rect.center();+ let to = h.ctx.read_response(egui::Id::new("photocraft-panel-docking").with(("tab", &"layers".to_string()))).unwrap().rect.center();+ drag(&mut h, from, to);+ assert!(h.state().ui.docking.as_ref().unwrap().floating.iter().all(|group| !group.panels.iter().any(|panel| panel == "properties")));+ assert_eq!(h.state().session.active().unwrap().doc.layer(layer).unwrap().opacity, opacity);+ if let Some(directory) = &directory {+ h.render().unwrap().save(directory.join("photocraft-populated-opacity-redocked.png")).unwrap();+ }+}++#[test]+fn changing_workspace_during_a_drag_cancels_the_stale_gesture() {+ let mut app = app();+ app.run("window.panel.move", json!({"panel":"swatches","anchor":"layers","zone":"top"})).unwrap();+ let destination = app.ui.docking.clone();+ let ctx = egui::Context::default();+ crate::menus::invoke(&mut app, &ctx, "window.workspace.newWorkspace", json!({"name":"Destination"})).unwrap();+ crate::menus::invoke(&mut app, &ctx, "window.workspace.essentials", json!({})).unwrap();+ let mut h = harness(app, vec2(1280.0, 800.0));+ let source = h.query_all_by_label("Layers").find(|node| node.rect().height() <= 45.0).unwrap().rect().center();+ h.event(Event::PointerMoved(source));+ h.run_steps(1);+ h.event(Event::PointerButton { pos: source, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });+ h.run_steps(1);+ h.event(Event::PointerMoved(source - vec2(90.0, 0.0)));+ h.run_steps(2);+ let ctx = h.ctx.clone();+ crate::menus::invoke(h.state_mut(), &ctx, "window.workspace.select", json!({"name":"Destination"})).unwrap();+ h.event(Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE });+ h.run_steps(1);+ assert_eq!(h.state().ui.docking, destination);+ h.event(Event::PointerButton { pos: source, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });+ h.run_steps(2);+ assert_eq!(h.state().ui.docking, destination);+}++#[test]+fn first_legacy_drag_workspace_switch_preserves_custom_and_legacy_destinations() {+ let layout_state = |app: &PhotocraftApp| json!({"panels":app.ui.panels,"dock":app.ui.dock,"tabs":app.ui.dock_tabs,"layout":app.ui.docking,"hidden":app.ui.docking_hidden,"collapsed":app.ui.docking_collapsed,"timeline":app.ui.timeline.open});+ for customized_destination in [true, false] {+ for cancellation in ["release", "escape", "focus-loss"] {+ let mut app = app();+ let ctx = egui::Context::default();+ if customized_destination {+ app.run("window.panel.move", json!({"panel":"swatches","anchor":"layers","zone":"top"})).unwrap();+ crate::menus::invoke(&mut app, &ctx, "window.workspace.newWorkspace", json!({"name":"Destination"})).unwrap();+ crate::menus::invoke(&mut app, &ctx, "window.workspace.essentials", json!({})).unwrap();+ }+ let mut h = harness(app, vec2(1280.0, 800.0));+ let source = h.query_all_by_label("Layers").find(|node| node.rect().height() <= 45.0).unwrap().rect().center();+ h.event(Event::PointerMoved(source));+ h.run_steps(1);+ h.event(Event::PointerButton { pos: source, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });+ h.run_steps(1);+ h.event(Event::PointerMoved(source - vec2(90.0, 0.0)));+ // One frame installs the first legacy drag; no shared dock has rendered yet.+ h.run_steps(1);+ assert!(h.state().ui.docking.is_some());+ let origin = egui::Id::new("photocraft-panel-docking").with("legacy-origin");+ assert!(h.ctx.data_mut(|data| data.get_temp::<LegacyDrag>(origin)).unwrap().layout.is_none());+ let ctx = h.ctx.clone();+ let command = if customized_destination { "window.workspace.select" } else { "window.workspace.painting" };+ crate::menus::invoke(h.state_mut(), &ctx, command, json!({"name":"Destination"})).unwrap();+ assert_eq!(h.state().ui.docking.is_some(), customized_destination);+ let destination = layout_state(h.state());+ let tabs = serde_json::to_value(h.state().ui.dock_tabs).unwrap();+ match cancellation {+ "escape" => h.event(Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }),+ "focus-loss" => h.event(Event::WindowFocused(false)),+ _ => {+ h.event(Event::PointerButton { pos: source - vec2(90.0, 0.0), button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE })+ }+ }+ h.run_steps(1);+ assert_eq!(layout_state(h.state()), destination, "{customized_destination}/{cancellation}");++ if cancellation == "focus-loss" {++ let at = source - vec2(90.0, 0.0);++ h.event(Event::PointerButton { pos: at, button: PointerButton::Secondary, pressed: true, modifiers: Modifiers::NONE });++ h.run_steps(1);++ assert_eq!(layout_state(h.state()), destination, "secondary press must not resume the stale primary drag");++ h.event(Event::PointerButton { pos: at, button: PointerButton::Secondary, pressed: false, modifiers: Modifiers::NONE });++ h.run_steps(1);++ }+ assert_eq!(serde_json::to_value(h.state().ui.dock_tabs).unwrap(), tabs);+ assert!(h.ctx.data_mut(|data| data.get_temp::<LegacyDrag>(origin)).is_none(), "stale origin: {customized_destination}/{cancellation}");+ h.event(Event::WindowFocused(true));+ h.event(Event::PointerButton { pos: source, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });+ h.run_steps(2);+ assert_eq!(layout_state(h.state()), destination);+ }+ }+}++fn control_set(app: &mut PhotocraftApp, ctx: &egui::Context, params: Value) -> Value {+ let (request, _) = crate::control::ControlRequest::new("ui.set", params);+ match crate::control::handle(app, ctx, &request) {+ crate::control::Outcome::Done(value) => value,+ _ => panic!("ui.set must reply synchronously"),+ }+}++#[test]+fn current_main_hidden_tabs_migrate_by_name_and_selected_identity() {+ for theme in [crate::theme::ThemeKind::ProMedium, crate::theme::ThemeKind::Studio] {+ let mut app = app();+ app.ui.theme = theme;+ let pro = matches!(theme, crate::theme::ThemeKind::Pro | crate::theme::ThemeKind::ProMedium);+ let color = Group::Color.tabs(pro).iter().position(|name| *name == "Color").unwrap();+ let swatches = Group::Color.tabs(pro).iter().position(|name| *name == "Swatches").unwrap();+ app.ui.dock.hide_tab(Group::Color, swatches, pro);+ app.ui.dock.hide_tab(Group::Layers, 2, pro);+ app.ui.dock_tabs.color = color;+ let saved = json!({"panels":app.ui.panels,"dock":app.ui.dock,"dockTabs":app.ui.dock_tabs});+ assert_eq!(saved["dock"]["hidden_tabs"]["layers"], json!(["Paths"]));+ let mut restored = self::app();+ restored.ui.theme = theme;+ crate::dock::apply(&mut restored, &saved);+ restored.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ let layout = restored.ui.docking.as_ref().unwrap();+ assert!(!layout.contains(&"swatches".into()) && !layout.contains(&"paths".into()));+ assert!(panel_active(layout, "color"));+ assert!(restored.ui.docking_hidden.contains_key("swatches") && restored.ui.docking_hidden.contains_key("paths"));+ restored.run("window.panel.swatches", json!({"show":true})).unwrap();+ assert!(panel_active(restored.ui.docking.as_ref().unwrap(), "swatches"));+ }+}++#[test]+fn legacy_control_updates_authoritative_custom_visibility_and_selection_atomically() {+ let mut app = app();+ app.ui.theme = crate::theme::ThemeKind::ProMedium;+ app.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ let ctx = egui::Context::default();+ assert_eq!(control_set(&mut app, &ctx, json!({"dockTabs":{"layers":1}}))["ok"], true);+ assert!(panel_active(app.ui.docking.as_ref().unwrap(), "channels"));+ assert_eq!(control_set(&mut app, &ctx, json!({"panels":{"layers":false}}))["ok"], true);+ assert!(PANELS.iter().filter(|p| p.2 == Group::Layers).all(|p| !app.ui.docking.as_ref().unwrap().contains(&p.0.into())));+ assert!(!app.ui.panels.layers);+ assert_eq!(control_set(&mut app, &ctx, json!({"panels":{"layers":true},"dockTabs":{"layers":2}}))["ok"], true);+ assert!(panel_active(app.ui.docking.as_ref().unwrap(), "paths"));+ let before = serde_json::to_value(&app.ui).unwrap();+ for request in [+ json!({"panels":{"color":false},"dockTabs":{"layers":999}}),+ json!({"tool":"brush","dock":{"order":["layers","color"]}}),+ json!({"panels":{"layers":false},"dockTabs":{"layers":1}}),+ ] {+ assert_eq!(control_set(&mut app, &ctx, request)["ok"], false);+ assert_eq!(serde_json::to_value(&app.ui).unwrap(), before);+ }+}++#[test]+fn legacy_dock_width_is_consumed_by_custom_renderer_and_clamped_to_existing_range() {+ let mut app = app();+ app.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ let mut h = harness(app, vec2(1280.0, 800.0));+ let ctx = h.ctx.clone();+ for (requested, expected) in [(410.0, 410.0), (900.0, 520.0), (20.0, 250.0)] {+ assert_eq!(control_set(h.state_mut(), &ctx, json!({"dockWidth":requested}))["ok"], true);+ h.run_steps(2);+ let state = egui::containers::panel::PanelState::load(&h.ctx, egui::Id::new("shared-panel-dock")).unwrap();+ assert!((state.outer_rect.width() - expected).abs() < 1.0, "{} / {expected}", state.outer_rect.width());+ assert!(h.ctx.data(|data| data.get_temp::<f32>(crate::panels::dock_width_id())).is_none());+ }+}++#[test]+fn explicit_reveal_activates_existing_tab_and_expands_custom_group() {+ let mut app = app();+ app.run("window.panel.move", json!({"panel":"properties","anchor":"layers"})).unwrap();+ app.run("window.panel.group", json!({"panel":"layers","operation":"collapse"})).unwrap();+ app.run("window.panel.layers", json!({"show":true})).unwrap();+ assert!(panel_active(app.ui.docking.as_ref().unwrap(), "layers"));+ assert!(!collapsed_members(&app, app.ui.docking.as_ref().unwrap()).contains("layers"));+ app.run("window.panel.layers", json!({"show":true})).unwrap();+ assert!(app.ui.docking.as_ref().unwrap().contains(&"layers".into()));+ let before = app.ui.docking.clone();+ assert!(app.run("window.panel.layers", json!({"show":"yes"})).is_err());+ assert_eq!(app.ui.docking, before);+}++#[test]+fn custom_group_commands_preserve_members_and_workspace_timeline() {+ let mut app = app();+ app.run("window.panel.move", json!({"panel":"properties","anchor":"layers"})).unwrap();+ let members = group_members(app.ui.docking.as_ref().unwrap(), "layers");+ app.run("window.panel.group", json!({"panel":"layers","operation":"up"})).unwrap();+ assert_eq!(group_members(app.ui.docking.as_ref().unwrap(), "layers"), members);+ app.ui.timeline.open = true;+ app.run("window.panel.group", json!({"panel":"layers","operation":"collapse"})).unwrap();+ let saved = json!({"panels":app.ui.panels,"dock":app.ui.dock,"dockTabs":app.ui.dock_tabs,"docking":app.ui.docking,"dockingHidden":app.ui.docking_hidden,"dockingCollapsed":app.ui.docking_collapsed,"timelineOpen":true});+ let mut restored = self::app();+ crate::dock::apply(&mut restored, &saved);+ assert_eq!(restored.ui.docking, app.ui.docking);+ assert!(restored.ui.timeline.open);+ assert!(collapsed_members(&restored, restored.ui.docking.as_ref().unwrap()).contains("layers"));+ app.run("window.panel.group", json!({"panel":"layers","operation":"close"})).unwrap();+ assert!(members.iter().all(|id| !app.ui.docking.as_ref().unwrap().contains(id)));+ assert!(members.iter().all(|id| app.ui.docking_hidden.contains_key(id)));+ app.session.prefs.edit(|p| p.workspace_locked = true);+ let before = serde_json::to_value(&app.ui).unwrap();+ assert!(app.run("window.panel.group", json!({"panel":"color","operation":"close"})).is_err());+ assert_eq!(serde_json::to_value(&app.ui).unwrap(), before);+ restored.ui.timeline.playing = true;+ crate::dock::apply(&mut restored, &json!({"dock":{}}));+ assert!(!restored.ui.timeline.open && !restored.ui.timeline.playing);+}++#[test]+fn customized_panel_menus_and_rail_remain_reachable_after_float_and_restore() {+ let mut app = app();+ app.run("window.panel.float", json!({"panel":"swatches","x":20,"y":40})).unwrap();+ let mut h = harness(app, vec2(1280.0, 800.0));+ assert!(h.query_all_by_label("Panel menu").count() > 0);+ assert!(h.query_all_by_label("Color & Swatches").count() > 0);+ let floating = h.ctx.memory(|memory| memory.area_rect(egui::Id::new("photocraft-panel-docking").with(("floating", &"swatches".to_string())))).unwrap();+ let first = h.query_all_by_label("Panel menu").find(|node| floating.contains_rect(node.rect())).unwrap().rect().center();+ h.hover_at(first);+ for pressed in [true, false] {+ h.event(Event::PointerButton { pos: first, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE });+ h.run_steps(1);+ }+ h.run_steps(2);+ assert!(h.query_all_by_label("Close Tab Group").count() > 0);+ assert!(h.query_all_by_label("New Swatch…").count() > 0);+ // Panel-specific menu body is shared by both its context and group menu seams.+ let mut ready = false;+ let mut menu = Harness::builder().build_ui_state(+ move |ui, app: &mut PhotocraftApp| {+ if !ready {+ PhotocraftApp::setup_context(ui.ctx(), crate::theme::ThemeKind::ProMedium);+ ready = true;+ }+ panel_menu(app, ui, "swatches");+ },+ self::app(),+ );+ menu.run_steps(2);+ assert!(menu.query_all_by_label("New Swatch…").count() > 0);+}++#[test]+fn custom_workspace_saves_shared_layout_and_timeline_without_embedding_flags() {+ let mut app = app();+ app.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ app.ui.timeline.open = true;+ app.ui.panels.rail = false;+ app.ui.panels.menu_bar = false;+ let ctx = egui::Context::default();+ crate::menus::invoke(&mut app, &ctx, "window.workspace.newWorkspace", json!({"name":"Docked Motion"})).unwrap();+ let saved = app.session.prefs().workspaces.get("Docked Motion").unwrap().clone();+ assert!(saved["docking"].is_object() && saved["timelineOpen"] == true);+ assert!(saved["panels"].get("rail").is_none() && saved["panels"].get("menu_bar").is_none());+ let layout = app.ui.docking.clone();+ app.ui.workspace = "Motion".into();+ crate::menus::apply_workspace(&mut app);+ assert!(app.ui.docking.is_none() && app.ui.timeline.open);+ crate::dock::apply(&mut app, &saved);+ assert_eq!(app.ui.docking, layout);+ assert!(app.ui.timeline.open);+}++#[test]+fn closing_and_reopening_a_whole_group_retains_its_return_position_and_tab_order() {+ let mut app = app();+ app.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ let before = app.ui.docking.clone().unwrap();+ let members = group_members(&before, "layers");+ app.run("window.panel.group", json!({"panel":"layers","operation":"close"})).unwrap();+ for panel in &members {+ app.run("window.panel.activate", json!({"panel":panel})).unwrap();+ }+ let after = app.ui.docking.as_ref().unwrap();+ assert_eq!(group_members(after, "layers"), members);+ assert_eq!(root_groups(after), root_groups(&before));+ assert!(valid(after));+}++#[test]+fn floating_group_grip_redocks_all_tabs_as_one_atomic_move() {+ let mut app = app();+ app.run("window.panel.float", json!({"panel":"swatches","x":30,"y":60})).unwrap();+ app.run("window.panel.move", json!({"panel":"patterns","anchor":"swatches"})).unwrap();+ let mut h = harness(app, vec2(1280.0, 800.0));+ let from = h.ctx.read_response(egui::Id::new("photocraft-panel-docking").with(("move-group", Some(&"swatches".to_string())))).unwrap().rect.center();+ let to = h.ctx.read_response(egui::Id::new("photocraft-panel-docking").with(("tab", &"layers".to_string()))).unwrap().rect.center();+ drag(&mut h, from, to);+ let layout = h.state().ui.docking.as_ref().unwrap();+ assert!(layout.floating.iter().all(|group| !group.panels.iter().any(|id| id == "swatches" || id == "patterns")));+ let members = group_members(layout, "layers");+ let swatches = members.iter().position(|id| id == "swatches").unwrap();+ assert_eq!(members.get(swatches + 1).map(String::as_str), Some("patterns"));+ assert!(valid(layout));+ let before = h.state().ui.docking.clone();+ assert!(h.state_mut().run("window.panel.group", json!({"panel":"swatches","operation":"move","anchor":"patterns"})).is_err());+ assert_eq!(h.state().ui.docking, before);+}++#[test]+fn mixed_theme_and_legacy_selection_projects_the_selected_panel_in_the_new_theme() {+ let mut app = app();+ app.ui.theme = crate::theme::ThemeKind::ProMedium;+ app.run("window.panel.float", json!({"panel":"properties"})).unwrap();+ let ctx = egui::Context::default();+ assert_eq!(control_set(&mut app, &ctx, json!({"theme":"studio","dockTabs":{"color":0}}))["ok"], true);+ assert!(panel_active(app.ui.docking.as_ref().unwrap(), "swatches"));+ assert_eq!(app.ui.dock_tabs.color, 0);+ assert_eq!(control_set(&mut app, &ctx, json!({"theme":"proMedium","dockTabs":{"color":0}}))["ok"], true);+ assert!(panel_active(app.ui.docking.as_ref().unwrap(), "color"));+ assert_eq!(app.ui.dock_tabs.color, 0);+}++++#[test]++fn native_tab_reorder_stays_native_until_drag_crosses_the_strip() {++ let mut h = harness(app(), vec2(1280.0, 800.0));++ let source = h.query_all_by_label("Layers").find(|node| node.rect().height() <= 45.0).unwrap().rect().center();++ let target = h.query_all_by_label("Channels").find(|node| node.rect().height() <= 45.0).unwrap().rect().right_center() - vec2(1.0, 0.0);++ h.event(Event::PointerMoved(source));++ h.run_steps(1);++ h.event(Event::PointerButton { pos: source, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });++ h.run_steps(1);++ let near_edge = egui::pos2(target.x, source.y - 21.0);++ h.event(Event::PointerMoved(near_edge));++ h.run_steps(1);++ assert!(h.state().ui.docking.is_none(), "native near-edge reorder tolerance must not promote to custom docking");++ h.event(Event::PointerMoved(target));++ h.run_steps(1);++ assert!(h.state().ui.docking.is_none(), "native horizontal reorder must not promote to custom docking");++ h.event(Event::PointerButton { pos: target, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });++ h.run_steps(2);++ assert!(h.state().ui.docking.is_none());++ let tabs = h.state().ui.dock.visible_tabs(Group::Layers, false);++ let layers = tabs.iter().position(|(_, label)| *label == "Layers").unwrap();++ let channels = tabs.iter().position(|(_, label)| *label == "Channels").unwrap();++ assert!(channels < layers, "upstream native reorder remains effective");++}diff --cc crates/ui-egui/src/panels.rsindex 68dfcd77e,291c1601b..444036c57--- a/crates/ui-egui/src/panels.rs+++ b/crates/ui-egui/src/panels.rs@@@ -117,189 -117,183 +117,193 @@@ pub fn toolbar(app: &mut PhotocraftAppif ui.input(|i| i.pointer.any_pressed()) {ui.data_mut(|d| d.remove::<egui::Id>(held_id));}- egui::ScrollArea::vertical().id_salt("toolbar-columns").show(ui, |ui| {- // Pro has no group dividers, so its two columns fill every row across groups.- let sections: Vec<Vec<(usize, Vec<Tool>)>> = if t.pro { vec![sections.into_iter().flatten().collect()] } else { sections };- for (si, section) in sections.iter().enumerate() {- // Photoshop 2026 draws one uninterrupted column (no group dividers).- if si > 0 && !t.pro {- ui.add_space(4.0);- let (r, _) = ui.allocate_exact_size(vec2(if double { bx * 2.0 + 2.0 } else { bx }, 1.0), Sense::hover());- ui.painter().line_segment([r.left_center() + vec2(8.0, 0.0), r.right_center() - vec2(8.0, 0.0)], Stroke::new(1.0, t.separator));- ui.add_space(4.0);- }- let rows: Vec<&[(usize, Vec<Tool>)]> = if double { section.chunks(2).collect() } else { section.chunks(1).collect() };- for row in rows {- ui.horizontal(|ui| {- for (slot_index, slot) in row.iter() {- let key = egui::Id::new(("tool-slot", *slot_index));- let tool = slot_tool(ui, app.ui.tool, slot, key);- let sel = slot.contains(&app.ui.tool);- let tip = if tool.key() == '\0' { tl!(tool.label()).to_string() } else { format!("{} ({})", tl!(tool.label()), tool.key()) };- let resp = icons::button(ui, icons::tool_icon(tool), bx, sel, &tip);- if slot.len() > 1 {- paint_toolbar_flyout_indicator(ui, &t, &resp);- }- if resp.clicked() && ui.data(|d| d.get_temp::<egui::Id>(held_id)) != Some(key) {- app.ui.tool = tool;- }- // Double-clicking the Hand tool fits the image on screen (Photoshop).- if resp.double_clicked() && tool == Tool::Hand {- app.ui.tool = tool;- // With no document open there is nothing to fit.- let _ = app.run("view.fitOnScreen", json!({}));- }- // Double-clicking the Zoom tool zooms to 100% (Photoshop).- if resp.double_clicked() && tool == Tool::Zoom {- app.ui.tool = tool;- // With no document open there is nothing to zoom.- let _ = app.run("view.actualPixels", json!({}));- }- // Right-click or long-press opens the flyout (Photoshop).- let held_for =- resp.is_pointer_button_down_on().then(|| ui.input(|i| i.pointer.press_start_time().map(|t0| i.time - t0))).flatten();- if slot.len() > 1- && let Some(seconds) = held_for- && seconds < 0.35- {- ui.ctx().request_repaint_after(std::time::Duration::from_secs_f64(0.35 - seconds));- }- let long_press = held_for.is_some_and(|seconds| seconds >= 0.35);- if slot.len() > 1 && (resp.secondary_clicked() || long_press) {- ui.data_mut(|d| {- d.insert_temp(flyout_id, (key, resp.rect));- if long_press {- d.insert_temp(held_id, key);- }- });- }- if slot.len() > 1 && long_press {- ui.ctx().request_repaint();- }- if let Some((open_key, anchor)) = ui.data(|d| d.get_temp::<(egui::Id, Rect)>(flyout_id))- && open_key == key- {- let area = egui::Area::new(key.with("flyout"))- .order(egui::Order::Foreground)- .fixed_pos(anchor.right_top() + vec2(6.0, 0.0))- .show(ui.ctx(), |ui| {- egui::Frame::popup(ui.style()).show(ui, |ui| {- let label_w = slot- .iter()- .map(|it| {- ui.painter()- .layout_no_wrap(tl!(it.label()).to_string(), egui::FontId::proportional(12.5), t.text)- .size()- .x- })- .fold(0.0f32, f32::max);- let fw = (label_w + 42.0 + 40.0).max(180.0);- for &item in slot.iter() {- let (r, ir) = ui.allocate_exact_size(vec2(fw, 26.0), Sense::click());- if ir.hovered() {- ui.painter().rect_filled(r, 3.0, t.hover);- }- if item == tool {- ui.painter().rect_filled(- Rect::from_center_size(pos2(r.left() + 8.0, r.center().y), vec2(4.0, 4.0)),- 0.0,- t.text,+ let ctx = ui.ctx().clone();+ let footer = (if t.pro { 8.0 } else { 14.0 })+ + chips_height(t.pro, t.round_chips, t.round_chips && double)+ + if t.pro { 8.0 + if double { bx } else { bx * 2.0 + 3.0 } } else { 0.0 }+ + 6.0;+ egui::ScrollArea::vertical()+ .id_salt("toolbar-columns")+ .auto_shrink([false, false])+ .max_height((ui.available_height() - footer).max(0.0))+ .min_scrolled_height(0.0)+ .show(ui, |ui| {+ // Pro has no group dividers, so its two columns fill every row across groups.+ let sections: Vec<Vec<(usize, Vec<Tool>)>> = if t.pro { vec![sections.into_iter().flatten().collect()] } else { sections };+ for (si, section) in sections.iter().enumerate() {+ // Photoshop 2026 draws one uninterrupted column (no group dividers).+ if si > 0 && !t.pro {+ ui.add_space(4.0);+ let (r, _) = ui.allocate_exact_size(vec2(if double { bx * 2.0 + 2.0 } else { bx }, 1.0), Sense::hover());+ ui.painter().line_segment([r.left_center() + vec2(8.0, 0.0), r.right_center() - vec2(8.0, 0.0)], Stroke::new(1.0, t.separator));+ ui.add_space(4.0);+ }+ let rows: Vec<&[(usize, Vec<Tool>)]> = if double { section.chunks(2).collect() } else { section.chunks(1).collect() };+ for row in rows {+ ui.horizontal(|ui| {+ for (slot_index, slot) in row.iter() {+ let key = egui::Id::new(("tool-slot", *slot_index));+ let tool = slot_tool(ui, app.ui.tool, slot, key);+ let sel = slot.contains(&app.ui.tool);+ let tip =+ if tool.key() == '\0' { tl!(tool.label()).to_string() } else { format!("{} ({})", tl!(tool.label()), tool.key()) };+ let resp = icons::button(ui, icons::tool_icon(tool), bx, sel, &tip);+ if slot.len() > 1 {+ paint_toolbar_flyout_indicator(ui, &t, &resp);+ }+ if resp.clicked() && ui.data(|d| d.get_temp::<egui::Id>(held_id)) != Some(key) {+ app.ui.tool = tool;+ }+ // Double-clicking the Hand tool fits the image on screen (Photoshop).+ if resp.double_clicked() && tool == Tool::Hand {+ app.ui.tool = tool;+ // With no document open there is nothing to fit.+ let _ = app.run("view.fitOnScreen", json!({}));+ }++ if resp.double_clicked() && tool == Tool::Zoom {++ app.ui.tool = tool;++ let _ = app.run("view.actualPixels", json!({}));++ }+ // Right-click or long-press opens the flyout (Photoshop).+ let held_for =+ resp.is_pointer_button_down_on().then(|| ui.input(|i| i.pointer.press_start_time().map(|t0| i.time - t0))).flatten();+ if slot.len() > 1+ && let Some(seconds) = held_for+ && seconds < 0.35+ {+ ui.ctx().request_repaint_after(std::time::Duration::from_secs_f64(0.35 - seconds));+ }+ let long_press = held_for.is_some_and(|seconds| seconds >= 0.35);+ if slot.len() > 1 && (resp.secondary_clicked() || long_press) {+ ui.data_mut(|d| {+ d.insert_temp(flyout_id, (key, resp.rect));+ if long_press {+ d.insert_temp(held_id, key);+ }+ });+ }+ if slot.len() > 1 && long_press {+ ui.ctx().request_repaint();+ }+ if let Some((open_key, anchor)) = ui.data(|d| d.get_temp::<(egui::Id, Rect)>(flyout_id))+ && open_key == key+ {+ let area = egui::Area::new(key.with("flyout"))+ .order(egui::Order::Foreground)+ .fixed_pos(anchor.right_top() + vec2(6.0, 0.0))+ .show(ui.ctx(), |ui| {+ egui::Frame::popup(ui.style()).show(ui, |ui| {+ let label_w = slot+ .iter()+ .map(|it| {+ ui.painter()+ .layout_no_wrap(tl!(it.label()).to_string(), egui::FontId::proportional(12.5), t.text)+ .size()+ .x+ })+ .fold(0.0f32, f32::max);+ let fw = (label_w + 42.0 + 40.0).max(180.0);+ for &item in slot.iter() {+ let (r, ir) = ui.allocate_exact_size(vec2(fw, 26.0), Sense::click());+ if ir.hovered() {+ ui.painter().rect_filled(r, 3.0, t.hover);+ }+ if item == tool {+ ui.painter().rect_filled(+ Rect::from_center_size(pos2(r.left() + 8.0, r.center().y), vec2(4.0, 4.0)),+ 0.0,+ t.text,+ );+ }+ icons::paint(+ ui,+ Rect::from_center_size(pos2(r.left() + 26.0, r.center().y), vec2(18.0, 18.0)),+ icons::tool_icon(item),+ 14.0,+ t.icon,);- }- icons::paint(- ui,- Rect::from_center_size(pos2(r.left() + 26.0, r.center().y), vec2(18.0, 18.0)),- icons::tool_icon(item),- 14.0,- t.icon,- );- ui.painter().text(- pos2(r.left() + 42.0, r.center().y),- Align2::LEFT_CENTER,- tl!(item.label()),- egui::FontId::proportional(12.5),- t.text,- );- if item.key() != '\0' {ui.painter().text(- pos2(r.right() - 8.0, r.center().y),- Align2::RIGHT_CENTER,- item.key().to_string(),- egui::FontId::proportional(12.0),- t.text_dim,+ pos2(r.left() + 42.0, r.center().y),+ Align2::LEFT_CENTER,+ tl!(item.label()),+ egui::FontId::proportional(12.5),+ t.text,);+ if item.key() != '\0' {+ ui.painter().text(+ pos2(r.right() - 8.0, r.center().y),+ Align2::RIGHT_CENTER,+ item.key().to_string(),+ egui::FontId::proportional(12.0),+ t.text_dim,+ );+ }+ if ir.clicked() {+ app.ui.tool = item;+ ui.data_mut(|d| d.remove::<(egui::Id, Rect)>(flyout_id));+ }}- if ir.clicked() {- app.ui.tool = item;- ui.data_mut(|d| d.remove::<(egui::Id, Rect)>(flyout_id));- }- }+ });});- });- let held_release = resp.clicked() && ui.data(|d| d.get_temp::<egui::Id>(held_id)) == Some(key);- let clicked_outside = ui.input(|i| i.pointer.any_click()) && !held_release && !area.response.hovered() && !resp.hovered();- if clicked_outside || ui.input(|i| i.key_pressed(egui::Key::Escape)) {- ui.data_mut(|d| d.remove::<(egui::Id, Rect)>(flyout_id));+ let held_release = resp.clicked() && ui.data(|d| d.get_temp::<egui::Id>(held_id)) == Some(key);+ let clicked_outside =+ ui.input(|i| i.pointer.any_click()) && !held_release && !area.response.hovered() && !resp.hovered();+ if clicked_outside || ui.input(|i| i.key_pressed(egui::Key::Escape)) {+ ui.data_mut(|d| d.remove::<(egui::Id, Rect)>(flyout_id));+ }}}- }- });+ });+ }}- }- let ctx = ui.ctx().clone();- if t.pro && icons::button(ui, "ellipsis", bx, false, tl!("Edit Toolbar…")).clicked() {- let _ = crate::menus::invoke(app, &ctx, "edit.toolbar", json!({}));- }- ui.add_space(if t.pro { 8.0 } else { 14.0 });- color_chips(app, ui, double);- if t.pro {- ui.add_space(8.0);+ if t.pro && icons::button(ui, "ellipsis", bx, false, tl!("Edit Toolbar…")).clicked() {+ let _ = crate::menus::invoke(app, &ctx, "edit.toolbar", json!({}));+ }+ reveal_focused_control(ui);+ });+ ui.add_space(if t.pro { 8.0 } else { 14.0 });+ color_chips(app, ui, double);+ if t.pro {+ ui.add_space(8.0);- let layout = if double { egui::Layout::left_to_right(egui::Align::Min) } else { egui::Layout::top_down(egui::Align::Min) };+ let layout = if double { egui::Layout::left_to_right(egui::Align::Min) } else { egui::Layout::top_down(egui::Align::Min) };- ui.with_layout(layout, |ui| {- let quick_mask = app.session.active().is_some_and(|s| s.doc.quick_mask.is_some());- if icons::button(- ui,- "square-dashed",- bx,- quick_mask,- if quick_mask { tl!("Edit in Standard Mode (Q)") } else { tl!("Edit in Quick Mask Mode (Q)") },- )- .clicked()- {- let _ = crate::menus::invoke(app, &ctx, "select.editInQuickMaskMode", json!({}));- }- let sm = icons::button(ui, "app-window", bx, false, tl!("Change Screen Mode (F)"));- paint_toolbar_flyout_indicator(ui, &t, &sm);+ ui.with_layout(layout, |ui| {+ let quick_mask = app.session.active().is_some_and(|s| s.doc.quick_mask.is_some());+ if icons::button(+ ui,+ "square-dashed",+ bx,+ quick_mask,+ if quick_mask { tl!("Edit in Standard Mode (Q)") } else { tl!("Edit in Quick Mask Mode (Q)") },+ )+ .clicked()+ {+ let _ = crate::menus::invoke(app, &ctx, "select.editInQuickMaskMode", json!({}));+ }+ let sm = icons::button(ui, "app-window", bx, false, tl!("Change Screen Mode (F)"));+ paint_toolbar_flyout_indicator(ui, &t, &sm);- if sm.clicked() {- let _ = crate::menus::invoke(app, &ctx, "view.screenMode.cycle", json!({}));- }- // Right-click (or long-press) lists the modes, like Photoshop's flyout.- egui::Popup::context_menu(&sm).show(|ui| {- ui.set_min_width(220.0);- for (id, label) in [- ("view.screenMode.standard", tl!("Standard Screen Mode")),- ("view.screenMode.fullScreenWithMenuBar", tl!("Full Screen Mode With Menu Bar")),- ("view.screenMode.fullScreen", tl!("Full Screen Mode")),- ] {- let on = crate::view_cmds::checked(app, id).unwrap_or(false);- if ui.add(egui::Button::selectable(on, label)).clicked() {- let _ = crate::menus::invoke(app, &ctx, id, json!({}));- ui.close();- }+ if sm.clicked() {+ let _ = crate::menus::invoke(app, &ctx, "view.screenMode.cycle", json!({}));+ }+ // Right-click (or long-press) lists the modes, like Photoshop's flyout.+ egui::Popup::context_menu(&sm).show(|ui| {+ ui.set_min_width(220.0);+ for (id, label) in [+ ("view.screenMode.standard", tl!("Standard Screen Mode")),+ ("view.screenMode.fullScreenWithMenuBar", tl!("Full Screen Mode With Menu Bar")),+ ("view.screenMode.fullScreen", tl!("Full Screen Mode")),+ ] {+ let on = crate::view_cmds::checked(app, id).unwrap_or(false);+ if ui.add(egui::Button::selectable(on, label)).clicked() {+ let _ = crate::menus::invoke(app, &ctx, id, json!({}));+ ui.close();}- });+ }});- }- });+ });+ }},);}@@@ -1306,12 -1316,13 +1354,17 @@@ pub fn options_bar(app: &mut Photocraft// Retouching and smart-selection tools draw their bar in `retouch_ui::options_bar`._ => {}}+ // Painting symmetry is independent of visual theme. Keep the options-bar+ // action available for Brush, Pencil and Eraser in every palette (#2659).+ if matches!(tool, Tool::Brush | Tool::Pencil | Tool::Eraser) {+ crate::symmetry_ui::menu(app, ui);+ }crate::brush_panel::commit_gesture(app, ui.ctx(), &brush_before, &brush);});+ // Font ink can extend beyond its advance width at fractional positions.+ ui.expand_to_include_x(ui.min_rect().right() + 2.0);+ reveal_focused_control(ui);+ });});}diff --cc crates/ui-egui/src/tab_strip.rsindex b91480583,ddf1a7b67..576bb0cb7--- a/crates/ui-egui/src/tab_strip.rs+++ b/crates/ui-egui/src/tab_strip.rs@@@ -37,9 -100,15 +38,16 @@@ pub struct StripOutpub context: Option<TabContextAction>,/// Rects of the tabs on the strip, `(tab index, rect)`.pub tabs: Vec<(usize, Rect)>,+ pub responses: Vec<(usize, Response)>,/// The » overflow button, when some tabs didn't fit.pub chevron: Option<Rect>,+ /// A tab was dragged along the strip and dropped: `(tab, before)`, draw `tab` just before+ /// tab `before` (`None`: last).+ pub reorder: Option<(usize, Option<usize>)>,+ /// A tab is being dragged away from the strip (the dock moves the whole group then).+ pub dragging_out: bool,+ /// A tab drag ended away from the strip.+ pub dropped_out: bool,}/// Width of the » overflow button.@@@ -98,20 -166,32 +107,35 @@@ fn tabs_indouble_clicked: false,context: None,tabs: Vec::with_capacity(f.shown.len()),+ responses: Vec::with_capacity(f.shown.len()),chevron: None,+ reorder: None,+ dragging_out: false,+ dropped_out: false,};+ // Without reordering, drags on a tab fall through to the strip behind it.+ let sense = if reorderable { Sense::click_and_drag() } else { Sense::click() };+ let mut drag: Option<(usize, bool)> = None;for &(i, w) in &f.shown {let Some(name) = tabs.get(i) else { continue };let r = Rect::from_min_size(pos2(x, area.top()), vec2(w, area.height()));- let resp = ui.interact(r, id.with(("tab", i)), sense);- // Like Photoshop, pressing a tab to drag it brings it to the front.+ // The padding gives way (down to a third) before the label is cut.+ let galley = elided(ui, name, font.clone(), t.text, (w - pad / 3.0).max(1.0));+ let cut = galley.size().x + pad + 0.5 < natural.get(i).copied().unwrap_or(0.0) && galley.size().x + pad / 3.0 >= w - 0.5;- let resp = craft_ui::tabs::Tab::new(id.with(("tab", i)), name, i == *selected)- .sense(Sense::click_and_drag())- .focus_stroke(Stroke::new(1.0, t.accent))- .show_at(ui, r, |ui, resp| paint_tab(ui, r, i, galley, resp, active(i)));++ let resp = craft_ui::tabs::Tab::new(id.with(("tab", i)), name, i == *selected).sense(sense).focus_stroke(Stroke::new(1.0, t.accent)).show_at(++ ui,++ r,++ |ui, resp| paint_tab(ui, r, i, galley, resp, active(i)),++ );+ let resp = if cut { resp.on_hover_text(*name) } else { resp };+ if resp.drag_started() {+ *selected = i;+ }+ if resp.dragged() {+ drag = Some((i, false));+ } else if resp.drag_stopped() {+ drag = Some((i, true));+ }- // The padding gives way (down to a third) before the label is cut.- let galley = elided(ui, name, font.clone(), t.text, (w - pad / 3.0).max(1.0));- let cut = galley.size().x + pad + 0.5 < natural.get(i).copied().unwrap_or(0.0) && galley.size().x + pad / 3.0 >= w - 0.5;- paint_tab(ui, r, i, galley, &resp, active(i));- let resp = if cut { resp.on_hover_text(*name) } else { resp };out.double_clicked |= resp.double_clicked();if resp.clicked() {out.clicked = true;@@@ -261,62 -373,4 +318,63 @@@ mod tests}}}++ #[test]+ fn tiny_panel_strips_keep_tabs_and_overflow_inside_the_available_area() {+ let ctx = egui::Context::default();+ crate::PhotocraftApp::setup_context(&ctx, crate::theme::ThemeKind::Pro);+ for width in [0.0, 1.0, 5.0, 18.0, 19.0, 80.0, 180.0, 300.0] {+ let area = Rect::from_min_size(pos2(20.0, 20.0), vec2(width, 26.0));+ let mut selected = 3;+ let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {- let out = pro_tabs(ui, ui.id().with("tiny-tabs"), area, area.right(), &["Color", "Swatches", "Gradients", "Patterns"], &mut selected, false);++ let out =++ pro_tabs(ui, ui.id().with("tiny-tabs"), area, area.right(), &["Color", "Swatches", "Gradients", "Patterns"], &mut selected, false, false);+ assert!(out.tabs.iter().any(|(i, _)| *i == 3));+ for (_, rect) in &out.tabs {+ assert!(rect.left() >= area.left() && rect.right() <= area.right() + 0.001, "{width}: {rect:?}");+ }+ if let Some(chevron) = out.chevron {+ assert!(chevron.left() >= area.left() && chevron.right() <= area.right() + 0.001, "{width}: {chevron:?}");+ }+ });+ output.textures_delta.clear();+ assert_eq!(selected, 3);+ for shape in output.shapes.iter().filter(|s| matches!(s.shape, egui::Shape::Text(_))) {+ assert!(shape.clip_rect.right() <= area.right() + 0.001, "{width}: text is clipped to its tab");+ }+ }+ }++ #[test]+ fn overflow_icon_and_hover_paint_stay_inside_a_tiny_button() {+ for scale in [1.0, 2.0] {+ let ctx = egui::Context::default();+ crate::PhotocraftApp::setup_context(&ctx, crate::theme::ThemeKind::Pro);+ ctx.set_pixels_per_point(scale);+ for width in [1.0, 5.0, 11.0, 12.0, 18.0] {+ let rect = Rect::from_min_size(pos2(20.25, 20.25), vec2(width, 26.0));+ for _ in 0..3 {+ let mut picked = None;+ let input = egui::RawInput { events: vec![egui::Event::PointerMoved(rect.center())], ..Default::default() };+ let mut output = ctx.run_ui(input, |ui| {+ overflow_button(ui, ui.id().with("tiny-overflow"), rect, "More panels", &["Layers"], &[0], &mut picked);+ });+ output.textures_delta.clear();+ let mut icons = 0;+ for shape in &output.shapes {+ // egui paints an unrotated image as a textured rectangle, not a mesh.+ if matches!(&shape.shape, egui::Shape::Rect(rect) if rect.brush.is_some()) {+ icons += 1;+ }+ let painted = shape.shape.visual_bounding_rect().intersect(shape.clip_rect);+ if painted.is_positive() {+ assert!(rect.contains_rect(painted), "{scale}x, width {width}: {painted:?}");+ }+ }+ assert!(icons > 0, "the actual SVG icon was painted");+ assert!(picked.is_none());+ }+ }+ }+ }}diff --cc crates/ui-egui/src/widgets.rsindex fba3f1ca2,0ac4d6ba8..ae440dbcb--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@@ -56,9 -73,31 +73,33 @@@ pub struct CardResponse/// Rects of the tabs on the strip, `(tab index, rect)`; tabs that don't fit are in the/// chevron menu instead (#151).pub tabs: Vec<(usize, Rect)>,+ pub responses: Vec<(usize, Response)>,/// The » overflow button, when some tabs didn't fit.pub chevron: Option<Rect>,+ /// A tab dragged along the strip was dropped: `(tab, before)` (#2272).+ pub tab_reorder: Option<(usize, Option<usize>)>,+ /// A tab is being dragged away from the strip.+ pub tab_dragging_out: bool,+ /// A tab drag ended away from the strip.+ pub tab_dropped_out: bool,+ }++ impl CardResponse {+ fn new(strip: Response, menu: Response, tabs: crate::tab_strip::StripOut) -> Self {+ CardResponse {+ strip,+ menu,+ tab_clicked: tabs.clicked,+ tab_double_clicked: tabs.double_clicked,+ tab_context: tabs.context,+ tabs: tabs.tabs,++ responses: tabs.responses,+ chevron: tabs.chevron,+ tab_reorder: tabs.reorder,+ tab_dragging_out: tabs.dragging_out,+ tab_dropped_out: tabs.dropped_out,+ }+ }}/// [`card`] that can be collapsed to its tab strip and reports strip and menu interactions.diff --cc crates/ui-egui/tests/drag_preview_canvas.rsindex b3c8cc3f0,b3c8cc3f0..052821edc--- a/crates/ui-egui/tests/drag_preview_canvas.rs+++ b/crates/ui-egui/tests/drag_preview_canvas.rs@@@ -128,7 -128,7 +128,7 @@@ fn coverage(img: &Image, ppp: f32, a: Plet len = a.distance(b).max(1.0);let dir = (b - a) / len;let normal = egui::vec2(-dir.y, dir.x);-- // Skip the ends (corners, where the other edges and the readout may be).++ // Skip rectangle corners, where other edges and the readout may be.let n = (len as usize).saturating_sub(16);let mut hits = 0;for i in 0..n {@@@ -142,6 -142,6 +142,31 @@@hits as f32 / n.max(1) as f32}++/// Sample eight dash periods along the actual ellipse, including its curvature.++/// A short tangent segment can land on antialiasing ramps instead of the stroke's core.++fn ellipse_coverage(images: &[&Image], ppp: f32, center: Pos2, radius: egui::Vec2, midpoint: Pos2, test: impl Fn(u8) -> bool) -> f32 {++ let (center, radius, midpoint) = (center * ppp, radius * ppp, midpoint * ppp);++ let horizontal = (midpoint.y - center.y).abs() > (midpoint.x - center.x).abs();++ let mut hits = 0;++ for offset in -32..32 {++ let p = if horizontal {++ let x = midpoint.x + offset as f32;++ let y = center.y + (midpoint.y - center.y).signum() * radius.y * (1.0 - ((x - center.x) / radius.x).powi(2)).max(0.0).sqrt();++ egui::pos2(x, y)++ } else {++ let y = midpoint.y + offset as f32;++ let x = center.x + (midpoint.x - center.x).signum() * radius.x * (1.0 - ((y - center.y) / radius.y).powi(2)).max(0.0).sqrt();++ egui::pos2(x, y)++ };++ let normal = if horizontal { egui::vec2(0.0, 1.0) } else { egui::vec2(1.0, 0.0) };++ hits += usize::from((-2..=2).any(|o| {++ let q = p + normal * o as f32;++ images.iter().any(|img| img.luma(q.x.round() as i64, q.y.round() as i64).is_some_and(&test))++ }));++ }++ hits as f32 / 64.0++}++/// Ink that contrasts with `background`: dark on white, light on black.fn ink(background: &str) -> impl Fn(u8) -> bool {let white = background == "white";@@@ -165,8 -165,8 +190,17 @@@ fn marquee_previews_show_while_draggingsetup(&mut h, bg, tool);let (a, b) = ([100.0, 80.0], [300.0, 220.0]);let before = render(&mut h);++ let before_time = h.ctx.input(|input| input.time) + 0.4;++ h.input_mut().time = Some(before_time);++ h.step();++ let before_next = render(&mut h);drag_to(&mut h, a, b);let img = render(&mut h);++ if let Some(directory) = std::env::var_os("PHOTOCRAFT_DRAG_PREVIEW_FIXTURES") {++ let directory = std::path::PathBuf::from(directory);++ std::fs::create_dir_all(&directory).unwrap();++ h.render().expect("capture render").save(directory.join(format!("{tool}-{bg}-{ppp}x.png"))).unwrap();++ }if tool == "rectMarquee" {for (i, (p, q)) in edges(&h, a, b).into_iter().enumerate() {let was = coverage(&before, ppp, p, q, ink(bg));@@@ -175,23 -175,23 +209,46 @@@assert!(was < 0.05 && now > 0.3, "{tool} on {bg} @{ppp}x, edge {i}: {was:.2} → {now:.2} contrasting");}} else {-- // The ellipse touches its box at the edge midpoints: check short arcs there.-- // The arcs keep a physical length at any scale, so their sagitta stays inside-- // `coverage`'s ±2 physical px search.++ // Sample both halves of the animated dash cycle while the pointer is held.++ // A single phase can put antialiasing ramps at a short arc's sample positions.++ let next_time = h.ctx.input(|input| input.time) + 0.4;++ h.input_mut().time = Some(next_time);++ h.step();++ let next = render(&mut h);++ if let Some(directory) = std::env::var_os("PHOTOCRAFT_DRAG_PREVIEW_FIXTURES") {++ h.render().expect("capture next phase").save(std::path::PathBuf::from(directory).join(format!("{tool}-{bg}-{ppp}x-next.png"))).unwrap();++ }++ // Check actual arcs around all four ellipse extrema at every display scale.++ let center = screen(&h, 200.0, 150.0);++ let radius = egui::vec2((screen(&h, 300.0, 150.0).x - center.x).abs(), (screen(&h, 200.0, 220.0).y - center.y).abs());for (mx, my) in [(200.0, 80.0), (300.0, 150.0), (200.0, 220.0), (100.0, 150.0)] {let m = screen(&h, mx, my);-- let along = if mx == 200.0 { egui::vec2(14.0 / ppp, 0.0) } else { egui::vec2(0.0, 14.0 / ppp) };-- let now = coverage(&img, ppp, m - along, m + along, ink(bg));-- assert!(now > 0.3, "{tool} on {bg} @{ppp}x at {m:?}: {now:.2} contrasting");++ let was = ellipse_coverage(&[&before, &before_next], ppp, center, radius, m, ink(bg));++ let now = ellipse_coverage(&[&img, &next], ppp, center, radius, m, ink(bg));++ assert!(was < 0.05 && now > 0.3, "{tool} on {bg} @{ppp}x at {m:?}: {was:.2} → {now:.2} contrasting");}}// Each move's frame shows the outline where the pointer is now (no stale frame).++ let previous = img;pointer_move(&mut h, 340.0, 250.0);let img = render(&mut h);if tool == "rectMarquee" {let [top, right, ..] = edges(&h, a, [340.0, 250.0]);assert!(coverage(&img, ppp, top.0, top.1, ink(bg)) > 0.3, "{tool} {bg} @{ppp}x: top edge follows the pointer");assert!(coverage(&img, ppp, right.0, right.1, ink(bg)) > 0.3, "{tool} {bg} @{ppp}x: right edge follows the pointer");++ } else {++ let next_time = h.ctx.input(|input| input.time) + 0.4;++ h.input_mut().time = Some(next_time);++ h.step();++ let next = render(&mut h);++ assert_ne!(img.px, next.px, "held ellipse must animate between the sampled phases");++ let center = screen(&h, 220.0, 165.0);++ let radius = egui::vec2((screen(&h, 340.0, 165.0).x - center.x).abs(), (screen(&h, 220.0, 250.0).y - center.y).abs());++ for midpoint in [screen(&h, 340.0, 165.0), screen(&h, 220.0, 250.0)] {++ let old = ellipse_coverage(&[&previous], ppp, center, radius, midpoint, ink(bg));++ let now = ellipse_coverage(&[&img, &next], ppp, center, radius, midpoint, ink(bg));++ assert!(old < 0.05 && now > 0.3, "ellipse {bg} @{ppp}x follows current bounds: {old:.2} → {now:.2}");++ }}button(&mut h, 340.0, 250.0, false);h.run_steps(2);diff --cc docs/roadmap.mdindex 9fb544461,0c9bbe409..8c650af3f--- a/docs/roadmap.md+++ b/docs/roadmap.md@@@ -1,20 -1,41 +1,48 @@@# Roadmap+ > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-10 · **Change:** minor (Photomerge implementation status corrected; real-world quality validation remains open) · **Target:** Adobe Photoshop 2026++- UI.5: Panels can detach, join other tab groups, split, resize and redock through shared docking transactions. Custom layouts persist with workspaces, respect workspace locking, and retain collapse flags for intact native groups.++- UI.3: Shared icons, accessible icon buttons and panel tabs come from the pinned `craft-ui` library. Tab overflow stays within narrow panels; document tiling uses bounded shared geometry. Palettes and document commands remain app-owned. Existing strict-Clippy boolean/range warnings are corrected.++- UI.4: Compact toolbars keep colour and mode controls visible while tool rows scroll. Long tool-options rows scroll horizontally and reveal keyboard focus; offscreen geometry and interaction regressions cover all themes and 1×/1.5×/2× display scales.+- Status legend: ✅ done · 🟡 in progress · ⬜ not started. Updated 2026-10-08.+- **Parity metrics.** `cargo xtask parity` measures how much of Photoshop's menu tree is *wired to a- command* and writes [`parity.md`](parity.md). It does **not** measure whether those commands behave- like Photoshop, feel right, or survive real files. Read it next to the PSD composite oracle, the- test count, and the [honest parity assessment](#honest-parity-assessment-2026-10-05) below, which- is the reference answer to "how close are we really". The weighted feature estimate in- [`parity-estimate.md`](parity-estimate.md) (~82%) counts feature surface and overstates user-facing- readiness; treat it as an upper bound.+ Forward-looking plan: milestones, the **Current focus** list, and what's next with estimates.+ Where we stand today is in [`target-app-parity.md`](target-app-parity.md) (two numbers, by+ dimension and area) and the ranked work list in [`gaps.md`](gaps.md); the one-page summary is+ [`ROADMAP.md`](../ROADMAP.md). Measured numbers: [`scorecard.md`](scorecard.md)+ (`cargo xtask scorecard`: performance budgets, corpus floors, per-area checklists, dead+ preferences) and [`parity-checklist.md`](parity-checklist.md) (`cargo xtask parity`: menu wiring,+ 628/628, which says nothing about behaviour).++ Status legend: ✅ done · 🟡 in progress · ⬜ not started. Hours are Opus 5.5 agent wall-clock hours+ for one agent working sequentially (calibration in+ [`target-app-parity.md`](target-app-parity.md#remaining-effort-and-calibration)).++ **Stage: alpha** (ready for real work ~45%). Beta needs ~75% and reliable PSD: ~1,100–1,800 h.++ ## Alpha gate++ The core workflows a typical Photoshop professional runs every day, checked end to end on the main+ platform (macOS, 0.6.0), including saving and reopening the work. Any **no**, or a **partial**+ that blocks the workflow, would make PhotoCraft pre-alpha.++ | Core workflow | Works end to end? | Evidence | Hours to pass |+ |---|---|---|---:|+ | Photo retouch: open JPEG/raw, heal/clone/remove, adjustment layers, export JPEG, save and reopen | yes | Spot Healing, Healing, Clone, Patch, Remove tools; 16 adjustment layers; raw for DNG/CR2/NEF/ARW/RAF; JPEG export; MCP workflow tests (`automation/tests/agent_tasks.rs`). Quality complaints (#1092, #2104) and no CR3 don't stop the workflow | 0 |+ | Composite: layers, masks, selections, blend modes, smart objects; save as PSD and `.pcraft` and reopen | yes | PSD round trip ≥ 169/170, 308/309, 258/256 corpus files; `.pcraft` atomic save and crash recovery. Multi-layer Smart Object conversion (#2604) and mask targeting (#2458) are partial but have workarounds | 0 |+ | Cut-out: select a subject, refine the edge, mask, export PNG with transparency | partial (not blocking) | Object/Quick Selection, Select Subject (classical), Refine Edge dialog, layer masks, PNG export. Select and Mask is a dialog, not the workspace; no Refine Hair (#2671) | 0 (depth: 80–140 h, G7) |+ | Design: type, shapes, layer styles, artboards; export PNG/JPEG; save and reopen | partial (not blocking) | Point/paragraph type, shapes with stroke controls, all 10 layer effects, artboards, Export As. One macOS report of a 60 s freeze on choosing the Type tool (#2518, not reproduced); no type on a path | 0 (fix #2518: 2–6 h) |+ | Paint with a pen tablet: pressure brushes, layers, save and reopen | partial (not blocking) | Pressure, tilt, rotation on macOS (AppKit monitor); every Brush Settings section. Lag with big brushes (#2619) and feel gaps ([brush-parity.md](brush-parity.md)) | 0 (feel: 100–180 h, G4) |+ | Exchange PSDs with Photoshop users: open a client PSD, edit, send a PSD back | partial (not blocking for alpha; blocking for beta) | Photoshop-authored oracle 133/256 render as Photoshop does; most exports open in Photoshop (smart objects verified), but some don't (#1281, #2469) | 0 for alpha; 150–250 h for beta (G1) |++ **Result: passes.** Every core workflow completes end to end and the work saves and reopens in+ PhotoCraft; the partial rows are depth and fidelity gaps with workarounds, not blockers. Ready for+ real work is ~45%, inside the alpha band (~40–75%), but close to its floor.++ ## Milestones| M | Status | Where we are ||---|---|---|diff --cc docs/ui-design.mdindex 7e4a616a7,466dfd683..f897c83da--- a/docs/ui-design.md+++ b/docs/ui-design.md@@@ -80,28 -84,18 +84,38 @@@ The app's top bar (`panels::title_bar`- **macOS:** the traffic lights sit over the integrated title strip (`integrated_titlebar`).- **Narrow windows** drop controls that are also in a menu before anything overlaps: Discord (Help › Discord), then the theme toggle, then search (Edit › Search), then the workspace switcher narrows (Window › Workspace).+## Compact tool controls++The toolbar scrolls its tool rows when two columns still exceed the available height. Foreground+and background colours stay visible below those rows, together with Pro's Quick Mask and Screen+Mode controls. Long options rows scroll horizontally. Both scrollers bring newly focused+controls into view and retain the existing tool actions and popups.++The offscreen regression fixture uses production panels, fonts and SVG loaders across every+theme, 800×480 and 1280×720 point viewports, and 1×, 1.5× and 2× display scales. To retain its+60 initial/scrolled PNGs while running the compact geometry and interaction checks:++```sh+CRAFT_UI_VISUAL_FIXTURES=/tmp/photocraft-compact cargo test -p photocraft-ui-egui --lib compact_visual_regressions -- --nocapture+```++Keyboard tests clear the configurable `window.togglePanels` canvas shortcut through preferences,+then send normal Tab and Space events through the app's shortcut dispatcher. They exercise+focus traversal and activation with that nondefault binding; default canvas Tab still toggles+panels. These offscreen checks do not establish native window or platform input acceptance.+## Menus+ An embedding application's `panels.menu_bar` and `panels.rail` flags belong to its current+ session. Restoring a saved workspace or remembered panel layout preserves both flags, including+ when the serialized layout contains their values. Panel visibility, dock layout, tabs and Timeline+ visibility follow the saved layout.++ The Pro status bar's Document Dimensions readout follows Preferences › Units & Rulers › Rulers,+ including changes made from a ruler's context menu. It uses the document resolution for physical+ units, each side's own extent for percentages and the selected point-size convention for points+ and picas. The readout retains the document's pixels-per-inch value.+`menu_catalog.rs` holds Photoshop's menu tree (standard command names, order, separators, default shortcuts). Items whose id matches an engine or UI command are live; others render disabled until implemented. Give new commands the catalogue's id (for example `image.imageSize`) and they light up in the right place automatically.Menus never run off the window: the menu bar's menus and submenus scroll with arrows (`menu_nav::level`), and long right-click menus (Layers, canvas tools, Channels, Paths, document tabs) wrap their rows in `widgets::menu_scroll`, so they move up to fit and scroll only when taller than the visible window.