summaryrefslogtreecommitdiffstats
path: root/widget/src/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-07-27 01:02:28 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-07-27 01:04:18 +0200
commite2ba7ece83f141c149659747977147392df008f4 (patch)
tree5fa04524d0ca95c6289c4d5962af7a97098ec811 /widget/src/scrollable.rs
parente29754f32d03efc4b075e9b63cc554d128bc2ccf (diff)
downloadiced-e2ba7ece83f141c149659747977147392df008f4.tar.gz
iced-e2ba7ece83f141c149659747977147392df008f4.tar.bz2
iced-e2ba7ece83f141c149659747977147392df008f4.zip
Introduce `visible_bounds` operation for `Container`
Diffstat (limited to 'widget/src/scrollable.rs')
-rw-r--r--widget/src/scrollable.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index f621fb26..103e3944 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -254,10 +254,22 @@ where
) {
let state = tree.state.downcast_mut::<State>();
- operation.scrollable(state, self.id.as_ref().map(|id| &id.0));
+ let bounds = layout.bounds();
+ let content_layout = layout.children().next().unwrap();
+ let content_bounds = content_layout.bounds();
+ let translation =
+ state.translation(self.direction, bounds, content_bounds);
+
+ operation.scrollable(
+ state,
+ self.id.as_ref().map(|id| &id.0),
+ bounds,
+ translation,
+ );
operation.container(
self.id.as_ref().map(|id| &id.0),
+ bounds,
&mut |operation| {
self.content.as_widget().operate(
&mut tree.children[0],