mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
# Conflicts: # crates/ui-egui/src/lib.rs
This commit is contained in:
commit
efe061dd08
31 files changed
+353
-2
No files matched your search
@@ -1932,6 +1932,11 @@
|
||||
Show canvas dots إظهار نقاط مساحة الرسم
|
||||
Clip thumbnails to layer bounds قصر الصور المصغرة على حدود الطبقة
|
||||
Clip Thumbnails to Layer Bounds قصر الصور المصغرة على حدود الطبقة
|
||||
No Thumbnails بلا صور مصغرة
|
||||
Small Thumbnails صور مصغرة صغيرة
|
||||
Medium Thumbnails صور مصغرة متوسطة
|
||||
Large Thumbnails صور مصغرة كبيرة
|
||||
Clip Thumbnails to Document Bounds قصر الصور المصغرة على حدود المستند
|
||||
Canvas color لون مساحة الرسم
|
||||
Canvas custom color لون مخصص لمساحة الرسم
|
||||
Color picker منتقي الألوان
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1856,6 +1856,11 @@
|
||||
Show canvas dots Prikaži tačke platna
|
||||
Clip thumbnails to layer bounds Ograniči sličice na granice sloja
|
||||
Clip Thumbnails to Layer Bounds Ograniči sličice na granice sloja
|
||||
No Thumbnails Bez sličica
|
||||
Small Thumbnails Male sličice
|
||||
Medium Thumbnails Srednje sličice
|
||||
Large Thumbnails Velike sličice
|
||||
Clip Thumbnails to Document Bounds Ograniči sličice na granice dokumenta
|
||||
Canvas color Boja platna
|
||||
Canvas custom color Prilagođena boja platna
|
||||
Color picker Birač boja
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2047,6 +2047,11 @@
|
||||
Show canvas dots Zobrazit tečky plátna
|
||||
Clip thumbnails to layer bounds Oříznout miniatury na hranice vrstvy
|
||||
Clip Thumbnails to Layer Bounds Oříznout miniatury na hranice vrstvy
|
||||
No Thumbnails Bez miniatur
|
||||
Small Thumbnails Malé miniatury
|
||||
Medium Thumbnails Střední miniatury
|
||||
Large Thumbnails Velké miniatury
|
||||
Clip Thumbnails to Document Bounds Oříznout miniatury na hranice dokumentu
|
||||
Canvas color Barva plátna
|
||||
Canvas custom color Vlastní barva plátna
|
||||
Color picker Výběr barvy
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2343,6 +2343,11 @@
|
||||
Show canvas dots Vis lærredsprikker
|
||||
Clip thumbnails to layer bounds Klip miniaturer til laggrænser
|
||||
Clip Thumbnails to Layer Bounds Klip miniaturer til laggrænser
|
||||
No Thumbnails Ingen miniaturer
|
||||
Small Thumbnails Små miniaturer
|
||||
Medium Thumbnails Mellemstore miniaturer
|
||||
Large Thumbnails Store miniaturer
|
||||
Clip Thumbnails to Document Bounds Klip miniaturer til dokumentgrænser
|
||||
Canvas color Lærredsfarve
|
||||
Canvas custom color Brugerdefineret lærredsfarve
|
||||
Classic Klassisk
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2008,6 +2008,11 @@
|
||||
Show canvas dots Punkte der Zeichenfläche anzeigen
|
||||
Clip thumbnails to layer bounds Miniaturbilder auf Ebenenbegrenzung beschneiden
|
||||
Clip Thumbnails to Layer Bounds Miniaturbilder auf Ebenenbegrenzung beschneiden
|
||||
No Thumbnails Keine Miniaturbilder
|
||||
Small Thumbnails Kleine Miniaturbilder
|
||||
Medium Thumbnails Mittlere Miniaturbilder
|
||||
Large Thumbnails Große Miniaturbilder
|
||||
Clip Thumbnails to Document Bounds Miniaturbilder auf Dokumentbegrenzung beschneiden
|
||||
Canvas color Zeichenflächenfarbe
|
||||
Canvas custom color Benutzerdefinierte Zeichenflächenfarbe
|
||||
Color picker Farbwähler
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1768,6 +1768,11 @@
|
||||
Show canvas dots Εμφάνιση κουκκίδων καμβά
|
||||
Clip thumbnails to layer bounds Περικοπή μικρογραφιών στα όρια του επιπέδου
|
||||
Clip Thumbnails to Layer Bounds Περικοπή μικρογραφιών στα όρια του επιπέδου
|
||||
No Thumbnails Χωρίς μικρογραφίες
|
||||
Small Thumbnails Μικρές μικρογραφίες
|
||||
Medium Thumbnails Μεσαίες μικρογραφίες
|
||||
Large Thumbnails Μεγάλες μικρογραφίες
|
||||
Clip Thumbnails to Document Bounds Περικοπή μικρογραφιών στα όρια του εγγράφου
|
||||
Canvas color Χρώμα καμβά
|
||||
Canvas custom color Προσαρμοσμένο χρώμα καμβά
|
||||
Color picker Επιλογέας χρώματος
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 47 and column 53.
|
@@ -1978,6 +1978,11 @@
|
||||
Show canvas dots Mostrar puntos del lienzo
|
||||
Clip thumbnails to layer bounds Recortar miniaturas a los límites de la capa
|
||||
Clip Thumbnails to Layer Bounds Recortar miniaturas a los límites de la capa
|
||||
No Thumbnails Sin miniaturas
|
||||
Small Thumbnails Miniaturas pequeñas
|
||||
Medium Thumbnails Miniaturas medianas
|
||||
Large Thumbnails Miniaturas grandes
|
||||
Clip Thumbnails to Document Bounds Recortar miniaturas a los límites del documento
|
||||
Canvas color Color del lienzo
|
||||
Canvas custom color Color personalizado del lienzo
|
||||
Color picker Selector de color
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -2344,6 +2344,11 @@
|
||||
Show canvas dots Näytä kankaan pisteet
|
||||
Clip thumbnails to layer bounds Rajaa pikkukuvat tason rajoihin
|
||||
Clip Thumbnails to Layer Bounds Rajaa pikkukuvat tason rajoihin
|
||||
No Thumbnails Ei pikkukuvia
|
||||
Small Thumbnails Pienet pikkukuvat
|
||||
Medium Thumbnails Keskikokoiset pikkukuvat
|
||||
Large Thumbnails Suuret pikkukuvat
|
||||
Clip Thumbnails to Document Bounds Rajaa pikkukuvat asiakirjan rajoihin
|
||||
Canvas color Kankaan väri
|
||||
Canvas custom color Kankaan mukautettu väri
|
||||
Classic Klassinen
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1984,6 +1984,11 @@
|
||||
Show canvas dots Afficher les points du canevas
|
||||
Clip thumbnails to layer bounds Rogner les vignettes aux limites du calque
|
||||
Clip Thumbnails to Layer Bounds Rogner les vignettes aux limites du calque
|
||||
No Thumbnails Aucune vignette
|
||||
Small Thumbnails Petites vignettes
|
||||
Medium Thumbnails Vignettes moyennes
|
||||
Large Thumbnails Grandes vignettes
|
||||
Clip Thumbnails to Document Bounds Rogner les vignettes aux limites du document
|
||||
Canvas color Couleur du canevas
|
||||
Canvas custom color Couleur personnalisée du canevas
|
||||
Color picker Sélecteur de couleurs
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3635,6 +3635,11 @@ cameraRaw Yellow Sárga
|
||||
Show canvas dots Vászonpontok megjelenítése
|
||||
Clip thumbnails to layer bounds Bélyegképek levágása a réteg határaira
|
||||
Clip Thumbnails to Layer Bounds Bélyegképek levágása a réteg határaira
|
||||
No Thumbnails Nincs bélyegkép
|
||||
Small Thumbnails Kis bélyegképek
|
||||
Medium Thumbnails Közepes bélyegképek
|
||||
Large Thumbnails Nagy bélyegképek
|
||||
Clip Thumbnails to Document Bounds Bélyegképek levágása a dokumentum határaira
|
||||
Show channels in color Csatornák megjelenítése színesen
|
||||
Show crosshair in brush tip Szálkereszt az ecsethegyben
|
||||
Show extension panels Bővítménypanelek megjelenítése
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1995,6 +1995,11 @@
|
||||
Show canvas dots Tampilkan titik kanvas
|
||||
Clip thumbnails to layer bounds Pangkas thumbnail ke batas layer
|
||||
Clip Thumbnails to Layer Bounds Pangkas Thumbnail ke Batas Layer
|
||||
No Thumbnails Tanpa Thumbnail
|
||||
Small Thumbnails Thumbnail Kecil
|
||||
Medium Thumbnails Thumbnail Sedang
|
||||
Large Thumbnails Thumbnail Besar
|
||||
Clip Thumbnails to Document Bounds Pangkas Thumbnail ke Batas Dokumen
|
||||
Canvas color Warna kanvas
|
||||
Canvas custom color Warna kustom kanvas
|
||||
Color picker Pemilih warna
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -2023,6 +2023,11 @@
|
||||
Show canvas dots Mostra punti del quadro
|
||||
Clip thumbnails to layer bounds Ritaglia le miniature ai limiti del livello
|
||||
Clip Thumbnails to Layer Bounds Ritaglia le miniature ai limiti del livello
|
||||
No Thumbnails Nessuna miniatura
|
||||
Small Thumbnails Miniature piccole
|
||||
Medium Thumbnails Miniature medie
|
||||
Large Thumbnails Miniature grandi
|
||||
Clip Thumbnails to Document Bounds Ritaglia le miniature ai limiti del documento
|
||||
Canvas color Colore quadro
|
||||
Canvas custom color Colore personalizzato quadro
|
||||
Color picker Selettore colore
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 79 and column 53.
|
@@ -2034,6 +2034,11 @@
|
||||
Show canvas dots カンバスのドットを表示
|
||||
Clip thumbnails to layer bounds サムネールをレイヤーの境界でクリップ
|
||||
Clip Thumbnails to Layer Bounds サムネールをレイヤーの境界でクリップ
|
||||
No Thumbnails サムネールなし
|
||||
Small Thumbnails 小さいサムネール
|
||||
Medium Thumbnails 中サイズのサムネール
|
||||
Large Thumbnails 大きいサムネール
|
||||
Clip Thumbnails to Document Bounds サムネールをドキュメントの境界でクリップ
|
||||
Canvas color カンバスの色
|
||||
Canvas custom color カンバスのカスタム色
|
||||
Color picker カラーピッカー
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2007,6 +2007,11 @@
|
||||
Show canvas dots 캔버스 점 표시
|
||||
Clip thumbnails to layer bounds 썸네일을 레이어 경계로 자르기
|
||||
Clip Thumbnails to Layer Bounds 썸네일을 레이어 경계로 자르기
|
||||
No Thumbnails 썸네일 없음
|
||||
Small Thumbnails 작은 썸네일
|
||||
Medium Thumbnails 중간 썸네일
|
||||
Large Thumbnails 큰 썸네일
|
||||
Clip Thumbnails to Document Bounds 썸네일을 문서 경계로 자르기
|
||||
Canvas color 캔버스 색상
|
||||
Canvas custom color 캔버스 사용자 정의 색상
|
||||
Color picker 색상 피커
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 63 and column 53.
|
@@ -2343,6 +2343,11 @@
|
||||
Show canvas dots Vis lerretprikker
|
||||
Clip thumbnails to layer bounds Klipp miniatyrer til laggrensene
|
||||
Clip Thumbnails to Layer Bounds Klipp miniatyrer til laggrensene
|
||||
No Thumbnails Ingen miniatyrer
|
||||
Small Thumbnails Små miniatyrer
|
||||
Medium Thumbnails Middels miniatyrer
|
||||
Large Thumbnails Store miniatyrer
|
||||
Clip Thumbnails to Document Bounds Klipp miniatyrer til dokumentgrensene
|
||||
Canvas color Lerretfarge
|
||||
Canvas custom color Egendefinert lerretfarge
|
||||
Classic Klassisk
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1955,6 +1955,11 @@
|
||||
Show canvas dots Canvasstippen tonen
|
||||
Clip thumbnails to layer bounds Miniaturen bijsnijden tot laaggrenzen
|
||||
Clip Thumbnails to Layer Bounds Miniaturen bijsnijden tot laaggrenzen
|
||||
No Thumbnails Geen miniaturen
|
||||
Small Thumbnails Kleine miniaturen
|
||||
Medium Thumbnails Middelgrote miniaturen
|
||||
Large Thumbnails Grote miniaturen
|
||||
Clip Thumbnails to Document Bounds Miniaturen bijsnijden tot documentgrenzen
|
||||
Canvas color Canvaskleur
|
||||
Canvas custom color Aangepaste canvaskleur
|
||||
Color picker Kleurkiezer
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -2020,6 +2020,11 @@
|
||||
Show canvas dots Pokaż kropki płótna
|
||||
Clip thumbnails to layer bounds Przycinaj miniatury do granic warstwy
|
||||
Clip Thumbnails to Layer Bounds Przycinaj miniatury do granic warstwy
|
||||
No Thumbnails Bez miniaturek
|
||||
Small Thumbnails Małe miniaturki
|
||||
Medium Thumbnails Średnie miniaturki
|
||||
Large Thumbnails Duże miniaturki
|
||||
Clip Thumbnails to Document Bounds Przycinaj miniatury do granic dokumentu
|
||||
Canvas color Kolor płótna
|
||||
Canvas custom color Własny kolor płótna
|
||||
Color picker Próbnik kolorów
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1978,6 +1978,11 @@
|
||||
Show canvas dots Mostrar pontos da tela de pintura
|
||||
Clip thumbnails to layer bounds Recortar miniaturas aos limites da camada
|
||||
Clip Thumbnails to Layer Bounds Recortar miniaturas aos limites da camada
|
||||
No Thumbnails Sem miniaturas
|
||||
Small Thumbnails Miniaturas pequenas
|
||||
Medium Thumbnails Miniaturas médias
|
||||
Large Thumbnails Miniaturas grandes
|
||||
Clip Thumbnails to Document Bounds Recortar miniaturas aos limites do documento
|
||||
Canvas color Cor da tela de pintura
|
||||
Canvas custom color Cor personalizada da tela de pintura
|
||||
Color picker Seletor de cores
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2436,6 +2436,11 @@
|
||||
Show canvas dots Показывать точки холста
|
||||
Clip thumbnails to layer bounds Обрезать миниатюры по границам слоя
|
||||
Clip Thumbnails to Layer Bounds Обрезать миниатюры по границам слоя
|
||||
No Thumbnails Без миниатюр
|
||||
Small Thumbnails Мелкие миниатюры
|
||||
Medium Thumbnails Средние миниатюры
|
||||
Large Thumbnails Крупные миниатюры
|
||||
Clip Thumbnails to Document Bounds Обрезать миниатюры по границам документа
|
||||
Canvas color Цвет холста
|
||||
Canvas custom color Свой цвет холста
|
||||
Classic Классическая
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1994,6 +1994,11 @@
|
||||
Show canvas dots Prikaži tačke na platnu
|
||||
Clip thumbnails to layer bounds Iseci sličice prema granicama sloja
|
||||
Clip Thumbnails to Layer Bounds Iseci sličice prema granicama sloja
|
||||
No Thumbnails Bez sličica
|
||||
Small Thumbnails Male sličice
|
||||
Medium Thumbnails Srednje sličice
|
||||
Large Thumbnails Velike sličice
|
||||
Clip Thumbnails to Document Bounds Iseci sličice prema granicama dokumenta
|
||||
Canvas color Boja platna
|
||||
Canvas custom color Prilagođena boja platna
|
||||
Color picker Birač boja
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2341,6 +2341,11 @@
|
||||
Show canvas dots Visa punkter på arbetsytan
|
||||
Clip thumbnails to layer bounds Begränsa miniatyrer till lagergränser
|
||||
Clip Thumbnails to Layer Bounds Begränsa miniatyrer till lagergränser
|
||||
No Thumbnails Inga miniatyrer
|
||||
Small Thumbnails Små miniatyrer
|
||||
Medium Thumbnails Medelstora miniatyrer
|
||||
Large Thumbnails Stora miniatyrer
|
||||
Clip Thumbnails to Document Bounds Begränsa miniatyrer till dokumentgränser
|
||||
Canvas color Arbetsytans färg
|
||||
Canvas custom color Anpassad färg för arbetsytan
|
||||
Classic Klassisk
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1908,6 +1908,11 @@
|
||||
Show canvas dots Tuval noktalarını göster
|
||||
Clip thumbnails to layer bounds Küçük resimleri katman sınırlarına kırp
|
||||
Clip Thumbnails to Layer Bounds Küçük resimleri katman sınırlarına kırp
|
||||
No Thumbnails Küçük Resim Yok
|
||||
Small Thumbnails Küçük Boyutlu Küçük Resimler
|
||||
Medium Thumbnails Orta Boyutlu Küçük Resimler
|
||||
Large Thumbnails Büyük Boyutlu Küçük Resimler
|
||||
Clip Thumbnails to Document Bounds Küçük resimleri belge sınırlarına kırp
|
||||
Canvas color Tuval rengi
|
||||
Canvas custom color Tuval özel rengi
|
||||
Color picker Renk seçici
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -2402,6 +2402,11 @@
|
||||
Show canvas dots Показувати крапки полотна
|
||||
Clip thumbnails to layer bounds Обрізати мініатюри до меж шару
|
||||
Clip Thumbnails to Layer Bounds Обрізати мініатюри до меж шару
|
||||
No Thumbnails Без мініатюр
|
||||
Small Thumbnails Малі мініатюри
|
||||
Medium Thumbnails Середні мініатюри
|
||||
Large Thumbnails Великі мініатюри
|
||||
Clip Thumbnails to Document Bounds Обрізати мініатюри до меж документа
|
||||
Canvas color Колір полотна
|
||||
Canvas custom color Довільний колір полотна
|
||||
Classic Класична
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 152 and column 53.
|
@@ -2763,6 +2763,11 @@ shape Appearance Diện mạo
|
||||
Show canvas dots Hiện chấm vùng vẽ
|
||||
Clip thumbnails to layer bounds Cắt hình thu nhỏ theo biên của lớp
|
||||
Clip Thumbnails to Layer Bounds Cắt hình thu nhỏ theo biên của lớp
|
||||
No Thumbnails Không có hình thu nhỏ
|
||||
Small Thumbnails Hình thu nhỏ cỡ nhỏ
|
||||
Medium Thumbnails Hình thu nhỏ cỡ vừa
|
||||
Large Thumbnails Hình thu nhỏ cỡ lớn
|
||||
Clip Thumbnails to Document Bounds Cắt hình thu nhỏ theo biên của tài liệu
|
||||
Color picker Bộ chọn màu
|
||||
Color space Không gian màu
|
||||
Column width Độ rộng cột
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2060,6 +2060,11 @@
|
||||
Show canvas dots 显示画布圆点
|
||||
Clip thumbnails to layer bounds 将缩略图裁剪到图层边界
|
||||
Clip Thumbnails to Layer Bounds 将缩略图裁剪到图层边界
|
||||
No Thumbnails 无缩略图
|
||||
Small Thumbnails 小缩略图
|
||||
Medium Thumbnails 中缩略图
|
||||
Large Thumbnails 大缩略图
|
||||
Clip Thumbnails to Document Bounds 将缩略图裁剪到文档边界
|
||||
Canvas color 画布颜色
|
||||
Canvas custom color 画布自定颜色
|
||||
Color picker 拾色器
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 63 and column 53.
|
@@ -2028,6 +2028,11 @@
|
||||
Show canvas dots 顯示畫布圓點
|
||||
Clip thumbnails to layer bounds 將縮圖裁切至圖層邊界
|
||||
Clip Thumbnails to Layer Bounds 將縮圖裁切至圖層邊界
|
||||
No Thumbnails 無縮圖
|
||||
Small Thumbnails 小縮圖
|
||||
Medium Thumbnails 中縮圖
|
||||
Large Thumbnails 大縮圖
|
||||
Clip Thumbnails to Document Bounds 將縮圖裁切至文件邊界
|
||||
Canvas color 畫布顏色
|
||||
Canvas custom color 畫布自訂顏色
|
||||
Color picker 檢色器
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -0,0 +1,171 @@
|
||||
//! #11404: a right-click on the empty area below the last layer row opens the thumbnail size and
|
||||
//! clipping choices; a left click there still deselects, and a layer row keeps its own menu.
|
||||
|
||||
use egui::{PointerButton, Pos2, pos2};
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::state::LayerThumbnailSize;
|
||||
|
||||
const SIZES: [&str; 4] = ["No Thumbnails", "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails"];
|
||||
const CLIPS: [&str; 2] = ["Clip Thumbnails to Layer Bounds", "Clip Thumbnails to Document Bounds"];
|
||||
|
||||
fn panel(open_document: bool) -> Harness<'static, PhotocraftApp> {
|
||||
let mut s = photocraft_engine::Session::new();
|
||||
if open_document {
|
||||
s.execute("file.new", json!({"width": 8, "height": 8})).unwrap();
|
||||
s.execute("layer.new.layer", json!({})).unwrap();
|
||||
}
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).with_max_steps(64).build_eframe(|cc| {
|
||||
PhotocraftApp::setup_context(&cc.egui_ctx, Default::default());
|
||||
PhotocraftApp::new(s, crate::Services::default())
|
||||
});
|
||||
h.run_steps(6);
|
||||
h
|
||||
}
|
||||
|
||||
/// A point in the Layers panel well below its last row (above the panel's bottom buttons).
|
||||
fn empty_point(h: &Harness<'static, PhotocraftApp>) -> Pos2 {
|
||||
let button = h.get_by_label("Create a new layer").rect();
|
||||
pos2(button.center().x - 20.0, button.top() - 80.0)
|
||||
}
|
||||
|
||||
fn click(h: &mut Harness<'static, PhotocraftApp>, p: Pos2, button: PointerButton) {
|
||||
h.event(egui::Event::PointerMoved(p));
|
||||
h.run_steps(1);
|
||||
h.event(egui::Event::PointerButton { pos: p, button, pressed: true, modifiers: egui::Modifiers::NONE });
|
||||
h.run_steps(1);
|
||||
h.event(egui::Event::PointerButton { pos: p, button, pressed: false, modifiers: egui::Modifiers::NONE });
|
||||
h.run_steps(3);
|
||||
}
|
||||
|
||||
fn open_menu(h: &mut Harness<'static, PhotocraftApp>) {
|
||||
let p = empty_point(h);
|
||||
click(h, p, PointerButton::Secondary);
|
||||
}
|
||||
|
||||
fn pick(h: &mut Harness<'static, PhotocraftApp>, label: &str) {
|
||||
h.get_by_label(label).click();
|
||||
h.run_steps(4);
|
||||
}
|
||||
|
||||
fn menu_open(h: &Harness<'static, PhotocraftApp>) -> bool {
|
||||
SIZES.iter().chain(CLIPS.iter()).any(|l| h.query_by_label(l).is_some())
|
||||
}
|
||||
|
||||
fn checked(h: &Harness<'static, PhotocraftApp>, label: &str) -> bool {
|
||||
h.get_by_label(label).accesskit_node().toggled() == Some(egui::accesskit::Toggled::True)
|
||||
}
|
||||
|
||||
fn size(h: &Harness<'static, PhotocraftApp>) -> LayerThumbnailSize {
|
||||
h.state().ui.layers_panel_options.thumbnail_size
|
||||
}
|
||||
|
||||
fn clip(h: &Harness<'static, PhotocraftApp>) -> bool {
|
||||
h.state().session.prefs().interface.clip_thumbnails_to_layer_bounds
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_menu_lists_the_six_entries_in_order_with_a_separator() {
|
||||
let mut h = panel(true);
|
||||
open_menu(&mut h);
|
||||
let ys: Vec<f32> = SIZES.iter().chain(CLIPS.iter()).map(|l| h.get_by_label(l).rect().top()).collect();
|
||||
assert_eq!(ys.len(), 6);
|
||||
assert!(ys.windows(2).all(|w| w[0] < w[1]), "entries top to bottom in the issue's order: {ys:?}");
|
||||
let step = ys[1] - ys[0];
|
||||
assert!(ys[4] - ys[3] > step + 1.0, "the separator sits between Large Thumbnails and the clip entries: {ys:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_current_size_and_clip_choice_are_the_ones_checked() {
|
||||
let mut h = panel(true);
|
||||
h.state_mut().ui.layers_panel_options.thumbnail_size = LayerThumbnailSize::Large;
|
||||
h.state_mut().run("prefs.set", json!({"path": "interface.clipThumbnailsToLayerBounds", "value": true})).unwrap();
|
||||
h.run_steps(2);
|
||||
open_menu(&mut h);
|
||||
assert!(menu_open(&h));
|
||||
assert!(checked(&h, "Large Thumbnails"), "Large is the current size");
|
||||
for other in ["No Thumbnails", "Small Thumbnails", "Medium Thumbnails"] {
|
||||
assert!(!checked(&h, other), "{other}");
|
||||
}
|
||||
assert!(checked(&h, "Clip Thumbnails to Layer Bounds"));
|
||||
assert!(!checked(&h, "Clip Thumbnails to Document Bounds"));
|
||||
|
||||
pick(&mut h, "Clip Thumbnails to Document Bounds");
|
||||
assert!(!clip(&h));
|
||||
open_menu(&mut h);
|
||||
assert!(checked(&h, "Clip Thumbnails to Document Bounds"));
|
||||
assert!(!checked(&h, "Clip Thumbnails to Layer Bounds"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_size_pick_sets_the_panel_option_and_saves_it() {
|
||||
for (label, want) in [
|
||||
("No Thumbnails", LayerThumbnailSize::None),
|
||||
("Small Thumbnails", LayerThumbnailSize::Small),
|
||||
("Large Thumbnails", LayerThumbnailSize::Large),
|
||||
("Medium Thumbnails", LayerThumbnailSize::Medium),
|
||||
] {
|
||||
let mut h = panel(true);
|
||||
h.state_mut().ui.layers_panel_options.thumbnail_size =
|
||||
if want == LayerThumbnailSize::Large { LayerThumbnailSize::Small } else { LayerThumbnailSize::Large };
|
||||
h.run_steps(2);
|
||||
open_menu(&mut h);
|
||||
pick(&mut h, label);
|
||||
assert_eq!(size(&h), want, "{label}");
|
||||
assert!(!menu_open(&h), "{label}: the menu closes");
|
||||
let saved = h.state().session.prefs().dialogs.get("ui.layersPanelOptions").cloned();
|
||||
let saved = saved.expect("the choice is saved as Panel Options saves it");
|
||||
assert_eq!(saved, serde_json::to_value(&h.state().ui.layers_panel_options).unwrap(), "{label}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_clip_pick_sets_the_preference() {
|
||||
let mut h = panel(true);
|
||||
assert!(!clip(&h));
|
||||
open_menu(&mut h);
|
||||
pick(&mut h, "Clip Thumbnails to Layer Bounds");
|
||||
assert!(clip(&h));
|
||||
assert_eq!(crate::panels::layers_panel_ui::thumbnail_contents(h.state()), crate::state::LayerThumbnailContents::LayerBounds, "Panel Options agrees");
|
||||
open_menu(&mut h);
|
||||
pick(&mut h, "Clip Thumbnails to Document Bounds");
|
||||
assert!(!clip(&h));
|
||||
assert_eq!(crate::panels::layers_panel_ui::thumbnail_contents(h.state()), crate::state::LayerThumbnailContents::EntireDocument);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_left_click_on_the_empty_area_still_deselects_and_a_right_click_does_not() {
|
||||
let mut h = panel(true);
|
||||
let selected = |h: &Harness<'static, PhotocraftApp>| h.state().session.active().unwrap().selected_layers().len();
|
||||
h.run_steps(3);
|
||||
let before = selected(&h);
|
||||
assert!(before > 0);
|
||||
open_menu(&mut h);
|
||||
assert!(menu_open(&h));
|
||||
assert_eq!(selected(&h), before, "a right-click does not deselect");
|
||||
h.key_press(egui::Key::Escape);
|
||||
h.run_steps(3);
|
||||
let p = empty_point(&h);
|
||||
click(&mut h, p, PointerButton::Primary);
|
||||
assert_eq!(selected(&h), 0, "a left click deselects every layer");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_no_document_nothing_opens() {
|
||||
let mut h = panel(false);
|
||||
let p = pos2(1100.0, 400.0);
|
||||
click(&mut h, p, PointerButton::Secondary);
|
||||
assert!(!menu_open(&h));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_right_click_on_a_layer_row_still_opens_the_layer_menu() {
|
||||
let mut h = panel(true);
|
||||
let row = h.get_all_by_label("Layer 1").next().expect("the new layer's row").rect();
|
||||
click(&mut h, row.center(), PointerButton::Secondary);
|
||||
assert!(h.query_by_label("Duplicate Layer…").is_some() || h.query_by_label("Duplicate Layer").is_some(), "the layer menu opened");
|
||||
assert!(h.query_by_label("No Thumbnails").is_none(), "not the empty-area menu");
|
||||
}
|
||||
@@ -962,3 +962,4 @@ mod pen_path_ownership_tests;
|
||||
#[cfg(test)]
|
||||
mod selection_move_step_tests;
|
||||
mod preferences_submenu_tests;
|
||||
mod layers_empty_area_menu_tests;
|
||||
@@ -44,6 +44,7 @@ pub mod layer_row_ui;
|
||||
pub(super) mod layer_transfer;
|
||||
pub mod layer_tree_ui;
|
||||
mod layers;
|
||||
mod layers_empty_menu;
|
||||
pub mod layers_panel_ui;
|
||||
pub(super) mod mask_props_ui;
|
||||
pub mod mask_thumbs_ui;
|
||||
|
||||
@@ -314,8 +314,13 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
// A click on that empty space deselects every layer, as in Photoshop (#8100). It
|
||||
// starts under the last layer's sub-rows, which take their own clicks.
|
||||
let empty = Rect::from_min_max(pos2(below.left(), rows_bottom), below.max);
|
||||
if empty.height() > 0.0 && ui.interact(empty, ui.scope_id().with("layers-empty-space"), Sense::click()).clicked() && !selection.is_empty() {
|
||||
actions.push(("select.deselectLayers".into(), json!({})));
|
||||
if empty.height() > 0.0 {
|
||||
let response = ui.interact(empty, ui.scope_id().with("layers-empty-space"), Sense::click());
|
||||
if response.clicked() && !selection.is_empty() {
|
||||
actions.push(("select.deselectLayers".into(), json!({})));
|
||||
}
|
||||
// A right-click there opens the thumbnail size and clipping choices (#11404).
|
||||
response.context_menu(|ui| super::layers_empty_menu::show(app, ui));
|
||||
}
|
||||
}
|
||||
// Tab / ⇧Tab in a rename: rename the layer below / above next, as in Photoshop. The
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//! The menu a right-click on the empty area below the last layer row opens (#11404): the
|
||||
//! thumbnail size and what a thumbnail frames. Both are the settings Panel Options... edits.
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::state::LayerThumbnailSize;
|
||||
|
||||
/// The four sizes, in menu order.
|
||||
pub(super) fn sizes() -> [(LayerThumbnailSize, &'static str); 4] {
|
||||
[
|
||||
(LayerThumbnailSize::None, tl!("No Thumbnails")),
|
||||
(LayerThumbnailSize::Small, tl!("Small Thumbnails")),
|
||||
(LayerThumbnailSize::Medium, tl!("Medium Thumbnails")),
|
||||
(LayerThumbnailSize::Large, tl!("Large Thumbnails")),
|
||||
]
|
||||
}
|
||||
|
||||
pub(super) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let current = app.ui.layers_panel_options.thumbnail_size;
|
||||
for (size, label) in sizes() {
|
||||
let mut on = current == size;
|
||||
if crate::widgets::checkbox(ui, &mut on, label).clicked() {
|
||||
app.ui.layers_panel_options.thumbnail_size = size;
|
||||
super::layers_panel_ui::persist_options(app);
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
ui.separator();
|
||||
let clip = app.session.prefs().interface.clip_thumbnails_to_layer_bounds;
|
||||
for (to_layer, label) in [(true, tl!("Clip Thumbnails to Layer Bounds")), (false, tl!("Clip Thumbnails to Document Bounds"))] {
|
||||
let mut on = clip == to_layer;
|
||||
if crate::widgets::checkbox(ui, &mut on, label).clicked() {
|
||||
if clip != to_layer
|
||||
&& let Err(e) = app.run("prefs.set", json!({"path": "interface.clipThumbnailsToLayerBounds", "value": to_layer}))
|
||||
{
|
||||
app.ui.status = e;
|
||||
app.ui.status_error = true;
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user