summaryrefslogtreecommitdiff
path: root/iced_drop/src/lib.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.me>2024-10-04 00:44:02 +0200
committerpml68 <contact@pml68.me>2024-10-04 00:44:02 +0200
commit510d68b92972b99868e187dd5340f04780b4c354 (patch)
tree6d0937824d8606423b5afef2a16e182a3a984f8f /iced_drop/src/lib.rs
parentfeat: implement fmt::Display for RenderedElement, work on props (diff)
downloadiced-builder-510d68b92972b99868e187dd5340f04780b4c354.tar.gz
feat: update to iced 0.13.1, basic project state file, prepare for drag&drop
Diffstat (limited to 'iced_drop/src/lib.rs')
-rw-r--r--iced_drop/src/lib.rs24
1 files changed, 13 insertions, 11 deletions
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<Message, MF>(
+pub fn zones_on_point<T, MF>(
msg: MF,
point: Point,
options: Option<Vec<Id>>,
depth: Option<usize>,
-) -> Command<Message>
+) -> Task<T>
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<Message, MF, F>(
filter: F,
options: Option<Vec<Id>>,
depth: Option<usize>,
-) -> Command<Message>
+) -> Task<Message>
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))
}