Skip to content

Commit

Permalink
fix(core): 🐛 scrollable update content size or view size need update …
Browse files Browse the repository at this point in the history
…offset
  • Loading branch information
sologeek authored and M-Adoo committed Jun 28, 2023
1 parent a536c37 commit 8889842
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions core/src/builtin_widgets/scrollable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,26 @@ impl ComposeChild for ScrollableWidget {
left_anchor: this.scroll_pos.x,
top_anchor: this.scroll_pos.y,
}
}}
}
}

finally {
let_watch!(content.layout_size())
.distinct_until_changed()
.subscribe(move |v| this.content_size = v);
.subscribe(move |v| {
this.content_size = v;
// content size update need to update scroll offset.
let scroll_pos = this.scroll_pos;
this.jump_to(scroll_pos);
});
let_watch!(view.layout_size())
.distinct_until_changed()
.subscribe(move |v| this.page = v);
.subscribe(move |v| {
this.page = v;
// view size update need to update scroll offset.
let scroll_pos = this.scroll_pos;
this.jump_to(scroll_pos);
});
}

}
Expand Down

0 comments on commit 8889842

Please sign in to comment.