summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-01-31 19:03:26 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-31 19:03:26 +0100
commitd9118aca75502b284a33b5aaa7ba95216a6763c6 (patch)
tree17a24a5132b72b49cac7db5121087e8fda1bf8b6
parent5540ac07e4695cc4e268979eca4efeb604b7c77f (diff)
parent4477537f78a37da5e4b5009da738a7237d49a8db (diff)
downloadiced-d9118aca75502b284a33b5aaa7ba95216a6763c6.tar.gz
iced-d9118aca75502b284a33b5aaa7ba95216a6763c6.tar.bz2
iced-d9118aca75502b284a33b5aaa7ba95216a6763c6.zip
Merge pull request #1940 from AustinMReppert/fix/scrollable-touch-input-stuck
Fix/scrollable touch input stuck
-rw-r--r--CHANGELOG.md1
-rw-r--r--widget/src/scrollable.rs20
2 files changed, 11 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94d80f0a..d48a67dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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...
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index 509a6b34..6e48cd10 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -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) =>
@@ -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()
@@ -635,7 +635,7 @@ pub fn update<Message>(
}
}
- return event::Status::Captured;
+ event_status = event::Status::Captured;
}
_ => {}
}
@@ -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 { .. }) => {
@@ -673,7 +673,7 @@ pub fn update<Message>(
shell,
);
- return event::Status::Captured;
+ event_status = event::Status::Captured;
}
}
_ => {}
@@ -709,7 +709,7 @@ pub fn update<Message>(
);
}
- return event::Status::Captured;
+ event_status = event::Status::Captured;
}
_ => {}
}
@@ -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 { .. }) => {
@@ -749,7 +749,7 @@ pub fn update<Message>(
);
}
- return event::Status::Captured;
+ event_status = event::Status::Captured;
}
_ => {}
}
@@ -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`].