Skip to content
Snippets Groups Projects
Unverified Commit 9db3f3b5 authored by Johan Klokkhammer Helsing's avatar Johan Klokkhammer Helsing Committed by GitHub
Browse files

docs: Fix typos in chapter 2

parent ea637ae3
No related branches found
No related tags found
No related merge requests found
......@@ -55,12 +55,11 @@ widget1 - entity 2
- widget2 entity 3
- widget3 entity 4
```
When widget 1 renders it's children will have random entity id's if you use bevy's default spawning commands, but by using `spawn_widget` you can guarantee somewhat consistent entities. There are a couple of a caveats to this though. If a widget is despawned due to being removed from the tree it's entity id is no longer guaranteed. This means that entities that are removed from the tree will lose access to their context and state. It's important to remember that!
When widget 1 renders, its children will have random entity id's if you use bevy's default spawning commands, but by using `spawn_widget` you can guarantee somewhat consistent entities. There are a couple of a caveats to this though. If a widget is despawned due to being removed from the tree, its entity id is no longer guaranteed. This means that entities that are removed from the tree will lose access to their context and state. It's important to remember that!
### Relationships
Widgets, by the nature of them being stored as a tree, contain certain relationships. The most common one is the *
parent-child* relationship. A widget may contain zero or more children.
Widgets, by the nature of them being stored as a tree, contain certain relationships. The most common one is the *parent-child* relationship. A widget may contain zero or more children.
<p align="center">
<img alt="Diagram showing the parent-child relationship" src="img/parent-child.svg" />
......@@ -106,4 +105,4 @@ The last core concept is that of *widget lifecycle*. Widgets have a lifecycle as
2. Update or Diff - During each update loop the widgets are diffed with previous values from the last update to see if they have changed. If a widget has changed it is re-rendered.
3. Render - Render occurs when a widget has changed and allows users to change behavior according to entity changes.
4. Layout - Occurs after the entire tree has been updated. Widget entities marked as "dirty" will have their rendering and layout recalculated.
5. Removal/Despawning - Entities that are removed from the tree are despawned additionally any children they had are also despawned and removed from the tree. It's important to avoid removing a widget from the tree if you need to preserve that widgets state.
\ No newline at end of file
5. Removal/Despawning - Entities that are removed from the tree are despawned additionally any children they had are also despawned and removed from the tree. It's important to avoid removing a widget from the tree if you need to preserve that widgets state.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment