LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Follow-up to #351: drag drafts without a window stay canvas-sized; de/es/ru hint
Claudeeab88ea30c72
diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.jsonindex ad625ccb8..e2bd2a73c 100644--- a/crates/ui-egui/locales/de.json+++ b/crates/ui-egui/locales/de.json@@ -129,6 +129,7 @@"Auto-Tag from Tracklog: GPS locations for your photos from a GPX track log, matched by capture time.": "Automatisches Verorten anhand eines GPS-Tracks: GPS-Orte für deine Fotos aus einem GPX-Track, abgeglichen nach Aufnahmezeit.","Auto-Tag from Tracklog…": "Anhand eines GPS-Tracks automatisch verorten…","Automatic": "Automatisch",+ "Automatic renders the Detail view at the size it is shown, up to the photo's own pixels. Choose a size to cap it: smaller is faster.": "Automatisch rendert die Detailansicht in der angezeigten Größe, bis zu den eigenen Pixeln des Fotos. Eine Größe wählen, um sie zu begrenzen: kleiner ist schneller.","Automatically Write Changes into XMP": "Änderungen automatisch in XMP schreiben","Automatically write changes into XMP sidecars": "Änderungen automatisch in XMP-Begleitdateien schreiben","Autumn Gold": "Herbstgold",@@ -741,7 +742,6 @@"Label": "Farbmarkierung","Landscape": "Landschaft","Language": "Sprache",- "Largest long edge the Detail view renders at; larger is sharper on big displays but slower.": "Längste Kante beim Rendern der Detailansicht; größere Werte sind auf großen Bildschirmen schärfer, aber langsamer.","Last": "Letzter","Last GPU fallback": "Letzter GPU-Fallback","Last commit": "Letzter Commit",diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.jsonindex 052eeb96e..d38b9ad6d 100644--- a/crates/ui-egui/locales/es.json+++ b/crates/ui-egui/locales/es.json@@ -112,6 +112,7 @@"Auto-Tag from Tracklog": "Etiquetar automáticamente desde el registro de ruta","Auto-Tag from Tracklog…": "Etiquetar automáticamente desde el registro de ruta…","Automatic": "Automático",+ "Automatic renders the Detail view at the size it is shown, up to the photo's own pixels. Choose a size to cap it: smaller is faster.": "Automático muestra la vista Detalle al tamaño en que se ve, hasta los píxeles propios de la foto. Elegir un tamaño para limitarla: cuanto más pequeño, más rápido.","Automatically Write Changes into XMP": "Escribir automáticamente los cambios en XMP","Automatically write changes into XMP sidecars": "Escribir automáticamente los cambios en los archivos XMP complementarios","Autumn Gold": "Oro otoñal",@@ -704,7 +705,6 @@"Label": "Etiqueta","Landscape": "Paisaje","Language": "Idioma",- "Largest long edge the Detail view renders at; larger is sharper on big displays but slower.": "Lado largo máximo con el que se renderiza la vista Detalle; un valor mayor es más nítido en pantallas grandes, pero más lento.","Last": "Último","Last GPU fallback": "Último recurso alternativo de GPU","Last commit": "Último commit",diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.jsonindex 365a4bf21..94ca6ac6d 100644--- a/crates/ui-egui/locales/ru.json+++ b/crates/ui-egui/locales/ru.json@@ -91,6 +91,7 @@"Auto-Tag from Tracklog": "Автопривязка по треку","Auto-Tag from Tracklog…": "Автопривязка по треку…","Automatic": "Автоматически",+ "Automatic renders the Detail view at the size it is shown, up to the photo's own pixels. Choose a size to cap it: smaller is faster.": "«Автоматически» отрисовывает детальный просмотр в показанном размере, но не больше собственных пикселей фото. Выберите размер, чтобы ограничить его: меньше — быстрее.","Automatically Write Changes into XMP": "Автоматически записывать изменения в XMP","Automatically write changes into XMP sidecars": "Автоматически записывать изменения в XMP-файлы","Autumn Gold": "Осеннее золото",@@ -587,7 +588,6 @@"Keywords you add appear here; ⌥1–⌥9 apply them.": "Добавленные вами ключевые слова появятся здесь; ⌥1–⌥9 применяют их.","Landscape": "Пейзаж","Language": "Язык",- "Largest long edge the Detail view renders at; larger is sharper on big displays but slower.": "Максимальная длинная сторона, с которой рисуется режим «Детализация»; больше — чётче на больших экранах, но медленнее.","Last": "Последний","Last view": "Последний вид","Lateral Chromatic Aberration": "Боковая хроматическая аберрация",diff --git a/crates/ui-egui/src/region.rs b/crates/ui-egui/src/region.rsindex db170da4b..8fe47f97b 100644--- a/crates/ui-egui/src/region.rs+++ b/crates/ui-egui/src/region.rs@@ -97,7 +97,11 @@ pub fn plan(settings: &crate::state::AppSettings, v: ViewSizes) -> LoupePlan {let drawn_long = if v.drawn_long.is_finite() { v.drawn_long.max(8.0) } else { canvas_long };let scale = if v.draft_scale.is_finite() { v.draft_scale.clamp(0.1, 1.0) } else { 1.0 };if !v.windows {- let main_edge = settings.loupe_edge(drawn_long * scale, v.native_long, v.texture_side);+ // the whole frame at the size it is drawn (an overlay or soft proof has no window); while a+ // slider drags, a canvas-sized draft as with windows: a drag at 1:1 must not render the+ // photo's every pixel each frame+ let long = if scale < 1.0 { drawn_long.min(canvas_long) } else { drawn_long };+ let main_edge = settings.loupe_edge(long * scale, v.native_long, v.texture_side);return LoupePlan { main_edge, window_edge: None };}// a user who chose a size above the preview source level (3840, 5120) means it; otherwise the@@ -277,6 +281,18 @@ mod tests {assert_eq!(drag.window_edge, still.window_edge);}+ // Given no window (an overlay, soft proofing), the view at rest renders the whole frame at the+ // size it is drawn, but a slider drag drafts at the canvas size like the windowed path+ #[test]+ fn without_a_window_a_drag_drafts_at_the_canvas_size() {+ let no_window = |draft_scale: f32| ViewSizes { windows: false, draft_scale, ..sizes(24000.0, 2800.0, 6000) };+ let still = plan(&auto(), no_window(1.0));+ let drag = plan(&auto(), no_window(0.6));+ assert_eq!(still.window_edge, None);+ assert!(still.main_edge > 2800, "at rest the zoomed frame: {still:?}");+ assert!(drag.main_edge <= 2800, "a drag drafts at most the canvas: {drag:?}");+ }+// Given the user capped the preview size, the whole-frame render obeys it, and a fit view// stays on it (no original decoded); a zoomed view still gets its sharp window#[test]