From 510d68b92972b99868e187dd5340f04780b4c354 Mon Sep 17 00:00:00 2001 From: pml68 Date: Fri, 4 Oct 2024 00:44:02 +0200 Subject: feat: update to iced 0.13.1, basic project state file, prepare for drag&drop --- iced_drop/src/lib.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'iced_drop/src/lib.rs') diff --git a/iced_drop/src/lib.rs b/iced_drop/src/lib.rs index fc559dc..9906cbe 100644 --- a/iced_drop/src/lib.rs +++ b/iced_drop/src/lib.rs @@ -1,8 +1,10 @@ pub mod widget; use iced::{ - advanced::{graphics::futures::MaybeSend, renderer, widget::Id}, - Command, Element, Point, Rectangle, + advanced::widget::{operate, Id}, + advanced::{graphics::futures::MaybeSend, renderer}, + task::Task, + Element, Point, Rectangle, }; use widget::droppable::*; @@ -18,17 +20,17 @@ where Droppable::new(content) } -pub fn zones_on_point( +pub fn zones_on_point( msg: MF, point: Point, options: Option>, depth: Option, -) -> Command +) -> Task where - Message: 'static, - MF: Fn(Vec<(Id, Rectangle)>) -> Message + MaybeSend + Sync + Clone + 'static, + T: Send + 'static, + MF: Fn(Vec<(Id, Rectangle)>) -> T + MaybeSend + Sync + Clone + 'static, { - Command::widget(drop::find_zones( + operate(drop::find_zones( move |bounds| bounds.contains(point), options, depth, @@ -41,11 +43,11 @@ pub fn find_zones( filter: F, options: Option>, depth: Option, -) -> Command +) -> Task where - Message: 'static, + Message: Send + 'static, MF: Fn(Vec<(Id, Rectangle)>) -> Message + MaybeSend + Sync + Clone + 'static, - F: Fn(&Rectangle) -> bool + 'static, + F: Fn(&Rectangle) -> bool + Send + 'static, { - Command::widget(drop::find_zones(filter, options, depth)).map(move |id| msg(id)) + operate(drop::find_zones(filter, options, depth)).map(move |id| msg(id)) } -- cgit v1.2.3