summaryrefslogtreecommitdiffstats
path: root/widget/src/stack.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/stack.rs')
-rw-r--r--widget/src/stack.rs53
1 files changed, 27 insertions, 26 deletions
diff --git a/widget/src/stack.rs b/widget/src/stack.rs
index 6a44c328..2cb628ab 100644
--- a/widget/src/stack.rs
+++ b/widget/src/stack.rs
@@ -1,12 +1,12 @@
//! Display content on top of other content.
-use crate::core::event::{self, Event};
use crate::core::layout;
use crate::core::mouse;
use crate::core::overlay;
use crate::core::renderer;
use crate::core::widget::{Operation, Tree};
use crate::core::{
- Clipboard, Element, Layout, Length, Rectangle, Shell, Size, Vector, Widget,
+ Clipboard, Element, Event, Layout, Length, Rectangle, Shell, Size, Vector,
+ Widget,
};
/// A container that displays children on top of each other.
@@ -214,40 +214,41 @@ where
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
- ) -> event::Status {
+ ) {
let is_over = cursor.is_over(layout.bounds());
- self.children
+ for ((child, state), layout) in self
+ .children
.iter_mut()
.rev()
.zip(tree.children.iter_mut().rev())
.zip(layout.children().rev())
- .map(|((child, state), layout)| {
- let status = child.as_widget_mut().on_event(
- state,
- event.clone(),
- layout,
- cursor,
- renderer,
- clipboard,
- shell,
- viewport,
+ {
+ child.as_widget_mut().on_event(
+ state,
+ event.clone(),
+ layout,
+ cursor,
+ renderer,
+ clipboard,
+ shell,
+ viewport,
+ );
+
+ if is_over && cursor != mouse::Cursor::Unavailable {
+ let interaction = child.as_widget().mouse_interaction(
+ state, layout, cursor, viewport, renderer,
);
- if is_over && cursor != mouse::Cursor::Unavailable {
- let interaction = child.as_widget().mouse_interaction(
- state, layout, cursor, viewport, renderer,
- );
-
- if interaction != mouse::Interaction::None {
- cursor = mouse::Cursor::Unavailable;
- }
+ if interaction != mouse::Interaction::None {
+ cursor = mouse::Cursor::Unavailable;
}
+ }
- status
- })
- .find(|&status| status == event::Status::Captured)
- .unwrap_or(event::Status::Ignored)
+ if shell.is_event_captured() {
+ return;
+ }
+ }
}
fn mouse_interaction(