Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge PR #8236: Add interactive drag positioning to print preview (new head)

aiongg9cba44307d48
diff --cc crates/ui-egui/src/file_ui.rs
index fc08415fc,14b5a2a0d..e014ca9e3
--- a/crates/ui-egui/src/file_ui.rs
+++ b/crates/ui-egui/src/file_ui.rs
@@@ -1371,20 -1296,10 +1378,22 @@@ fn print_body(app: &mut PhotocraftApp,
}
}
+/// `file.print`'s params. The driver's printable area only goes with a print to the printer:
+/// an output path or a preview set in the same frame as the confirm still drops it.
+fn print_params(f: &Map<String, Value>) -> Value {
+ let mut p = params(f);
+ if (b(f, "dryRun", false) || !s(f, "output", "").is_empty())
+ && let Some(o) = p.as_object_mut()
+ {
+ o.remove("printable");
+ }
+ p
+}
+
+ /// Submits the dialog parameters to `file.print`, propagating command errors unchanged.
+ /// Updates the status for completed results only; pending jobs report completion later.
fn print_confirm(app: &mut PhotocraftApp, f: &Map<String, Value>) -> Result<Value, String> {
- let r = app.run("file.print", params(f))?;
+ let r = app.run("file.print", print_params(f))?;
if r["pending"] != json!(true) {
print_status(app, &r);
}