Events cannot start on text nodes
This commit is contained in:
parent
f6d0b3acd8
commit
91ac88def7
|
@ -11,6 +11,7 @@ use bevy::{
|
||||||
world::{Mut, World},
|
world::{Mut, World},
|
||||||
},
|
},
|
||||||
hierarchy::Parent,
|
hierarchy::Parent,
|
||||||
|
text::Text,
|
||||||
utils::HashMap,
|
utils::HashMap,
|
||||||
};
|
};
|
||||||
use std::{any::Any, mem, rc::Rc, sync::Arc};
|
use std::{any::Any, mem, rc::Rc, sync::Arc};
|
||||||
|
@ -69,7 +70,7 @@ fn dispatch_ui_events(
|
||||||
) {
|
) {
|
||||||
for (mut target, name, data) in events {
|
for (mut target, name, data) in events {
|
||||||
let mut target_element_id = ui_root.bevy_ui_entity_to_element_id.get(&target).copied();
|
let mut target_element_id = ui_root.bevy_ui_entity_to_element_id.get(&target).copied();
|
||||||
while target_element_id.is_none() {
|
while target_element_id.is_none() || world.entity(target).contains::<Text>() {
|
||||||
target = world.entity(target).get::<Parent>().unwrap().get();
|
target = world.entity(target).get::<Parent>().unwrap().get();
|
||||||
target_element_id = ui_root.bevy_ui_entity_to_element_id.get(&target).copied();
|
target_element_id = ui_root.bevy_ui_entity_to_element_id.get(&target).copied();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue