[fix]: bug when selecting slides in split pdf presentations
Some checks failed
/ clippy (push) Failing after 5m24s
/ test (push) Has been cancelled

This commit is contained in:
Chris Cochrun 2026-04-27 15:01:39 -05:00
parent 1b2a0c9761
commit 6c6d071b2b

View file

@ -135,6 +135,7 @@ impl PresentationEditor {
}
Message::Update(presentation) => {
warn!(?presentation, "about to update");
self.presentation = Some(presentation.clone());
return Action::UpdatePresentation(presentation);
}
Message::PickPresentation => {
@ -279,10 +280,23 @@ impl PresentationEditor {
self.current_slide_index = Some(previous_index);
}
Message::ChangeSlide(index) => {
let starting_index = if let Some(presentation) =
self.presentation.as_ref()
&& let PresKind::Pdf { starting_index, .. } =
presentation.kind
{
starting_index
} else {
0
};
self.current_slide =
self.document.as_ref().and_then(|doc| {
let page = doc
.load_page(i32::try_from(index).ok()?)
.load_page(
i32::try_from(index).ok()?
+ starting_index,
)
.ok()?;
let matrix = Matrix::IDENTITY;
let colorspace = Colorspace::device_rgb();