Merge branch 'staging-render' into develop

This commit is contained in:
Andrey Antukh
2025-12-22 09:24:04 +01:00
12 changed files with 114 additions and 104 deletions

View File

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

View File

@@ -344,6 +344,7 @@ fn distribute_fill_across_space(layout_axis: &LayoutAxis, tracks: &mut [TrackDat
let mut size =
track.across_size - child.margin_across_start - child.margin_across_end;
size = size.clamp(child.min_across_size, child.max_across_size);
size = f32::min(size, layout_axis.across_space());
child.across_size = size;
}
}
@@ -545,14 +546,22 @@ fn child_position(
align_self: Some(align_self),
..
}) => match align_self {
AlignSelf::Center => (track.across_size - child_axis.across_size) / 2.0,
AlignSelf::Center => {
(track.across_size - child_axis.across_size + child_axis.margin_across_start
- child_axis.margin_across_end)
/ 2.0
}
AlignSelf::End => {
track.across_size - child_axis.across_size - child_axis.margin_across_end
}
_ => child_axis.margin_across_start,
},
_ => match layout_data.align_items {
AlignItems::Center => (track.across_size - child_axis.across_size) / 2.0,
AlignItems::Center => {
(track.across_size - child_axis.across_size + child_axis.margin_across_start
- child_axis.margin_across_end)
/ 2.0
}
AlignItems::End => {
track.across_size - child_axis.across_size - child_axis.margin_across_end
}
@@ -578,7 +587,11 @@ pub fn reflow_flex_layout(
let tracks = calculate_track_data(shape, layout_data, flex_data, layout_bounds, shapes, bounds);
for track in tracks.iter() {
let total_shapes_size = track.shapes.iter().map(|s| s.main_size).sum::<f32>();
let total_shapes_size = track
.shapes
.iter()
.map(|s| s.main_size + s.margin_main_start + s.margin_main_end)
.sum::<f32>();
let mut shape_anchor = first_anchor(layout_data, &layout_axis, track, total_shapes_size);
for child_axis in track.shapes.iter() {