mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 04:07:30 +02:00
🐛 Fix problem with grid layout wasm
This commit is contained in:
parent
5b4cd9f4f1
commit
b997d5a320
3 changed files with 17 additions and 3 deletions
|
@ -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::<Uuid, Bounds>::new();
|
||||
let bounds = &mut HashMap::<Uuid, Bounds>::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,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
mod common;
|
||||
pub mod common;
|
||||
mod constraints;
|
||||
mod flex_layout;
|
||||
pub mod grid_layout;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue