From f7896d51354e8c60355bd2f9090d0d355ef67139 Mon Sep 17 00:00:00 2001 From: JMS55 <47158642+JMS55@users.noreply.github.com> Date: Sun, 10 Dec 2023 13:05:01 -0800 Subject: [PATCH] FIll out another mutation --- src/apply_mutations.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/apply_mutations.rs b/src/apply_mutations.rs index f0dc9b9..7baefdc 100644 --- a/src/apply_mutations.rs +++ b/src/apply_mutations.rs @@ -24,8 +24,8 @@ pub fn apply_mutations( let map = element_id_to_bevy_ui_entity; map.insert(ElementId(0), root_entity); - let mut stack = vec![root_entity]; + for edit in mutations.edits { match edit { Mutation::AppendChildren { id, m } => { @@ -36,7 +36,12 @@ pub fn apply_mutations( } Mutation::AssignId { path, id } => todo!(), Mutation::CreatePlaceholder { id } => todo!(), - Mutation::CreateTextNode { value, id } => todo!(), + Mutation::CreateTextNode { value, id } => { + let entity = BevyTemplateNode::from_dioxus(&TemplateNode::Text { text: value }) + .spawn(commands); + map.insert(id, entity); + stack.push(entity); + } Mutation::HydrateText { path, value, id } => todo!(), Mutation::LoadTemplate { name, index, id } => { let entity = templates[name].roots[index].spawn(commands); @@ -101,10 +106,13 @@ impl BevyTemplateNode { children: children.iter().map(Self::from_dioxus).collect(), } } + TemplateNode::Text { text } => { Self::TextNode(Text::from_section(*text, TextStyle::default())) } + TemplateNode::Dynamic { id } => todo!(), + TemplateNode::DynamicText { id } => todo!(), } } @@ -122,6 +130,7 @@ impl BevyTemplateNode { .push_children(&children) .id() } + Self::TextNode(text) => commands .spawn(TextBundle { text: text.clone(),