Merge branch 'port/deckcraft/look/app-1' into port/deckcraft/area/app

This commit is contained in:
Dylan M. Taylor
2026-11-28 16:45:55 +00:00
6 changed files with 27 additions and 3 deletions
+1
View File
@@ -146,6 +146,7 @@ impl PopupApp {
},
grid: snapshot.grid,
zoom_armed: snapshot.zoom_armed,
zoomed: snapshot.zoomed,
zoom_frame: None,
current: current.as_ref().map_or(PreviewPic::Pending, PreviewPic::Shown),
next: if let Some(next) = &next {
+1 -1
View File
@@ -127,7 +127,7 @@ pub fn show(app: &mut SlideApp, ui: &mut egui::Ui) {
Picture::new("Slide preview", uid, &|| slide_image(&doc, key))
.revision(Revision::of(&key))
.aspect(ThumbAspect::from_ratio((doc.slide_size.width / doc.slide_size.height) as f32))
.extent(PictureSize::Fit)
.extent(PictureSize::FitCentred)
.show(ui);
});
});
+19
View File
@@ -56,6 +56,9 @@ pub struct Snapshot {
/// All slides is open in the presenter window (#1866); the audience keeps the current slide.
pub grid: bool,
pub zoom_armed: bool,
/// The audience sees a zoomed part of the slide.
#[serde(default)]
pub zoomed: bool,
pub current: Option<Preview>,
pub next: Option<Preview>,
/// The All slides thumbnails, in slide order, while `grid` is on. `None` in a sent delta
@@ -199,6 +202,7 @@ mod tests {
blank: None,
grid: false,
zoom_armed: false,
zoomed: false,
current: Some(Preview { width: 1, height: 1, rgba: vec![255; 4] }),
next: Some(Preview { width: 1, height: 1, rgba: vec![0; 4] }),
slides: None,
@@ -352,6 +356,7 @@ mod tests {
blank: None,
grid: snapshot.grid,
zoom_armed: snapshot.zoom_armed,
zoomed: snapshot.zoomed,
zoom_frame: None,
current: PreviewPic::Pending,
next: NextPic::Pending,
@@ -392,6 +397,20 @@ mod tests {
assert_eq!(h.state().snapshot.slide, original_slide, "only an audience snapshot changes the displayed position");
}
#[test]
fn zoom_reads_on_while_the_audience_is_zoomed() {
use egui::accesskit::Toggled;
use egui_kittest::kittest::{NodeT, Queryable};
for zoomed in [false, true] {
let mut snapshot = snapshot();
snapshot.zoomed = zoomed;
let mut h = popup_harness(snapshot);
h.run_steps(2);
let on = h.get_by_label("Zoom").accesskit_node().toggled() == Some(Toggled::True);
assert_eq!(on, zoomed, "Zoom stays on after the zoom click has zoomed the audience, as the audience window shows it");
}
}
#[test]
fn all_slides_opens_in_the_popup_and_picks_a_slide() {
use egui_kittest::kittest::Queryable;
+3 -1
View File
@@ -64,6 +64,8 @@ pub struct PresenterModel<'a> {
pub grid: bool,
/// Whether a click on the current picture requests a zoom.
pub zoom_armed: bool,
/// Whether the audience sees a zoomed part of the slide.
pub zoomed: bool,
/// Audience zoom bounds in unit coordinates over the current picture.
pub zoom_frame: Option<craft::behavior::kurbo::Rect>,
/// The frame shown to the audience.
@@ -89,7 +91,7 @@ pub fn presenter_body(ui: &mut egui::Ui, _cx: &mut BodyCx<'_>, model: &Presenter
(ShowCommands::Black, model.blank == Some(Blank::Black), "Black"),
(ShowCommands::White, model.blank == Some(Blank::White), "White"),
(ShowCommands::Grid, model.grid, "All slides"),
(ShowCommands::Zoom, model.zoom_armed, "Zoom"),
(ShowCommands::Zoom, model.zoom_armed || model.zoomed, "Zoom"),
(ShowCommands::Timer, model.paused, if model.paused { "Resume" } else { "Pause" }),
] {
let title = cx.env.resolve(&Word::plain(title).into());
+1 -1
View File
@@ -215,7 +215,7 @@ fn icons_popup(app: &mut SlideApp, ui: &mut Ui, cx: &mut BodyCx<'_>) {
}
// The library scrolls its own rows under the search field, showing as many rows as production's 420-point list.
if let Some(name) = IconPicker::new("Icons", Bind::given(None), &groups)
.group_display(IconPickerGroups::Headings)
.group_display(IconPickerGroups::FlatWhileSearching)
.search(IconPickerSearch::KeepsQuery)
.empty("No icons match.")
.max_rows(12)
+2
View File
@@ -123,6 +123,7 @@ pub(super) fn presenter_pass(ui: &mut Ui, app: &mut crate::SlideApp, show: &mut
blank: show.blank,
grid: show.presenter_grid,
zoom_armed: show.zoom_arm,
zoomed: show.zoomed,
zoom_frame: show.zoom_window().and_then(|rect| {
(size.width.is_finite() && size.width > 0.0 && size.height.is_finite() && size.height > 0.0)
.then(|| Rect::new(rect.x0 / size.width, rect.y0 / size.height, rect.x1 / size.width, rect.y1 / size.height))
@@ -247,6 +248,7 @@ fn remote_pass(
blank: show.blank_name().map(str::to_owned),
grid: show.presenter_grid,
zoom_armed: show.zoom_arm,
zoomed: show.zoomed,
current,
next: next_preview,
slides: show.presenter_grid.then(|| show.remote_grid.clone()),