Skip to content

Commit

Permalink
Merge pull request #38 from dignifiedquire/fix-nested-scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
zakarumych authored Sep 26, 2024
2 parents 43a78e8 + be3edce commit e6be075
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,18 +573,17 @@ impl<T> Snarl<T> {

// Zooming
match input.hover_pos {
Some(hover_pos) if viewport.contains(hover_pos) => {
Some(hover_pos) if viewport.contains(hover_pos) && ui.rect_contains_pointer(viewport) => {
if input.scroll_delta != 0.0 {
let new_scale = (snarl_state.scale()
* (1.0 + input.scroll_delta * style.get_scale_velocity()))
.clamp(style.get_min_scale(), style.get_max_scale());
.clamp(style.get_min_scale(), style.get_max_scale());

snarl_state.set_scale(new_scale);
}
}
_ => {}
}

let mut input_info = HashMap::new();
let mut output_info = HashMap::new();

Expand Down

0 comments on commit e6be075

Please sign in to comment.