From 596ec54b592dc6c3492c7e149b79684824ba508a Mon Sep 17 00:00:00 2001 From: Zinadin Zidan Date: Mon, 16 Nov 2026 15:22:24 +0600 Subject: [PATCH] Slide show: play a slide's animations again when the show advances to it (#2090) (#2126) ShowState remembers what was played on each visited slide, so a slide reached again by a link or by Back looks as it was left. Going forward used the same path: next() entered a visited slide at the step it was left at, so after Back and forward again its entrance effects did not play and the shapes were already in place. next() now forgets the slide's run before entering it, when it moves to the next slide and when a looping show comes round to the first one. The slide starts over: its automatic first step plays, an On Click build starts at its first step, and its triggered animations start over. Back, links, Go to slide and Return to Zoom are unchanged. --- ROADMAP.md | 4 ++- crates/anim/src/interact.rs | 3 +- crates/anim/src/show.rs | 15 +++++++-- crates/anim/src/tests.rs | 52 +++++++++++++++++++++++++++++++ crates/anim/src/tests_interact.rs | 17 ++++++++++ docs/slideshow-parity.md | 6 ++-- 6 files changed, 90 insertions(+), 7 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index a67c5e7ab..c1a9cbc39 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away -> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-11 · **Change:** trivial (slide-list entries with missing relationships are reported as lost slides and open as repaired copies; the Opus decoder and the Ogg, MP4 and Matroska demuxers come from craft-libs; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-14 · **Change:** trivial (a slide the show advances to again plays its animations again, #2090; slide-list entries with missing relationships are reported as lost slides and open as repaired copies; the Opus decoder and the Ogg, MP4 and Matroska demuxers come from craft-libs; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-03 · **Change:** trivial (progress log: web `?host=parent` bridge opens and saves through a same-origin framing page; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-03 · **Change:** trivial (community PR wave 10: PPTX and native saves keep table cell centred anchoring, text overflow, compatible line spacing, normalised character height, Thai distributed alignment, RTL table direction, alternate run language and reflection transforms; imported effects placed by parent time-node delays; Reuse Slides fits the destination size and brings custom table styles; deleted slides leave custom shows; merged shapes drop their animations; Compress Pictures measures grouped pictures at displayed size; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -154,6 +154,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-11-14 | Slide show: a slide the show advances to again (click, →, Space, automatic advance or a loop) starts over, so its animations play again, as in PowerPoint. Back and links still show it as it was left (#2090) | | 2026-11-11 | Media: the Opus decoder and the Ogg, MP4/MOV and Matroska demuxers are craft-audio and craft-media from craft-libs; DeckCraft's own copies and re-export crates are removed | | 2026-11-07 | PPTX slide-list entries with missing relationships are reported in lostSlides instead of silently omitted. The engine opens the partial deck as a repaired copy with no original save path. Slide lists over 10,000 entries are explicitly refused before a partial load; exactly 10,000 remain supported. Synthetic 13-slide regression; does not establish the cause of #1910's field report. | | 2026-11-04 | Ogg Opus recovery keeps trailing packets without granules in the total duration, matching their recovered positions; valid end trimming stays covered | @@ -342,6 +343,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| +| 2026-11-14 | trivial | Progress log: a slide the show advances to again plays its animations again (#2090); parity scores unchanged | | 2026-11-11 | trivial | Opus and container code moved to craft-libs crates; parity scores unchanged | | 2026-11-04 | trivial | Ogg Opus recovery duration includes its recovered tail; parity scores unchanged | | 2026-11-02 | trivial | Progress log: run alternate-language metadata round-trips through native and PPTX formats; product parity scores unchanged | diff --git a/crates/anim/src/interact.rs b/crates/anim/src/interact.rs index e32d980e8..a66b241e7 100644 --- a/crates/anim/src/interact.rs +++ b/crates/anim/src/interact.rs @@ -9,7 +9,8 @@ //! - a shape with a link and a triggered animation follows the link at once. The animation's clock //! runs only while its slide is shown, so it goes on where it stopped when the show returns; //! - with "advance on click" off a click never leaves the slide, but it still plays animation steps; -//! - a slide the show returns to (link or arrow keys) looks as it was left. +//! - a slide the show returns to by a link or by going back looks as it was left; going forward +//! to a slide starts it over (#2090). use deckcraft_model::text::Action; use deckcraft_model::{Presentation, ShapeId}; diff --git a/crates/anim/src/show.rs b/crates/anim/src/show.rs index 15fb8ce9f..1320688a5 100644 --- a/crates/anim/src/show.rs +++ b/crates/anim/src/show.rs @@ -47,7 +47,8 @@ pub enum LinkJump { /// Where a slide show is. Besides the current position it remembers what was played on every slide /// the show has visited (main steps, triggered sequences), so a slide reached again by a link or -/// the arrow keys looks the way it was left, as in PowerPoint. +/// by going back looks the way it was left, as in PowerPoint. Going forward to a slide starts it +/// over, so its animations play again (#2090). #[derive(Clone, Debug, PartialEq, Default)] pub struct ShowState { /// Index into `presentation.slides`. @@ -226,6 +227,14 @@ impl ShowState { } } + /// Advance to slide `i`: it starts over, as if the show had not been there, so its + /// animations play again (#2090). Links and Back keep a slide as it was left. + fn enter_forward(&mut self, pres: &Presentation, i: usize) { + self.leave(pres); + self.runs.remove(&i); + self.enter(pres, i); + } + fn next_index(&self, pres: &Presentation) -> Option { let order = self.visit(pres); match order.iter().position(|&i| i == self.slide) { @@ -271,12 +280,12 @@ impl ShowState { } match self.next_index(pres) { Some(i) => { - self.enter(pres, i); + self.enter_forward(pres, i); ShowAction::Slide(i) } None if looping(pres) => match self.visit(pres).first() { Some(&i) => { - self.enter(pres, i); + self.enter_forward(pres, i); ShowAction::Slide(i) } None => { diff --git a/crates/anim/src/tests.rs b/crates/anim/src/tests.rs index 385520b6d..562004ef2 100644 --- a/crates/anim/src/tests.rs +++ b/crates/anim/src/tests.rs @@ -876,6 +876,8 @@ fn show_back_leaves_a_slide_whose_first_step_is_automatic() { // While the automatic step plays. assert_eq!(s.prev(&p), ShowAction::Slide(0), "{start:?}"); assert_eq!(s.next(&p), ShowAction::Slide(1)); + // Going forward again plays the automatic step again (#2090). + assert_eq!(s.step_done(&p), ShowAction::FinishStep(0), "{start:?}"); // Once it has played, the click step is undone first, then Back leaves the slide. assert_eq!(s.next(&p), ShowAction::PlayStep(1)); assert_eq!(s.step_done(&p), ShowAction::FinishStep(1)); @@ -885,6 +887,56 @@ fn show_back_leaves_a_slide_whose_first_step_is_automatic() { } } +#[test] +fn a_slide_entered_going_forward_again_plays_its_animations_again() { + // #2090: the show remembered slide 2 as fully built, so its entrance effects did not play the + // second time the show advanced to it. + for start in [AnimStart::WithPrevious, AnimStart::AfterPrevious] { + let mut p = pres(3); + Arc::make_mut(&mut p.slides[1]).shapes = vec![shape(1, "A")]; + Arc::make_mut(&mut p.slides[1]).animations = vec![anim(1, AnimClass::Entrance, "fade", start)]; + let mut s = ShowState::new(&p); + assert_eq!(s.next(&p), ShowAction::Slide(1)); + assert_eq!(s.step_done(&p), ShowAction::FinishStep(0)); + assert_eq!(s.prev(&p), ShowAction::Slide(0), "{start:?}"); + assert_eq!(s.next(&p), ShowAction::Slide(1)); + assert_eq!((s.step, s.playing), (0, true), "{start:?}: the slide starts again"); + let a = ShowState::timeline(&p, 1).state(ShapeId(1), None, s.step, 0.0); + assert!(!a.visible || a.opacity < 0.01, "{start:?}: the shape has not come in yet"); + // Back from the next slide still shows it as it was left. + assert_eq!(s.step_done(&p), ShowAction::FinishStep(0)); + assert_eq!(s.next(&p), ShowAction::Slide(2)); + assert_eq!(s.prev(&p), ShowAction::Slide(1)); + assert_eq!((s.step, s.playing), (1, false), "{start:?}"); + } + // An On Click build left by a jump starts again when the show advances to the slide. + let mut p = pres(2); + Arc::make_mut(&mut p.slides[1]).shapes = vec![shape(1, "A")]; + Arc::make_mut(&mut p.slides[1]).animations = vec![anim(1, AnimClass::Entrance, "fade", AnimStart::OnClick)]; + let mut s = ShowState::new(&p); + assert_eq!(s.next(&p), ShowAction::Slide(1)); + assert_eq!(s.next(&p), ShowAction::PlayStep(0)); + assert_eq!(s.step_done(&p), ShowAction::FinishStep(0)); + assert_eq!(s.goto(&p, 0), ShowAction::Slide(0)); + assert_eq!(s.next(&p), ShowAction::Slide(1)); + assert_eq!((s.step, s.playing), (0, false)); +} + +#[test] +fn a_looping_show_plays_the_first_slide_again() { + // #2090: a kiosk or loop-until-Esc show comes round to the first slide going forward. + let mut p = pres(2); + p.show.loop_until_esc = true; + Arc::make_mut(&mut p.slides[0]).shapes = vec![shape(1, "A")]; + Arc::make_mut(&mut p.slides[0]).animations = vec![anim(1, AnimClass::Entrance, "fade", AnimStart::WithPrevious)]; + let mut s = ShowState::new(&p); + assert!(s.playing); + assert_eq!(s.step_done(&p), ShowAction::FinishStep(0)); + assert_eq!(s.next(&p), ShowAction::Slide(1)); + assert_eq!(s.next(&p), ShowAction::Slide(0)); + assert_eq!((s.step, s.playing), (0, true)); +} + #[test] fn show_auto_advance() { let mut p = pres(2); diff --git a/crates/anim/src/tests_interact.rs b/crates/anim/src/tests_interact.rs index 1d2810811..ab2a0b40b 100644 --- a/crates/anim/src/tests_interact.rs +++ b/crates/anim/src/tests_interact.rs @@ -325,6 +325,23 @@ fn a_slide_comes_back_the_way_it_was_left() { assert_eq!(s.step, ShowState::steps(&pres, 1)); } +#[test] +fn a_slide_entered_going_forward_again_starts_over() { + // #2090: the show advances to slide 2 a second time; its triggered animation is undone too. + let s1 = slide(1000, vec![], vec![], true); + let s2 = slide(1001, vec![shape(4)], vec![exit_on_click(4, 4, 0)], true); + let pres = Presentation { slides: vec![s1, s2], ..Default::default() }; + let mut r = Run::new(pres, vec![vec![], vec![hit(4, None)]]); + assert_eq!(r.show.next(&r.pres), ShowAction::Slide(1)); + assert_eq!(r.click(), Click::Animated); + assert!(!r.visible(ShapeId(4))); + assert_eq!(r.show.prev(&r.pres), ShowAction::Slide(0)); + assert_eq!(r.show.prev(&r.pres), ShowAction::None); + assert_eq!(r.show.next(&r.pres), ShowAction::Slide(1)); + assert!(r.visible(ShapeId(4)), "the shape is back"); + assert!(r.show.trigger_plays().is_empty()); +} + #[test] fn a_playing_main_step_is_finished_when_the_show_leaves() { let a = Animation { shape: ShapeId(1), class: AnimClass::Entrance, effect: "fade".into(), duration_ms: 500, ..Default::default() }; diff --git a/docs/slideshow-parity.md b/docs/slideshow-parity.md index 08fff1b5f..96938c0c4 100644 --- a/docs/slideshow-parity.md +++ b/docs/slideshow-parity.md @@ -1,6 +1,6 @@ # Slide show and presenter view: parity with PowerPoint -> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-02 · **Change:** minor (deleting slides removes them from custom shows; previous: minor, Presenter View only with a second display on Linux and the BSDs, #1156; previous: minor, Set Up Slide Show ▸ Keep mouse cursor visible, #1445; previous: minor, Ctrl+wheel zooms the show around the pointer, #1286; previous: major, community PR wave 2026-10-14: interactive decks, laser pointer, See All Slides and zoom, go-to-slide number, custom show playback, presenter timer, clock, notes size and keyboard, Show Media Controls, swipe; breadth 68%; duplicated rows and headers folded; previous: major, created) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-14 · **Change:** minor (a slide the show advances to again plays its animations again, #2090; previous: minor, deleting slides removes them from custom shows; previous: minor, Presenter View only with a second display on Linux and the BSDs, #1156; previous: minor, Set Up Slide Show ▸ Keep mouse cursor visible, #1445; previous: minor, Ctrl+wheel zooms the show around the pointer, #1286; previous: major, community PR wave 2026-10-14: interactive decks, laser pointer, See All Slides and zoom, go-to-slide number, custom show playback, presenter timer, clock, notes size and keyboard, Show Media Controls, swipe; breadth 68%; duplicated rows and headers folded; previous: major, created) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) Presenting is the job PowerPoint is hired for. This doc covers the show window, presenter view, rehearsal and recording. Transition and animation playback are in @@ -23,7 +23,8 @@ ready** (estimated), **10–16 h** to parity. | Hidden slides skipped | yes | yes | | | Hyperlinks and action settings followed (slides, web, mail, End Show, Last Viewed) | yes | yes | Only `http(s)` and `mailto` open outside the show, by design (`safe_url`) | | A shape with a triggered animation plays it when clicked; shapes an animation has hidden cannot be clicked; a shape without an action on top of one with an action blocks it; the pointer is a hand over what can be clicked | yes | yes | Click boxes are bounding boxes; "play sound" actions (`ppaction://media`) do nothing yet | -| A slide the show returns to (link, arrow keys) looks as it was left; a triggered animation goes on where it stopped | yes | yes | A main-sequence step still playing when the show leaves is finished | +| A slide the show returns to by a link or Back looks as it was left; a triggered animation goes on where it stopped | yes | yes | A main-sequence step still playing when the show leaves is finished | +| A slide the show advances to again (click, →, Space, automatic advance, loop) starts over and plays its animations again | yes | yes | Its triggered animations start over too (#2090) | | "Advance on click" off: a click never leaves the slide (animation steps still play, keys still move on) | yes | yes | | | Hyperlinks and action settings followed (slides, web, mail, End Show, Last Viewed, Custom Show) | yes | yes | Only `http(s)` and `mailto` open outside the show, by design (`safe_url`). A Custom Show action plays that show | | Media playback with controls, play across slides, full-screen video, Play/Pause/Stop in the click sequence | yes | yes | WMA/WMV not decodable. Click sequence since #116. Slide Show ▸ Show Media Controls (on by default) hides the playback bar. Seeks and loops preserve new-generation video frames and end-of-stream; queue regression and repeated seeks across H.264/HEVC/VP9/AV1 in `crates/media` | @@ -96,4 +97,5 @@ Reading View in a window with navigation: present (checklist row done). | 2026-10-14 | minor | See All Slides (G) and click-to-zoom (Z) during the show. Presenter view opens that grid and sets black, white and zoom. Checklist breadth stays 66% | | 2026-10-24 | minor | Ctrl+wheel (Cmd+wheel on a Mac) zooms the show in and out around the pointer, up to 4×; the plain wheel still turns the page (#1286) | | 2026-10-23 | trivial | Presenter view draws the notes with their formatting (bullets, numbers, indents, bold/italic) instead of plain text (#1128) | +| 2026-11-14 | minor | A slide the show advances to again starts over, so its entrance effects play again; Back and links still show it as it was left (#2090) | | 2026-10-10 | major | Created: show, presenter view, rehearse and record, compared with PowerPoint 16.113's Slide Show tab and menu |