(&mut self, x_axis: bool)
| 2499 | } |
| 2500 | |
| 2501 | fn size_containers_along_axis(&mut self, x_axis: bool) { |
| 2502 | let mut bfs_buffer: Vec<i32> = Vec::new(); |
| 2503 | let mut resizable_container_buffer: Vec<i32> = Vec::new(); |
| 2504 | |
| 2505 | for root_index in 0..self.layout_element_tree_roots.len() { |
| 2506 | bfs_buffer.clear(); |
| 2507 | let root = self.layout_element_tree_roots[root_index]; |
| 2508 | let root_elem_idx = root.layout_element_index as usize; |
| 2509 | bfs_buffer.push(root.layout_element_index); |
| 2510 | |
| 2511 | // Size floating containers to their parents |
| 2512 | if self.element_has_config(root_elem_idx, ElementConfigType::Floating) { |
| 2513 | if let Some(float_cfg_idx) = |
| 2514 | self.find_element_config_index(root_elem_idx, ElementConfigType::Floating) |
| 2515 | { |
| 2516 | let parent_id = self.floating_element_configs[float_cfg_idx].parent_id; |
| 2517 | if let Some(parent_item) = self.layout_element_map.get(&parent_id) { |
| 2518 | let parent_elem_idx = parent_item.layout_element_index as usize; |
| 2519 | let parent_dims = self.layout_elements[parent_elem_idx].dimensions; |
| 2520 | let root_layout_idx = |
| 2521 | self.layout_elements[root_elem_idx].layout_config_index; |
| 2522 | |
| 2523 | let w_type = self.layout_configs[root_layout_idx].sizing.width.type_; |
| 2524 | match w_type { |
| 2525 | SizingType::Grow => { |
| 2526 | self.layout_elements[root_elem_idx].dimensions.width = |
| 2527 | parent_dims.width; |
| 2528 | } |
| 2529 | SizingType::Percent => { |
| 2530 | self.layout_elements[root_elem_idx].dimensions.width = |
| 2531 | parent_dims.width |
| 2532 | * self.layout_configs[root_layout_idx] |
| 2533 | .sizing |
| 2534 | .width |
| 2535 | .percent; |
| 2536 | } |
| 2537 | _ => {} |
| 2538 | } |
| 2539 | let h_type = self.layout_configs[root_layout_idx].sizing.height.type_; |
| 2540 | match h_type { |
| 2541 | SizingType::Grow => { |
| 2542 | self.layout_elements[root_elem_idx].dimensions.height = |
| 2543 | parent_dims.height; |
| 2544 | } |
| 2545 | SizingType::Percent => { |
| 2546 | self.layout_elements[root_elem_idx].dimensions.height = |
| 2547 | parent_dims.height |
| 2548 | * self.layout_configs[root_layout_idx] |
| 2549 | .sizing |
| 2550 | .height |
| 2551 | .percent; |
| 2552 | } |
| 2553 | _ => {} |
| 2554 | } |
| 2555 | } |
| 2556 | } |
| 2557 | } |
| 2558 |
no test coverage detected