From bb05cf8adfaf20c72ec81f18161f3e2ff5dc6da5 Mon Sep 17 00:00:00 2001 From: pml68 Date: Sat, 7 Jun 2025 10:07:12 +0200 Subject: fix: animated theme change on startup when config theme != "Dark" --- crates/iced_drop/src/widget/droppable.rs | 20 +++++++++----------- src/main.rs | 10 ++++------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/crates/iced_drop/src/widget/droppable.rs b/crates/iced_drop/src/widget/droppable.rs index 063aef8..0e93bd0 100644 --- a/crates/iced_drop/src/widget/droppable.rs +++ b/crates/iced_drop/src/widget/droppable.rs @@ -462,19 +462,17 @@ where let state = tree.state.downcast_ref::(); - if self.on_drop.is_none() && cursor.is_over(layout.bounds()) { - return mouse::Interaction::NotAllowed; - } - - if let Action::Drag(_, _) = state.action { - return mouse::Interaction::Grabbing; - } - if cursor.is_over(layout.bounds()) { - return mouse::Interaction::Pointer; + if self.on_drop.is_none() { + mouse::Interaction::NotAllowed + } else if let Action::Drag(_, _) = state.action { + mouse::Interaction::Grabbing + } else { + mouse::Interaction::Pointer + } + } else { + mouse::Interaction::default() } - - mouse::Interaction::default() } } diff --git a/src/main.rs b/src/main.rs index 508b791..4d8c351 100644 --- a/src/main.rs +++ b/src/main.rs @@ -148,10 +148,10 @@ impl IcedBuilder { Message::ConfigLoad(result) => match result { Ok(config) => { self.config = Arc::new(config); - self.theme.update(self.config.selected_theme().into()); + self.theme.settle_at(self.config.selected_theme()); - return if let Some(path) = self.config.last_project() { - if path.exists() && path.is_file() { + if let Some(path) = self.config.last_project() { + return if path.exists() && path.is_file() { Task::perform( Project::from_path(path.to_owned()), Message::FileOpened, @@ -161,9 +161,7 @@ impl IcedBuilder { "The file {} does not exist, or isn't a file.", path.to_string_lossy() )) - } - } else { - Task::none() + }; }; } Err(error) => return error_dialog(error), -- cgit v1.2.3