diff options
author | 2020-07-05 05:44:10 +0200 | |
---|---|---|
committer | 2020-07-08 11:29:19 +0200 | |
commit | 625979b6652a8a14a0eaf6bd62f1e9a8da0ae421 (patch) | |
tree | 0ed6994fc2ff0a8671bb6ec26bdae21af2b6fb23 /native/src/widget/scrollable.rs | |
parent | 61f22b1db23f3495145a9a4f7255311fe8381998 (diff) | |
download | iced-625979b6652a8a14a0eaf6bd62f1e9a8da0ae421.tar.gz iced-625979b6652a8a14a0eaf6bd62f1e9a8da0ae421.tar.bz2 iced-625979b6652a8a14a0eaf6bd62f1e9a8da0ae421.zip |
Draft `Widget::overlay` idempotency
Diffstat (limited to '')
-rw-r--r-- | native/src/widget/scrollable.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 92e5265a..87871e28 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -319,14 +319,16 @@ where fn overlay( &mut self, layout: Layout<'_>, - ) -> Option<Overlay<'a, Message, Renderer>> { - self.content + ) -> Option<Overlay<'_, Message, Renderer>> { + let Self { content, state, .. } = self; + + content .overlay(layout.children().next().unwrap()) .map(|overlay| { let bounds = layout.bounds(); let content_layout = layout.children().next().unwrap(); let content_bounds = content_layout.bounds(); - let offset = self.state.offset(bounds, content_bounds); + let offset = state.offset(bounds, content_bounds); overlay.translate(Vector::new(0.0, -(offset as f32))) }) |