summaryrefslogtreecommitdiffstats
path: root/native/src/widget/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2021-12-02 17:47:44 +0700
committerLibravatar GitHub <noreply@github.com>2021-12-02 17:47:44 +0700
commit26d053ab3887b73f854a1174864d0fec221c5c9b (patch)
treea6cf758c934638e3dd9586781dfb62e1cf028572 /native/src/widget/scrollable.rs
parentd9f970ffd5af6dafb5e696ad317d9ea7b997eb4b (diff)
parentbbd9355450bc2df3a2c0e37cc900ba00b26255af (diff)
downloadiced-26d053ab3887b73f854a1174864d0fec221c5c9b.tar.gz
iced-26d053ab3887b73f854a1174864d0fec221c5c9b.tar.bz2
iced-26d053ab3887b73f854a1174864d0fec221c5c9b.zip
Merge pull request #1131 from iced-rs/component-trait
`iced_lazy` and `Component` trait
Diffstat (limited to 'native/src/widget/scrollable.rs')
-rw-r--r--native/src/widget/scrollable.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs
index 2bf2ea5e..fac8af9e 100644
--- a/native/src/widget/scrollable.rs
+++ b/native/src/widget/scrollable.rs
@@ -8,7 +8,7 @@ use crate::touch;
use crate::widget::Column;
use crate::{
Alignment, Background, Clipboard, Color, Element, Hasher, Layout, Length,
- Padding, Point, Rectangle, Size, Vector, Widget,
+ Padding, Point, Rectangle, Shell, Size, Vector, Widget,
};
use std::{f32, hash::Hash, u32};
@@ -144,14 +144,14 @@ impl<'a, Message, Renderer: crate::Renderer> Scrollable<'a, Message, Renderer> {
&self,
bounds: Rectangle,
content_bounds: Rectangle,
- messages: &mut Vec<Message>,
+ shell: &mut Shell<'_, Message>,
) {
if content_bounds.height <= bounds.height {
return;
}
if let Some(on_scroll) = &self.on_scroll {
- messages.push(on_scroll(
+ shell.publish(on_scroll(
self.state.offset.absolute(bounds, content_bounds)
/ (content_bounds.height - bounds.height),
));
@@ -251,7 +251,7 @@ where
cursor_position: Point,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
- messages: &mut Vec<Message>,
+ shell: &mut Shell<'_, Message>,
) -> event::Status {
let bounds = layout.bounds();
let is_mouse_over = bounds.contains(cursor_position);
@@ -286,7 +286,7 @@ where
cursor_position,
renderer,
clipboard,
- messages,
+ shell,
)
};
@@ -307,7 +307,7 @@ where
}
}
- self.notify_on_scroll(bounds, content_bounds, messages);
+ self.notify_on_scroll(bounds, content_bounds, shell);
return event::Status::Captured;
}
@@ -336,7 +336,7 @@ where
self.notify_on_scroll(
bounds,
content_bounds,
- messages,
+ shell,
);
}
}
@@ -377,7 +377,7 @@ where
content_bounds,
);
- self.notify_on_scroll(bounds, content_bounds, messages);
+ self.notify_on_scroll(bounds, content_bounds, shell);
return event::Status::Captured;
}
@@ -409,7 +409,7 @@ where
self.notify_on_scroll(
bounds,
content_bounds,
- messages,
+ shell,
);
return event::Status::Captured;