show: the scope owns Escape, the presenter trial draws the arrow glyphs, the prefetch trial enters through the state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dylan M. TaylorandClaude Opus 5.5 committed 2026-11-27 18:32:31 +00:00
1 parent 8d162e02d3
commit 3d46eddae1
4 files changed
+7 -6

No files matched your search

+3 -1
View File
@@ -323,7 +323,9 @@ mod tests {
.with_step_dt(1.0 / 60.0)
.with_context_setup(|ctx| {
let install = craft::ui::runtime::InstallSpec::new(Default::default(), std::sync::Arc::new(craft::window::system::NoWindows));
embed::install(ctx, install, &UiFonts::new(&I18nScripts)).unwrap();
// The app's symbol face, which draws the ◀ and ▶ of the Previous and Next buttons.
let fonts = UiFonts::new(&I18nScripts).egui_face("Hack", &[craft::ui::fonts::FontRef::proportional()]);
embed::install(ctx, install, &fonts).unwrap();
embed::before_input(ctx, |_| FrameInput::new(RootEnv::default()));
})
.build_ui_state(
+2 -1
View File
@@ -420,7 +420,8 @@ fn the_prefetched_frame_is_the_frame_shown_on_entry() {
let room = vec2(size.0 as f32, size.1 as f32) / ctx.pixels_per_point();
let _ = prepare(&mut show, &doc, &media, ctx, 0.0, &[], room);
show.frames.run_inline(16);
assert!(show.apply(ShowAction::Slide(1), &doc, 1.0));
let enter = show.state.goto(&doc, 1);
assert!(show.apply(enter, &doc, 1.0));
let _ = prepare(&mut show, &doc, &media, ctx, 1.0, &[], room);
let texture = show.frames.current_texture().expect("the prefetched slide is shown");
assert_eq!(show.frames.shown_slide(), Some(1));
+2 -3
View File
@@ -252,8 +252,8 @@ impl CanvasTool for ShowTool<'_> {
}
}
/// The canvas routes the arrows and Escape to its tool, not to the scope's shortcuts: they run the show
/// commands that bind them.
/// The canvas routes the arrows to its tool, not to the scope's shortcuts: they run the show commands
/// that bind them. Enter, Escape and the deletes stay with the show scope.
fn key(&mut self, key: &ToolKey, cx: &mut ToolContext<'_>) -> bool {
let command = match key {
ToolKey::Nudge { direction, mods, .. } if mods.is_none() => {
@@ -263,7 +263,6 @@ impl CanvasTool for ShowTool<'_> {
ShowCommands::Previous
}
}
ToolKey::Cancel => ShowCommands::Cancel,
_ => return false,
};
let Some(space) = cx.space() else { return false };
-1
View File
@@ -232,7 +232,6 @@ fn publish(bcx: &mut BodyCx<'_>, show: &Show) {
fn commands(bcx: &mut BodyCx<'_>, show: &mut Show, doc: &Arc<Presentation>, now: f64, zoom: &ShowZoomInputs<'_>, out: &mut Out) {
// take_command drains only this pass's firings; reruns never replay a held key or a previous click.
while let Some((command, _)) = bcx.take_command::<ShowCommands>() {
eprintln!("DIAG leaving_the_ppsx_show_keeps_the_deck_open: show command {command:?}");
out.keep &= run_command(show, doc, now, command, ShowWindow::Audience, zoom);
}
}