Rename Event to DioxusEvent

This commit is contained in:
JMS55 2024-01-05 00:04:24 -08:00
parent 23a8f7fd33
commit 643d3664a2
2 changed files with 5 additions and 15 deletions

View file

@ -1,14 +1,4 @@
use bevy::{
app::{App, Startup},
core::{DebugName, Name},
core_pipeline::core_2d::Camera2dBundle,
ecs::{
entity::Entity, query::Without, reflect::AppTypeRegistry, system::Commands, world::World,
},
reflect::TypeInfo,
ui::{node_bundles::NodeBundle, Node},
DefaultPlugins,
};
use bevy::{prelude::*, reflect::TypeInfo};
use bevy_dioxus::{colors::*, prelude::*};
use bevy_mod_picking::DefaultPickingPlugins;
@ -60,7 +50,7 @@ fn SceneTree<'a>(cx: Scope, selected_entity: &'a UseStateSendable<Option<Entity>
rsx! {
for (entity, name) in entities {
Button {
onclick: move |event: Event<PointerButton>| if *event.data == PointerButton::Primary {
onclick: move |event: DioxusEvent<PointerButton>| if *event.data == PointerButton::Primary {
if Some(entity) == *selected_entity.read() {
selected_entity.write(None);
} else {
@ -80,7 +70,7 @@ fn SceneTree<'a>(cx: Scope, selected_entity: &'a UseStateSendable<Option<Entity>
}
}
Button {
onclick: move |event: Event<PointerButton>| if *event.data == PointerButton::Primary {
onclick: move |event: DioxusEvent<PointerButton>| if *event.data == PointerButton::Primary {
system_scheduler.schedule({
let selected_entity = (*selected_entity).clone();
move |world: &mut World| {
@ -208,7 +198,7 @@ fn Button<'a>(cx: Scope<'a, ButtonProps<'a>>) -> Element<'a> {
#[derive(Props)]
struct ButtonProps<'a> {
onclick: EventHandler<'a, Event<PointerButton>>,
onclick: EventHandler<'a, DioxusEvent<PointerButton>>,
base_color: Option<&'a str>,
click_color: Option<&'a str>,
hover_color: Option<&'a str>,

View file

@ -37,7 +37,7 @@ pub mod prelude {
pub use super::{DioxusUiBundle, DioxusUiPlugin, DioxusUiRoot};
pub use bevy_mod_picking::pointer::PointerButton;
pub use dioxus;
pub use dioxus::prelude::*;
pub use dioxus::prelude::{Event as DioxusEvent, *};
}
pub struct DioxusUiPlugin;