summaryrefslogtreecommitdiffstats
path: root/widget/src/scrollable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/scrollable.rs')
-rw-r--r--widget/src/scrollable.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index af6a3945..00a6b556 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -751,7 +751,7 @@ where
// TODO: Configurable speed/friction (?)
-movement * 60.0
}
- mouse::ScrollDelta::Pixels { x, y } => Vector::new(x, y),
+ mouse::ScrollDelta::Pixels { x, y } => -Vector::new(x, y),
};
state.scroll(
@@ -760,13 +760,17 @@ where
content_bounds,
);
- if notify_scroll(
+ let has_scrolled = notify_scroll(
state,
&self.on_scroll,
bounds,
content_bounds,
shell,
- ) {
+ );
+
+ let in_transaction = state.last_scrolled.is_some();
+
+ if has_scrolled || in_transaction {
event::Status::Captured
} else {
event::Status::Ignored
@@ -1194,11 +1198,6 @@ fn notify_viewport<Message>(
return false;
}
- let Some(on_scroll) = on_scroll else {
- state.last_notified = None;
- return false;
- };
-
let viewport = Viewport {
offset_x: state.offset_x,
offset_y: state.offset_y,
@@ -1229,9 +1228,12 @@ fn notify_viewport<Message>(
}
}
- shell.publish(on_scroll(viewport));
state.last_notified = Some(viewport);
+ if let Some(on_scroll) = on_scroll {
+ shell.publish(on_scroll(viewport));
+ }
+
true
}