🐛 Fix problem with reflow layout

This commit is contained in:
alonso.torres
2025-12-11 16:13:38 +01:00
parent 0a7a65af5d
commit 68c585e0cf

View File

@@ -277,7 +277,6 @@ fn propagate_reflow(
}; };
let shapes = &state.shapes; let shapes = &state.shapes;
let mut reflow_parent = false;
if reflown.contains(id) { if reflown.contains(id) {
return; return;
@@ -294,15 +293,10 @@ fn propagate_reflow(
// If this is a fill layout but the parent has not been reflown yet // If this is a fill layout but the parent has not been reflown yet
// we wait for the next iteration for reflow // we wait for the next iteration for reflow
skip_reflow = true; skip_reflow = true;
reflow_parent = true;
} }
} }
} }
if shape.is_layout_vertical_auto() || shape.is_layout_horizontal_auto() {
reflow_parent = true;
}
if !skip_reflow { if !skip_reflow {
layout_reflows.push(*id); layout_reflows.push(*id);
} }
@@ -312,32 +306,26 @@ fn propagate_reflow(
if let Some(child) = shapes.get(&children_ids[0]) { if let Some(child) = shapes.get(&children_ids[0]) {
let child_bounds = bounds.find(child); let child_bounds = bounds.find(child);
bounds.insert(shape.id, child_bounds); bounds.insert(shape.id, child_bounds);
reflow_parent = true;
} }
reflown.insert(*id); reflown.insert(*id);
} }
Type::Group(_) => { Type::Group(_) => {
if let Some(shape_bounds) = calculate_group_bounds(shape, shapes, bounds) { if let Some(shape_bounds) = calculate_group_bounds(shape, shapes, bounds) {
bounds.insert(shape.id, shape_bounds); bounds.insert(shape.id, shape_bounds);
reflow_parent = true;
} }
reflown.insert(*id); reflown.insert(*id);
} }
Type::Bool(_) => { Type::Bool(_) => {
if let Some(shape_bounds) = calculate_bool_bounds(shape, shapes, bounds, modifiers) { if let Some(shape_bounds) = calculate_bool_bounds(shape, shapes, bounds, modifiers) {
bounds.insert(shape.id, shape_bounds); bounds.insert(shape.id, shape_bounds);
reflow_parent = true;
} }
reflown.insert(*id); reflown.insert(*id);
} }
_ => { _ => {}
// Other shapes don't have to be reflown
reflow_parent = true;
}
} }
if let Some(parent) = shape.parent_id.and_then(|id| shapes.get(&id)) { if let Some(parent) = shape.parent_id.and_then(|id| shapes.get(&id)) {
if reflow_parent && (parent.has_layout() || parent.is_group_like()) { if parent.has_layout() || parent.is_group_like() {
entries.push_back(Modifier::reflow(parent.id)); entries.push_back(Modifier::reflow(parent.id));
} }
} }