graphic design tool
git clone https://git.lucas.co/cce-designer.git
refactor: tree walks read ctx.tree directly (children/parent left WidgetHost)
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N4ajhvVZtyEEEus9bodsj3
src/app.rs | 2 +-
src/render.rs | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/app.rs b/src/app.rs
index 8d82be6..4f8866e 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1121,7 +1121,7 @@ impl State {
return true;
}
}
- let child_ptrs = self.slots.get_dyn(idx).children(&self.ui_context);
+ let child_ptrs = self.ui_context.tree.children_ptrs(self.slots.get_dyn(idx).base().id());
for child_ptr in child_ptrs {
if let Some(child_idx) = self.find_widget_index(child_ptr) {
if self.has_any_open_menu_impl(child_idx, visited) {
diff --git a/src/render.rs b/src/render.rs
index 6902a35..53eceeb 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -300,7 +300,7 @@ impl State {
}
// Draw child elements recursively
- for child_ptr in w.children(&self.ui_context) {
+ for child_ptr in self.ui_context.tree.children_ptrs(w.base().id()) {
if let Some(child_idx) = self.find_widget_index(child_ptr) {
self.draw_widget_recursive(child_idx, verts, sw, sh, clip, clip_circle_val, show_cursor, node_area_y, visited);
} else {
@@ -378,7 +378,7 @@ impl State {
push_circle_vertices(cx, cy, cr, sw, sh, cc, 16, active_clip_circle, verts);
}
- for child_ptr in element.children(&self.ui_context) {
+ for child_ptr in self.ui_context.tree.children_ptrs(element.base().id()) {
unsafe {
self.draw_element_recursive(
&*child_ptr,
@@ -474,7 +474,7 @@ impl State {
if let Some(rect) = w.popover_rect() {
popovers.push(rect);
}
- for child_ptr in w.children(ctx) {
+ for child_ptr in ctx.tree.children_ptrs(w.base().id()) {
unsafe {
if let Some(child) = child_ptr.as_ref() {
collect_popovers(child, popovers, ctx);
@@ -643,7 +643,7 @@ impl State {
if let Some(rect) = w.popover_rect() {
popovers.push(rect);
}
- for child_ptr in w.children(ctx) {
+ for child_ptr in ctx.tree.children_ptrs(w.base().id()) {
unsafe {
if let Some(child) = child_ptr.as_ref() {
collect_popovers(child, popovers, ctx);