Checkpoint

This commit is contained in:
Antonio Scandurra 2023-10-19 19:50:44 +02:00
parent 1343ea66c9
commit 9e20ccc01a
2 changed files with 3 additions and 3 deletions

View file

@ -945,7 +945,7 @@ impl<'a, 'w> WindowContext<'a, 'w> {
} }
fn dispatch_action(&mut self, action: Box<dyn Action>, listeners: &[(TypeId, AnyKeyListener)]) { fn dispatch_action(&mut self, action: Box<dyn Action>, listeners: &[(TypeId, AnyKeyListener)]) {
let action_type = action.type_id(); let action_type = action.as_any().type_id();
for (event_type, listener) in listeners { for (event_type, listener) in listeners {
if action_type == *event_type { if action_type == *event_type {
listener(action.as_any(), DispatchPhase::Capture, self); listener(action.as_any(), DispatchPhase::Capture, self);
@ -958,7 +958,7 @@ impl<'a, 'w> WindowContext<'a, 'w> {
if self.window.propagate { if self.window.propagate {
for (event_type, listener) in listeners.iter().rev() { for (event_type, listener) in listeners.iter().rev() {
if action_type == *event_type { if action_type == *event_type {
listener(action.as_any(), DispatchPhase::Capture, self); listener(action.as_any(), DispatchPhase::Bubble, self);
if !self.window.propagate { if !self.window.propagate {
break; break;
} }

View file

@ -69,7 +69,7 @@ impl FocusStory {
println!("Action A dispatched on parent during {:?}", phase); println!("Action A dispatched on parent during {:?}", phase);
}) })
.on_action(|_, action: &ActionB, phase, cx| { .on_action(|_, action: &ActionB, phase, cx| {
println!("Action A dispatched on parent during {:?}", phase); println!("Action B dispatched on parent during {:?}", phase);
}) })
.focusable(&parent) .focusable(&parent)
.on_focus(|_, _, _| println!("Parent focused")) .on_focus(|_, _, _| println!("Parent focused"))