diff --git a/crates/ui-egui/src/show/presenter.rs b/crates/ui-egui/src/show/presenter.rs index 38b8d76bd2..ff93d369a8 100644 --- a/crates/ui-egui/src/show/presenter.rs +++ b/crates/ui-egui/src/show/presenter.rs @@ -148,7 +148,10 @@ pub(super) fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &std:: }; ctx.show_viewport_immediate( egui::ViewportId::from_hash_of("deckcraft_presenter"), - egui::ViewportBuilder::default().with_title("Presenter View — DeckCraft").with_inner_size([1100.0, 700.0]), + egui::ViewportBuilder::default() + .with_title("Presenter View — DeckCraft") + .with_inner_size([1100.0, 700.0]) + .with_min_inner_size([480.0, 280.0]), |ui, _| { if !keyboard(ui.ctx(), show, doc, now, true) { *keep = false; @@ -218,9 +221,18 @@ pub(super) fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &std:: } return; } - let left = Rect::from_min_max(avail.min, pos2(avail.min.x + avail.width() * 0.62, avail.max.y)); - let right = Rect::from_min_max(pos2(left.max.x + 16.0, avail.min.y), avail.max); - let cr = fit(Rect::from_min_max(left.min, pos2(left.max.x, left.min.y + left.height() * 0.8)), doc); + // An embedded/constrained host can be smaller than the native window minimum. + // Prioritize the scrollable notes there; bracket keys still adjust their size. + if avail.height() < 120.0 { + notes_area(ui, notes, show.notes_px, avail); + return; + } + // Keep the notes readable when the presenter window is short; the previews give + // up height before the notes header, padding and scroll viewport do. + let top = avail.min.y + (avail.height() * 0.62).min((avail.height() - 120.0).max(0.0)); + let left = Rect::from_min_max(avail.min, pos2(avail.min.x + avail.width() * 0.62, top)); + let right = Rect::from_min_max(pos2(left.max.x + 16.0, avail.min.y), pos2(avail.max.x, top)); + let cr = fit(left, doc); let cr = Rect::from_min_size(left.min, cr.size()); if let Some(t) = &cur_tex { ui.painter().image(t.id(), cr, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); @@ -258,23 +270,21 @@ pub(super) fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &std:: } } } - let notes_head = Rect::from_min_size(pos2(right.min.x, nr.max.y + 12.0), vec2(right.width(), 28.0)); + let notes_head = Rect::from_min_size(pos2(avail.min.x, cr.max.y.max(nr.max.y) + 12.0), vec2(avail.width(), 32.0)); let mut head = ui.new_child(egui::UiBuilder::new().max_rect(notes_head)); head.horizontal(|ui| { ui.label(egui::RichText::new("Notes").size(13.0).color(Color32::from_gray(170))); - if ui.button("A-").clicked() { + if button(ui, "A-").clicked() { show.nudge_notes(-NOTES_STEP); } ui.label(egui::RichText::new(format!("{}", show.notes_px as i32)).size(13.0).color(Color32::from_gray(200))); - if ui.button("A+").clicked() { + if button(ui, "A+").clicked() { show.nudge_notes(NOTES_STEP); } }); - let notes_rect = Rect::from_min_max(pos2(right.min.x, notes_head.max.y + 4.0), right.max); - let mut child = ui.new_child(egui::UiBuilder::new().max_rect(notes_rect)); - egui::ScrollArea::vertical().show(&mut child, |ui| { - presenter_notes(ui, notes, show.notes_px); - }); + // Black on white, like a printed page, for reading at a glance. + let notes_rect = Rect::from_min_max(pos2(avail.min.x, notes_head.max.y + 4.0), avail.max); + notes_area(ui, notes, show.notes_px, notes_rect); }); if ui.input(|i| i.viewport().close_requested()) { show.presenter = false; @@ -290,9 +300,20 @@ pub(super) fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &std:: } } +/// A notes viewport whose inset stays usable even below the normal native window minimum. +fn notes_area(ui: &mut Ui, notes: &deckcraft_model::text::TextBody, px: f32, rect: Rect) { + ui.painter().rect_filled(rect, CornerRadius::same(4), Color32::WHITE); + let inset = vec2((rect.width().max(0.0) * 0.25).min(12.0), (rect.height().max(0.0) * 0.25).min(12.0)); + let mut child = ui.new_child(egui::UiBuilder::new().max_rect(rect.shrink2(inset))); + egui::ScrollArea::vertical().show(&mut child, |ui| { + ui.set_width(ui.available_width()); + presenter_notes(ui, notes, px); + }); +} + /// The current slide's notes in the presenter's notes pane, `px` for 12 pt text. pub(super) fn presenter_notes(ui: &mut Ui, notes: &deckcraft_model::text::TextBody, px: f32) -> egui::Response { - let color = Color32::from_gray(230); + let color = Color32::BLACK; if notes.text().is_empty() { ui.label(egui::RichText::new("No notes.").size(px).color(color)) } else { diff --git a/crates/ui-egui/src/show/render.rs b/crates/ui-egui/src/show/render.rs index 29a0c8fb76..f9878293b4 100644 --- a/crates/ui-egui/src/show/render.rs +++ b/crates/ui-egui/src/show/render.rs @@ -154,10 +154,10 @@ pub(super) fn fit(avail: Rect, doc: &Presentation) -> Rect { /// A transition layer as an egui mesh: [`deckcraft_anim::layer_mesh`]'s triangles (perspective /// cards subdivided so their pictures stay straight) with per-vertex opacity. /// Where presenter view's "Next" preview goes: the column's width below its label, kept inside -/// the top 60% of the column. A portrait slide used to get the full width and a height many -/// times the window (a white slab over the notes and past the window edge). +/// the column. A portrait slide used to get the full width and a height many times the window +/// (a white slab over the notes and past the window edge). pub(super) fn next_rect(right: Rect, doc: &Presentation) -> Rect { - let area = Rect::from_min_max(right.min + vec2(0.0, 22.0), pos2(right.max.x, right.min.y + 22.0 + (right.height() - 22.0).max(0.0) * 0.6)); + let area = Rect::from_min_max(right.min + vec2(0.0, 22.0), pos2(right.max.x, right.max.y.max(right.min.y + 22.0))); Rect::from_min_size(area.min, fit(area, doc).size()) } diff --git a/crates/ui-egui/src/texture_limit_tests.rs b/crates/ui-egui/src/texture_limit_tests.rs index d73273e61f..69bb65b733 100644 --- a/crates/ui-egui/src/texture_limit_tests.rs +++ b/crates/ui-egui/src/texture_limit_tests.rs @@ -64,7 +64,34 @@ fn presenter_view_keeps_a_portrait_next_slide_in_its_column() { h.state_mut().run("show.start", json!({"from": 0})).unwrap(); h.run_steps(4); let img = h.render().unwrap(); - // Right of the Next column's narrow preview, below where a landscape one would end. - let px = img.get_pixel(1000, 600).0; + // Right of the Next column's narrow preview, below where a landscape one would end (and above + // the notes across the bottom). + let px = img.get_pixel(1000, 470).0; assert!(px[0] < 128 && px[1] < 128 && px[2] < 128, "the Next preview spills over the column: {px:?}"); + // The notes run across the bottom, black on white. + let px = img.get_pixel(600, 650).0; + assert!(px[0] > 240 && px[1] > 240 && px[2] > 240, "the notes area is white: {px:?}"); +} + +/// Resizing the presenter used to spend the available height on previews and their header, +/// leaving less than the notes padding and an inverted scroll viewport. +#[test] +fn presenter_notes_still_have_a_readable_viewport_in_a_short_window() { + let _gpu = crate::gpu_lock::gpu_lock(); + for height in [220.0, 280.0] { + let mut h = harness(tall_deck(), egui::vec2(800.0, height)); + h.run_steps(3); + h.state_mut().run("show.presenter", json!({"on": true})).unwrap(); + h.state_mut().run("show.start", json!({"from": 0})).unwrap(); + h.run_steps(4); + let img = h.render().unwrap(); + let (mut run, mut longest) = (0, 0); + for y in 0..img.height() { + let p = img.get_pixel(400, y).0; + run = if p[0] > 240 && p[1] > 240 && p[2] > 240 { run + 1 } else { 0 }; + longest = longest.max(run); + } + // A line of text and its padding must fit, rather than only a thin white strip. + assert!(longest >= 48, "notes have no usable scroll viewport at height {height}: {longest}px"); + } } diff --git a/docs/slideshow-parity.md b/docs/slideshow-parity.md index 96938c0c48..e5e4ac7c38 100644 --- a/docs/slideshow-parity.md +++ b/docs/slideshow-parity.md @@ -42,7 +42,7 @@ ready** (estimated), **10–16 h** to parity. | Feature | PowerPoint | DeckCraft | Notes | |---|---|---|---| -| Separate presenter window with current slide, next slide, notes | yes | yes (an egui viewport, 1100×700); the notes keep their bullets, numbers, indents and bold/italic, as in the notes pane | On Linux and the BSDs it stays off if winit lists exactly one display as the show starts, as in PowerPoint: on one display it covered the show, and the hidden window stalled every frame (#1156). If winit lists none, the setting is kept. There is not yet a way to switch to Presenter View by hand during a one-display show. macOS, Windows and the browser are unchanged | +| Separate presenter window with current slide, next slide, notes | yes | yes (an egui viewport, 1100×700); current and next previews are above a full-width notes area, with black text on white by default. The notes keep their bullets, numbers, indents and bold/italic, as in the notes pane | On Linux and the BSDs it stays off if winit lists exactly one display as the show starts, as in PowerPoint: on one display it covered the show, and the hidden window stalled every frame (#1156). If winit lists none, the setting is kept. There is not yet a way to switch to Presenter View by hand during a one-display show. macOS, Windows and the browser are unchanged | | Elapsed timer | yes | yes | | | Pause / reset timer, clock | yes | yes: Pause/Resume and Reset in presenter view (T pauses, R resets); the clock is local time, `--:--` where there is no clock | Pausing the timer does not pause the show, animations or rehearsal | | Slide counter, previous/next/end buttons | yes | yes | | @@ -80,6 +80,7 @@ Reading View in a window with navigation: present (checklist row done). | Date | Change | Summary | |---|---|---| +| 2026-11-21 | minor | Presenter notes run below the previews; A-/A+ use the presenter toolbar style. Short windows reserve notes height; constrained embedded hosts prioritize scrollable notes and bracket-key sizing. Native minimum: 480×280. Split from the display-placement work in #1225. | | 2026-11-02 | minor | On Linux and the BSDs, Presenter View stays off when winit lists exactly one display; if it lists none, the setting is kept (#1156) | | 2026-10-27 | minor | Set Up Slide Show ▸ Keep mouse cursor visible: full-screen shows keep a still pointer, so clickable choices stay targetable; Reading View unchanged (#1445) | | 2026-10-22 | minor | See All Slides from presenter view opens in presenter view, not on the audience screen (#1130) |