Skip to content

Commit

Permalink
Fix scroll target potentially leaking to other ScrollArea
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Mar 15, 2024
1 parent 77acc10 commit 2a020d6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/egui/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,11 +756,13 @@ impl Prepared {
let content_size = content_ui.min_size();

for d in 0..2 {
// We always take both scroll targets regardless of which scroll axes are enabled. This
// is to avoid them leaking to other scroll areas.
let scroll_target = content_ui
.ctx()
.frame_state_mut(|state| state.scroll_target[d].take());

if scroll_enabled[d] {
// We take the scroll target so only this ScrollArea will use it:
let scroll_target = content_ui
.ctx()
.frame_state_mut(|state| state.scroll_target[d].take());
if let Some((target_range, align)) = scroll_target {
let min = content_ui.min_rect().min[d];
let clip_rect = content_ui.clip_rect();
Expand Down

0 comments on commit 2a020d6

Please sign in to comment.