diff --git a/render-wasm/src/render/grid_layout.rs b/render-wasm/src/render/grid_layout.rs index 23e7a0bba0..04c732355e 100644 --- a/render-wasm/src/render/grid_layout.rs +++ b/render-wasm/src/render/grid_layout.rs @@ -1,6 +1,8 @@ use skia_safe::{self as skia}; use std::collections::HashMap; +use crate::shapes::modifiers::common::GetBounds; + use crate::math::{Bounds, Matrix, Rect}; use crate::shapes::modifiers::grid_layout::{calculate_tracks, create_cell_data}; use crate::shapes::{modified_children_ids, Frame, Layout, Shape, StructureEntry, Type}; @@ -22,7 +24,7 @@ pub fn render_overlay( return; }; - let bounds = &HashMap::::new(); + let bounds = &mut HashMap::::new(); let shape = &mut shape.clone(); if let Some(modifiers) = modifiers.get(&shape.id) { @@ -32,6 +34,18 @@ pub fn render_overlay( let layout_bounds = shape.bounds(); let children = modified_children_ids(shape, structure.get(&shape.id), false); + for child_id in children.iter() { + let Some(child) = shapes.get(child_id) else { + continue; + }; + + if let Some(modifier) = modifiers.get(child_id) { + let mut b = bounds.find(child); + b.transform_mut(modifier); + bounds.insert(*child_id, b); + } + } + let column_tracks = calculate_tracks( true, shape, diff --git a/render-wasm/src/shapes/modifiers.rs b/render-wasm/src/shapes/modifiers.rs index e5ce7cc3a1..28a25dcc0a 100644 --- a/render-wasm/src/shapes/modifiers.rs +++ b/render-wasm/src/shapes/modifiers.rs @@ -1,5 +1,5 @@ use std::collections::{HashMap, HashSet, VecDeque}; -mod common; +pub mod common; mod constraints; mod flex_layout; pub mod grid_layout; diff --git a/render-wasm/src/shapes/modifiers/grid_layout.rs b/render-wasm/src/shapes/modifiers/grid_layout.rs index fca6203059..712c2ea8a1 100644 --- a/render-wasm/src/shapes/modifiers/grid_layout.rs +++ b/render-wasm/src/shapes/modifiers/grid_layout.rs @@ -117,7 +117,7 @@ fn set_auto_base_size( (cell.row, cell.row_span) }; - if prop_span != 1 || (prop as usize) >= tracks.len() { + if prop_span != 1 || (prop as usize) > tracks.len() { continue; }