Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/scrollable touch input stuck #1940

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Clippy docs keyword quoting. [#2091](https://github.com/iced-rs/iced/pull/2091)
- Clippy map transformations. [#2090](https://github.com/iced-rs/iced/pull/2090)
- Inline format args for ease of reading. [#2089](https://github.com/iced-rs/iced/pull/2089)
- Stuck scrolling in `Scrollable` with touch events. [#1940](https://github.com/iced-rs/iced/pull/1940)

Many thanks to...

Expand Down
20 changes: 10 additions & 10 deletions widget/src/scrollable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ pub fn update<Message>(
let (mouse_over_y_scrollbar, mouse_over_x_scrollbar) =
scrollbars.is_mouse_over(cursor);

let event_status = {
let mut event_status = {
let cursor = match cursor_over_scrollable {
Some(cursor_position)
if !(mouse_over_x_scrollbar || mouse_over_y_scrollbar) =>
Expand Down Expand Up @@ -589,7 +589,7 @@ pub fn update<Message>(

notify_on_scroll(state, on_scroll, bounds, content_bounds, shell);

return event::Status::Captured;
event_status = event::Status::Captured;
}
Event::Touch(event)
if state.scroll_area_touched_at.is_some()
Expand Down Expand Up @@ -635,7 +635,7 @@ pub fn update<Message>(
}
}

return event::Status::Captured;
event_status = event::Status::Captured;
}
_ => {}
}
Expand All @@ -647,7 +647,7 @@ pub fn update<Message>(
| Event::Touch(touch::Event::FingerLost { .. }) => {
state.y_scroller_grabbed_at = None;

return event::Status::Captured;
event_status = event::Status::Captured;
}
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
Expand All @@ -673,7 +673,7 @@ pub fn update<Message>(
shell,
);

return event::Status::Captured;
event_status = event::Status::Captured;
}
}
_ => {}
Expand Down Expand Up @@ -709,7 +709,7 @@ pub fn update<Message>(
);
}

return event::Status::Captured;
event_status = event::Status::Captured;
}
_ => {}
}
Expand All @@ -722,7 +722,7 @@ pub fn update<Message>(
| Event::Touch(touch::Event::FingerLost { .. }) => {
state.x_scroller_grabbed_at = None;

return event::Status::Captured;
event_status = event::Status::Captured;
}
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
Expand All @@ -749,7 +749,7 @@ pub fn update<Message>(
);
}

return event::Status::Captured;
event_status = event::Status::Captured;
}
_ => {}
}
Expand Down Expand Up @@ -783,14 +783,14 @@ pub fn update<Message>(
shell,
);

return event::Status::Captured;
event_status = event::Status::Captured;
}
}
_ => {}
}
}

event::Status::Ignored
event_status
}

/// Computes the current [`mouse::Interaction`] of a [`Scrollable`].
Expand Down
Loading