feat(rectangle_tracker): functions for widget and subscription
This commit is contained in:
parent
436a5825d7
commit
8c86dae449
2 changed files with 22 additions and 0 deletions
|
|
@ -133,6 +133,7 @@ pub mod popover;
|
|||
pub use popover::{popover, Popover};
|
||||
|
||||
pub mod rectangle_tracker;
|
||||
pub use rectangle_tracker::{rectangle_tracker, RectangleTracker};
|
||||
|
||||
pub use row::{row, Row};
|
||||
pub mod row {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,27 @@ use std::{fmt::Debug, hash::Hash};
|
|||
|
||||
pub use iced_style::container::{Appearance, StyleSheet};
|
||||
|
||||
pub fn rectangle_tracker<'a, Message, I, T>(
|
||||
content: T,
|
||||
id: I,
|
||||
tx: UnboundedSender<(I, Rectangle)>,
|
||||
) -> RectangleTrackingContainer<'a, Message, crate::Renderer, I>
|
||||
where
|
||||
I: Hash + Copy + Send + Sync + Debug + 'a,
|
||||
T: Into<Element<'a, Message, crate::Renderer>>,
|
||||
{
|
||||
RectangleTrackingContainer::new(content, id, tx)
|
||||
}
|
||||
|
||||
pub fn subscription<
|
||||
I: 'static + Hash + Copy + Send + Sync + Debug,
|
||||
R: 'static + Hash + Copy + Send + Sync + Debug + Eq,
|
||||
>(
|
||||
id: I,
|
||||
) -> iced::Subscription<(I, RectangleUpdate<R>)> {
|
||||
subscription::rectangle_tracker_subscription(id)
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RectangleTracker<I> {
|
||||
tx: UnboundedSender<(I, Rectangle)>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue