This commit is contained in:
JMS55 2023-12-21 21:37:53 -08:00
parent fc4720e01e
commit 302f3cb6e3
3 changed files with 16 additions and 21 deletions

22
Cargo.lock generated
View file

@ -1730,8 +1730,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
[[package]] [[package]]
name = "dioxus" name = "dioxus"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/ealmloff/dioxus?branch=fix-event-bubbling#7b45a3a98bde103e5c86a469159e2432da96bdda"
checksum = "2d9e3b0725e520250bf23213f996d241cca29cea4360a9bf08a44e0033f8e569"
dependencies = [ dependencies = [
"dioxus-core", "dioxus-core",
"dioxus-core-macro", "dioxus-core-macro",
@ -1743,8 +1742,7 @@ dependencies = [
[[package]] [[package]]
name = "dioxus-core" name = "dioxus-core"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/ealmloff/dioxus?branch=fix-event-bubbling#7b45a3a98bde103e5c86a469159e2432da96bdda"
checksum = "0f33186615b2e90bceab24a195b3cfad4e0b4d91a33ec44a94845876bfb25c13"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"futures-channel", "futures-channel",
@ -1760,8 +1758,7 @@ dependencies = [
[[package]] [[package]]
name = "dioxus-core-macro" name = "dioxus-core-macro"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/ealmloff/dioxus?branch=fix-event-bubbling#7b45a3a98bde103e5c86a469159e2432da96bdda"
checksum = "21afaccb28587aed0ba98856335912f5ce7052c0aafa74b213829a3b8bfd2345"
dependencies = [ dependencies = [
"constcat", "constcat",
"dioxus-core", "dioxus-core",
@ -1781,8 +1778,7 @@ checksum = "2ea539174bb236e0e7dc9c12b19b88eae3cb574dedbd0252a2d43ea7e6de13e2"
[[package]] [[package]]
name = "dioxus-hooks" name = "dioxus-hooks"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/ealmloff/dioxus?branch=fix-event-bubbling#7b45a3a98bde103e5c86a469159e2432da96bdda"
checksum = "5bb23ce82df4fb13e9ddaa01d1469f1f32d683dd4636204bd0a0eaf434b65946"
dependencies = [ dependencies = [
"dioxus-core", "dioxus-core",
"dioxus-debug-cell", "dioxus-debug-cell",
@ -1795,8 +1791,7 @@ dependencies = [
[[package]] [[package]]
name = "dioxus-hot-reload" name = "dioxus-hot-reload"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/ealmloff/dioxus?branch=fix-event-bubbling#7b45a3a98bde103e5c86a469159e2432da96bdda"
checksum = "b7d8c9e89e866a6b84b8ad696f0ff2f6f6563d2235eb99acc6952f19e516cc09"
dependencies = [ dependencies = [
"chrono", "chrono",
"dioxus-core", "dioxus-core",
@ -1814,8 +1809,7 @@ dependencies = [
[[package]] [[package]]
name = "dioxus-html" name = "dioxus-html"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/ealmloff/dioxus?branch=fix-event-bubbling#7b45a3a98bde103e5c86a469159e2432da96bdda"
checksum = "828a42a2d70688a2412a8538c8b5a5eceadf68f682f899dc4455a0169db39dfd"
dependencies = [ dependencies = [
"async-channel 1.9.0", "async-channel 1.9.0",
"async-trait", "async-trait",
@ -1833,8 +1827,7 @@ dependencies = [
[[package]] [[package]]
name = "dioxus-rsx" name = "dioxus-rsx"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/ealmloff/dioxus?branch=fix-event-bubbling#7b45a3a98bde103e5c86a469159e2432da96bdda"
checksum = "c974133c7c95497a486d587e40449927711430b308134b9cd374b8d35eceafb3"
dependencies = [ dependencies = [
"dioxus-core", "dioxus-core",
"internment", "internment",
@ -1842,6 +1835,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.41", "syn 2.0.41",
"tracing",
] ]
[[package]] [[package]]

View file

@ -5,14 +5,14 @@ edition = "2021"
[dependencies] [dependencies]
bevy = { git = "https://github.com/JMS55/bevy", branch = "query_new_12" } bevy = { git = "https://github.com/JMS55/bevy", branch = "query_new_12" }
dioxus = { version = "0.4", default-features = false, features = [ dioxus = { git = "https://github.com/ealmloff/dioxus", branch = "fix-event-bubbling", default-features = false, features = [
"macro", "macro",
"hooks", "hooks",
] } ] }
dioxus-rsx = { version = "0.4", default-features = false, features = [ dioxus-rsx = { git = "https://github.com/ealmloff/dioxus", branch = "fix-event-bubbling", default-features = false, features = [
"hot_reload", "hot_reload",
], optional = true } ], optional = true }
dioxus-hot-reload = { version = "0.4", default-features = false, features = [ dioxus-hot-reload = { git = "https://github.com/ealmloff/dioxus", branch = "fix-event-bubbling", default-features = false, features = [
"custom_file_watcher", "custom_file_watcher",
], optional = true } ], optional = true }
bevy_mod_picking = { version = "0.17", default-features = false, features = [ bevy_mod_picking = { version = "0.17", default-features = false, features = [

View file

@ -61,12 +61,13 @@ fn SceneTree<'a>(cx: Scope, selected_entity: &'a UseState<Option<Entity>>) -> El
rsx! { rsx! {
for (entity, name) in entities { for (entity, name) in entities {
node { node {
onclick: move |_| { onclick: move |event| {
if Some(entity) == ***selected_entity { if Some(entity) == ***selected_entity {
selected_entity.set(None); selected_entity.set(None);
} else { } else {
selected_entity.set(Some(entity)); selected_entity.set(Some(entity));
} }
event.stop_propagation();
}, },
padding: "8", padding: "8",
background_color: if Some(entity) == ***selected_entity { INDIGO_600 } else { NEUTRAL_800 }, background_color: if Some(entity) == ***selected_entity { INDIGO_600 } else { NEUTRAL_800 },
@ -79,12 +80,12 @@ fn SceneTree<'a>(cx: Scope, selected_entity: &'a UseState<Option<Entity>>) -> El
} }
} }
node { node {
onclick: move |_| spawn_entity(),
onmouse_enter: enter,
onmouse_exit: exit,
padding: "8", padding: "8",
background_color: if spawn_entity_hovered { NEUTRAL_600 } else { NEUTRAL_800 }, background_color: if spawn_entity_hovered { NEUTRAL_600 } else { NEUTRAL_800 },
text { text {
onclick: move |_| spawn_entity(),
onmouse_enter: enter,
onmouse_exit: exit,
text: "Spawn Entity", text: "Spawn Entity",
text_size: "18" text_size: "18"
} }