Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LRC-LIB-REFVIEW: release both Reference panes when the pin is not live

Haocheng Fang33585c93efd4
diff --git a/crates/ui-egui/src/panels/compare.rs b/crates/ui-egui/src/panels/compare.rs
index 1ef368549..fd248ec99 100644
--- a/crates/ui-egui/src/panels/compare.rs
+++ b/crates/ui-egui/src/panels/compare.rs
@@ -461,7 +461,9 @@ pub fn prepare(app: &mut LightcraftApp) {
return;
}
if app.ui.view == ViewMode::Reference {
+ // the reference (pane 0) and the active photo beside it (pane 1)
app.renderer.release(Slot::Compare(0));
+ app.renderer.release(Slot::Compare(1));
}
app.session.media.set_full_capacity(1);
for i in 0..WINDOW_PANES {
diff --git a/crates/ui-egui/src/tests_compare.rs b/crates/ui-egui/src/tests_compare.rs
index 9f1038e53..f094f428f 100644
--- a/crates/ui-egui/src/tests_compare.rs
+++ b/crates/ui-egui/src/tests_compare.rs
@@ -274,6 +274,7 @@ fn deleting_the_pinned_reference_stops_drawing_it_and_reentry_uses_a_live_photo(
h.settle(SETTLE);
assert!(!drawn(&h), "Recently Deleted photos must not remain on the reference canvas");
assert!(!h.app.renderer.textures.contains_key(&crate::render::Slot::Compare(0)), "the deleted reference's pane is released");
+ assert!(!h.app.renderer.textures.contains_key(&crate::render::Slot::Compare(1)), "and the active photo's pane beside it");
assert!(h.app.compare_windows[0].is_none());
let r = h.app.run("view.reference", json!({})).unwrap();
assert_eq!(r["reference"], active.0);