MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / build_wrapped_line

Method build_wrapped_line

src/engine.rs:2367–2399  ·  view source on GitHub ↗
(
        &self,
        parent_index: usize,
        start_child_offset: usize,
        end_child_offset: usize,
        main_axis_x: bool,
    )

Source from the content-addressed store, hash-verified

2365 }
2366
2367 fn build_wrapped_line(
2368 &self,
2369 parent_index: usize,
2370 start_child_offset: usize,
2371 end_child_offset: usize,
2372 main_axis_x: bool,
2373 ) -> WrappedLayoutLine {
2374 let layout_idx = self.layout_elements[parent_index].layout_config_index;
2375 let layout = self.layout_configs[layout_idx];
2376 let children_start = self.layout_elements[parent_index].children_start;
2377
2378 let mut main_size = 0.0;
2379 let mut cross_size = 0.0;
2380
2381 for child_offset in start_child_offset..end_child_offset {
2382 let child_index = self.layout_element_children[children_start + child_offset] as usize;
2383 if child_offset > start_child_offset {
2384 main_size += layout.child_gap as f32;
2385 }
2386
2387 let child_main = self.child_size_on_axis(child_index, main_axis_x);
2388 let child_cross = self.child_size_on_axis(child_index, !main_axis_x);
2389 main_size += child_main;
2390 cross_size = f32::max(cross_size, child_cross);
2391 }
2392
2393 WrappedLayoutLine {
2394 start_child_offset,
2395 end_child_offset,
2396 main_size,
2397 cross_size,
2398 }
2399 }
2400
2401 fn compute_wrapped_lines(
2402 &self,

Callers 1

compute_wrapped_linesMethod · 0.80

Calls 1

child_size_on_axisMethod · 0.80

Tested by

no test coverage detected