MCPcopy Create free account
hub / github.com/PerroEngine/Perro / push_visible_children

Method push_visible_children

perro_source/core/perro_ui/src/tree.rs:195–220  ·  view source on GitHub ↗
(
        &self,
        children: &[Vec<usize>],
        slot: usize,
        depth: u32,
        out: &mut Vec<UiTreeListVisibleItem>,
    )

Source from the content-addressed store, hash-verified

193 }
194
195 fn push_visible_children(
196 &self,
197 children: &[Vec<usize>],
198 slot: usize,
199 depth: u32,
200 out: &mut Vec<UiTreeListVisibleItem>,
201 ) {
202 let list = &children[slot];
203 for (pos, idx) in list.iter().copied().enumerate() {
204 let has_child_items = !children[idx + 1].is_empty();
205 let has_children = has_child_items
206 || self
207 .items
208 .get(idx)
209 .is_some_and(|item| item.has_children_hint);
210 out.push(UiTreeListVisibleItem {
211 index: idx,
212 depth,
213 has_children,
214 last_child: pos + 1 == list.len(),
215 });
216 if has_child_items && self.items.get(idx).is_some_and(|item| item.open) {
217 self.push_visible_children(children, idx + 1, depth.saturating_add(1), out);
218 }
219 }
220 }
221}
222
223impl Default for UiTreeList {

Callers 1

visible_itemsMethod · 0.80

Calls 5

iterMethod · 0.45
is_emptyMethod · 0.45
getMethod · 0.45
pushMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected