diff options
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/markdown.rs | 2 | ||||
-rw-r--r-- | widget/src/mouse_area.rs | 2 | ||||
-rw-r--r-- | widget/src/scrollable.rs | 18 |
3 files changed, 12 insertions, 10 deletions
diff --git a/widget/src/markdown.rs b/widget/src/markdown.rs index 6e592998..81bea0c5 100644 --- a/widget/src/markdown.rs +++ b/widget/src/markdown.rs @@ -325,7 +325,7 @@ pub fn parse(markdown: &str) -> impl Iterator<Item = Item> + '_ { ) if !metadata && !table => { #[cfg(feature = "highlighter")] { - use iced_highlighter::{self, Highlighter}; + use iced_highlighter::Highlighter; use text::Highlighter as _; highlighter = diff --git a/widget/src/mouse_area.rs b/widget/src/mouse_area.rs index d255ac99..7330874a 100644 --- a/widget/src/mouse_area.rs +++ b/widget/src/mouse_area.rs @@ -316,7 +316,7 @@ fn update<Message: Clone, Theme, Renderer>( let cursor_position = cursor.position(); let bounds = layout.bounds(); - if state.cursor_position != cursor_position && state.bounds != bounds { + if state.cursor_position != cursor_position || state.bounds != bounds { let was_hovered = state.is_hovered; state.is_hovered = cursor.is_over(layout.bounds()); diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 01638a48..6d7f251e 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -800,13 +800,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 @@ -1234,11 +1238,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, @@ -1269,9 +1268,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 } |