Show a presenter-only end-of-slides placeholder in next preview
This commit is contained in:
parent
21198afa11
commit
9b02c64043
|
|
@ -2212,7 +2212,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pdf-presenter"
|
||||
version = "0.1.29"
|
||||
version = "0.1.30"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
|
|||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.29"
|
||||
version = "0.1.30"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ pub fn tr<'a>(ctx: &egui::Context, text: &'a str) -> &'a str {
|
|||
"Storage locations" => "Emplacements de stockage",
|
||||
"Preparing slide…" => "Préparation de la diapositive…",
|
||||
"No slide" => "Aucune diapositive",
|
||||
"End of slides" => "Fin des diapositives",
|
||||
"Size" => "Taille",
|
||||
"Keep header visible" => "Garder l’en-tête visible",
|
||||
"Keep footer visible" => "Garder le pied de page visible",
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
let count = items.iter().filter(|(_, _, w)| w.show).count();
|
||||
let width = preview.width() - 14. * count.saturating_sub(1) as f32;
|
||||
let mut x = preview.left();
|
||||
for (label, page, w) in items {
|
||||
for (index, (label, page, w)) in items.into_iter().enumerate() {
|
||||
if !w.show {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -349,6 +349,22 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
page,
|
||||
Rect::from_min_max(rect.min + Vec2::new(0., 24.), rect.max),
|
||||
);
|
||||
} else if index == 2 && s.count() > 0 && s.requested == s.count() - 1 {
|
||||
// Presenter-only decoration: never create a page, frame or navigation target.
|
||||
let area = Rect::from_min_max(rect.min + Vec2::new(0., 24.), rect.max);
|
||||
let painter = ui.painter().with_clip_rect(area);
|
||||
painter.rect_filled(area, 6., ui.visuals().extreme_bg_color);
|
||||
let text = painter.layout(
|
||||
tr(&locale, "End of slides").into(),
|
||||
FontId::proportional(24_f32.min(area.width() / 8.).max(1.)),
|
||||
ui.visuals().text_color(),
|
||||
(area.width() - 24.).max(1.),
|
||||
);
|
||||
painter.galley(
|
||||
area.center() - text.size() / 2.,
|
||||
text,
|
||||
ui.visuals().text_color(),
|
||||
);
|
||||
}
|
||||
x = rect.right() + 14.;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -602,3 +602,58 @@ fn timer_presets_reserve_space_and_progress_tracks_navigation() {
|
|||
assert!(text_rect(&output.shapes, "Elapsed time").is_none());
|
||||
assert!(text_rect(&output.shapes, "Time · HH:MM").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn end_of_slides_is_only_a_presenter_next_preview_not_a_page() {
|
||||
fn count_text(shape: &egui::Shape, label: &str) -> usize {
|
||||
match shape {
|
||||
egui::Shape::Text(t) => usize::from(t.galley.text() == label),
|
||||
egui::Shape::Vec(shapes) => shapes.iter().map(|s| count_text(s, label)).sum(),
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
s.settings.language = pdf_presenter::localization::Language::En;
|
||||
let mut native = UiState::default();
|
||||
for (total, requested, next_visible, expected) in [
|
||||
(3, 0, true, 0),
|
||||
(3, 1, true, 0),
|
||||
(3, 2, true, 1),
|
||||
(3, 2, false, 0),
|
||||
(1, 0, true, 1),
|
||||
(0, 0, true, 0),
|
||||
] {
|
||||
s.deck.as_mut().unwrap().names = (0..total).map(|i| i.to_string()).collect();
|
||||
s.requested = requested;
|
||||
s.layout.next.show = next_visible;
|
||||
let output = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| {
|
||||
presenter_ui::presenter(ui, &mut s, &mut native);
|
||||
});
|
||||
assert_eq!(
|
||||
output
|
||||
.shapes
|
||||
.iter()
|
||||
.map(|s| count_text(&s.shape, "End of slides"))
|
||||
.sum::<usize>(),
|
||||
expected
|
||||
);
|
||||
assert_eq!(s.count(), total);
|
||||
s.execute(Action::Go(total));
|
||||
assert_eq!(
|
||||
s.requested, requested,
|
||||
"The placeholder cannot be navigated to"
|
||||
);
|
||||
let output = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| {
|
||||
presenter_ui::browser(ui, &mut s, &mut native);
|
||||
});
|
||||
assert_eq!(
|
||||
output
|
||||
.shapes
|
||||
.iter()
|
||||
.map(|s| count_text(&s.shape, "End of slides"))
|
||||
.sum::<usize>(),
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### 0.1.30
|
||||
|
||||
- Show “End of slides” in the presenter's Next preview at the last real slide.
|
||||
This is a non-interactive placeholder, never a deck page, browser entry or
|
||||
audience frame. Navigation still stops at the last real slide. Linux tests,
|
||||
native X11 smoke, formatting, Clippy/rustdoc and Python checks pass; whole-app
|
||||
coverage is 86.82%. Windows/macOS runtime checks were not run.
|
||||
|
||||
### 0.1.29
|
||||
|
||||
- Draw numbered screen rectangles in Displays using each monitor's pixel aspect
|
||||
|
|
|
|||
|
|
@ -224,3 +224,11 @@ beside a slide when its proportions differ from the display (black by default).
|
|||
Both controls update the presenter previews, slide browser and audience output,
|
||||
and are saved for future sessions. Opaque artwork keeps its original colors.
|
||||
Blanking the audience output still shows black. Source documents remain unchanged.
|
||||
|
||||
## End of the deck
|
||||
|
||||
At the last slide, the presenter’s **Next** preview shows **End of slides**.
|
||||
This placeholder is not a real slide: it cannot be selected or shown to the
|
||||
audience, does not appear in All slides, and does not change the slide count.
|
||||
Advancing at the end keeps the last real slide selected. Hiding the Next preview
|
||||
also hides the placeholder.
|
||||
|
|
|
|||
Loading…
Reference in New Issue