From 414f2a39092fa34f3138fdbb64ede5b628dae65b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 27 Nov 2026 18:57:54 +0000 Subject: [PATCH] WIP red-app-r4-2: edits before the fixer was stopped (its job scope was capped at 4 GB); not built Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/canvas/tool.rs | 3 +-- crates/ui-egui/src/panels/thumbs.rs | 9 ++++----- crates/ui-egui/src/tests.rs | 22 +++++++++++++++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/canvas/tool.rs b/crates/ui-egui/src/canvas/tool.rs index 61a6055b4..fc5162bb9 100644 --- a/crates/ui-egui/src/canvas/tool.rs +++ b/crates/ui-egui/src/canvas/tool.rs @@ -101,7 +101,7 @@ impl<'a> EngineTool<'a> { fn end_twist_on_input(&mut self, cx: &ToolContext<'_>) { let turned_this_frame = self.app.twist_frame == Some(self.ctx.cumulative_frame_nr()); - if !turned_this_frame && cx.space().and_then(|space| space.wheel()).is_some_and(|wheel| wheel.rotation == 0.0) { + if !turned_this_frame && cx.space().and_then(|space| space.wheel()).is_none_or(|wheel| wheel.rotation == 0.0) { self.end_twist(); } } @@ -263,7 +263,6 @@ impl CanvasTool for EngineTool<'_> { if self.blocked() || self.app.anim_preview_active() || !cx.pointer_moved() { return; } - self.end_twist(); self.pointer(pointer, cx, PointerKind::Move); } diff --git a/crates/ui-egui/src/panels/thumbs.rs b/crates/ui-egui/src/panels/thumbs.rs index 181330738..afcf89f1c 100644 --- a/crates/ui-egui/src/panels/thumbs.rs +++ b/crates/ui-egui/src/panels/thumbs.rs @@ -149,12 +149,11 @@ pub(crate) fn body(app: &mut SlideApp, ui: &mut Ui, cx: &mut BodyCx<'_>) { // The board drains commands once. Only the command targeted at this pane changes its selection scope; // app commands fall through to the same run path the editor root uses. while let Some((command, fired)) = cx.take_command::() { - let params = if command == EditCommands::SelectAll && fired.target.is_some() && fired.target == cx.command_chain().innermost("pane") { - json!({"scope": "slides"}) + if command == EditCommands::SelectAll && fired.target.is_some() && fired.target == cx.command_chain().innermost("pane") { + let _ = app.run("edit.selectAll", json!({"scope": "slides"})); } else { - fired.command.params - }; - let _ = app.run(&fired.command.id, params); + app.fire(ui.ctx(), &fired); + } } for event in out.events { match event { diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 66ba60e7c..871349ab5 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -93,6 +93,18 @@ fn web_export_all_slides_gives_one_file_per_slide() { assert_eq!(one[0].0, "Deck.png"); } +/// The files a browser host downloaded: each Save the app asked for whose bytes arrived. A browser save is +/// a download, not a `Files::write`, so `ScriptedFiles::written` does not list it. +fn downloaded(files: &ScriptedFiles) -> Vec { + files + .requests() + .into_iter() + .filter(|request| request.kind == craft::host::PickKind::Save) + .filter_map(|request| request.file_name.map(std::path::PathBuf::from)) + .filter(|path| files.file(path).is_some()) + .collect() +} + /// A PNG may omit the background; JPEG remains opaque. #[test] fn web_png_export_can_leave_the_background_transparent() { @@ -100,10 +112,10 @@ fn web_png_export_can_leave_the_background_transparent() { let mut h = files_harness(Session::with_new(), files.clone()); let mut alpha = Vec::new(); for (format, extra) in [("png", json!({})), ("png", json!({"transparentBackground": true})), ("jpeg", json!({"transparentBackground": true}))] { - let before = files.written().len(); + let before = downloaded(&files).len(); assert!(h.state_mut().export_as(format, extra)); h.run_steps(2); - let written = files.written(); + let written = downloaded(&files); assert!(written.len() > before); let bytes = files.file(written.last().unwrap()).unwrap(); alpha.push(deckcraft_render::decode_image(&bytes).unwrap().get_pixel(2, 2).0[3]); @@ -119,17 +131,17 @@ fn every_listed_save_type_exports() { let mut h = files_harness(Session::with_new(), files.clone()); h.state_mut().session.execute("slide.new", &json!({})).unwrap(); for (id, _, _) in crate::backstage::SAVE_TYPES { - let before = files.written().len(); + let before = downloaded(&files).len(); assert!(h.state_mut().export_as(id, json!({})), "{id} exports"); h.run_steps(2); - let written = files.written(); + let written = downloaded(&files); assert!(written.len() > before, "{id} produces a file"); for path in &written[before..] { assert!(!files.file(path).unwrap().is_empty(), "{id}: {path:?}"); } } let title = h.state().session.active().unwrap().title(); - let names = files.written(); + let names = downloaded(&files); for name in [format!("{title}1.jpg"), format!("{title}2.jpg"), format!("{title}1.png"), format!("{title}2.png")] { assert!(names.iter().any(|p| p.file_name().is_some_and(|n| n == name.as_str())), "{name}: {names:?}"); }