From ae9c362e35996cfaa0595ca6fcb82939a6fa65e8 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 27 Apr 2026 15:08:18 -0500 Subject: [PATCH] [fix]: More flashes when loading images --- src/ui/presentation_editor.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ui/presentation_editor.rs b/src/ui/presentation_editor.rs index 29be885..f4d43aa 100644 --- a/src/ui/presentation_editor.rs +++ b/src/ui/presentation_editor.rs @@ -4,6 +4,7 @@ use std::ops::RangeBounds; use std::path::{Path, PathBuf}; use crate::core::presentations::{PresKind, Presentation}; +use crate::ui::widgets::loaded_image::loaded_image; use cosmic::dialog::file_chooser::FileFilter; use cosmic::dialog::file_chooser::open::Dialog; use cosmic::iced::alignment::Vertical; @@ -349,10 +350,12 @@ impl PresentationEditor { let presentation = self.current_slide.as_ref().map_or_else( || container(Space::new()), |slide| { - container( + container(loaded_image( + slide.clone(), widget::image(slide) - .content_fit(ContentFit::ScaleDown), - ) + .content_fit(ContentFit::ScaleDown) + .into(), + )) .style(|_| { container::background(Background::Color( cosmic::iced::Color::WHITE, @@ -368,11 +371,12 @@ impl PresentationEditor { .iter() .enumerate() .map(|(index, page)| { - let image = widget::image(page) + let image = loaded_image(page.clone(), widget::image(page) .height( theme::spacing().space_xxxl * 3, ) - .content_fit(ContentFit::ScaleDown); + .content_fit(ContentFit::ScaleDown).into()); + let slide = container(image).style(|_| { container::background(Background::Color( cosmic::iced::Color::WHITE,