summaryrefslogtreecommitdiffstats
path: root/widget/src/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-07-27 18:48:06 +0200
committerLibravatar GitHub <noreply@github.com>2023-07-27 18:48:06 +0200
commit18f1ab551be6fe9a603eb07dceddf231c01b5c7f (patch)
treea4fd30a4252c3a1469a618ac4754ee8a6d81a518 /widget/src/scrollable.rs
parente4b75ec9c76402dda7c6b6631918da240bb1c7ed (diff)
parentcbb5fcc8829e6fbe60f97cad8597c86ffd4f5b1a (diff)
downloadiced-18f1ab551be6fe9a603eb07dceddf231c01b5c7f.tar.gz
iced-18f1ab551be6fe9a603eb07dceddf231c01b5c7f.tar.bz2
iced-18f1ab551be6fe9a603eb07dceddf231c01b5c7f.zip
Merge pull request #1971 from iced-rs/visible-bounds-operation
`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],