Wire JXL codec import and preserve destination-tab path tracking after owned commit

This commit is contained in:
FredApps committed 2026-10-29 06:51:52 +01:00
1 parent 595d631372
commit bd52c643ca
3 files changed
+9 -1

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@ pub use crate::resolution::{exif_resolution, export_exif, export_xmp, photoshop_
pub use crate::source_settings::{WebpEncoding, jpeg_quality, webp_encoding};
pub use half::f16;
use crate::codecs::{dds, dicom, dpx, exr, fits, heif, iff, jpeg, pcx, png, pnm, tiff, via_image, webp, xpm};
use crate::codecs::{dds, dicom, dpx, exr, fits, heif, iff, jpeg, jxl, pcx, png, pnm, tiff, via_image, webp, xpm};
/// Detect the format and decode with default [`Limits`].
pub fn decode(bytes: &[u8]) -> Result<Image, CodecError> {
@@ -442,9 +442,13 @@ fn tab_switch_commits_only_the_valid_original_captured_saved_path() {
draft(&mut app);
let source = app.session.active().unwrap().doc.id;
app.session.execute("file.new", json!({"width":200,"height":200})).unwrap();
seed(&mut app, "Destination", 100.0);
app.ui.selected_path = Some("Destination".into());
let current = app.session.active().unwrap().doc.clone();
assert!(vector_ui::cancel_stale_pen(&mut app));
assert!(app.ui.pen.is_none());
app.sync_views();
assert_eq!(app.ui.selected_path.as_deref(), Some("Destination"));
assert!(std::sync::Arc::ptr_eq(&current, &app.session.active().unwrap().doc));
let old = app.session.documents().iter().find(|s| s.doc.id == source).unwrap();
assert_eq!(old.doc.paths.iter().find(|p| p.name == "Saved drawing").unwrap().path.subpaths.len(), 2);
+4
View File
@@ -249,6 +249,10 @@ pub(crate) fn cancel_stale_pen(app: &mut PhotocraftApp) -> bool {
}
let failed = app.ui.pen.take();
let message = app.ui.status.clone();
// The temporary source commit ran sync_views on that document. Rebind its runtime
// tracker before restoring the destination UI, so the next frame cannot clear
// an unrelated saved-path selection in the destination tab.
app.path_document = app.session.active().map(|st| (st.doc.id, st.revision, Arc::downgrade(&st.doc)));
app.ui = saved_ui;
app.ui.pen = if result.is_ok() { None } else { failed };
if result.is_err() {