🐛 Fix problems with flex layout in new render

This commit is contained in:
alonso.torres
2025-11-28 10:45:29 +01:00
parent 0198d41757
commit 130b8c8214
4 changed files with 27 additions and 21 deletions

View File

@@ -291,7 +291,8 @@
(api/set-grid-layout-data shape)
(ctl/flex-layout? shape)
(api/set-flex-layout shape)))
(api/set-flex-layout shape))
(api/set-layout-child shape))
;; Property not in WASM
nil))))

View File

@@ -53,15 +53,6 @@ struct LayoutAxis {
is_auto_across: bool,
}
impl LayoutAxis {
fn main_space(&self) -> f32 {
self.main_size - self.padding_main_start - self.padding_main_end
}
fn across_space(&self) -> f32 {
self.across_size - self.padding_across_start - self.padding_across_end
}
}
impl LayoutAxis {
fn new(
shape: &Shape,
@@ -101,6 +92,13 @@ impl LayoutAxis {
}
}
}
fn main_space(&self) -> f32 {
self.main_size - self.padding_main_start - self.padding_main_end
}
fn across_space(&self) -> f32 {
self.across_size - self.padding_across_start - self.padding_across_end
}
}
#[derive(Debug, Copy, Clone)]
@@ -624,6 +622,9 @@ pub fn reflow_flex_layout(
}
result.push_back(Modifier::transform_propagate(child.id, transform));
if child.has_layout() {
result.push_back(Modifier::reflow(child.id));
}
shape_anchor = next_anchor(
layout_data,

View File

@@ -792,6 +792,9 @@ pub fn reflow_grid_layout(
}
result.push_back(Modifier::transform_propagate(child.id, transform));
if child.has_layout() {
result.push_back(Modifier::reflow(child.id));
}
}
if shape.is_layout_horizontal_auto() || shape.is_layout_vertical_auto() {

View File

@@ -59,18 +59,19 @@ pub extern "C" fn set_layout_child_data(
is_absolute: bool,
z_index: i32,
) {
let h_sizing = RawSizing::from(h_sizing);
let v_sizing = RawSizing::from(v_sizing);
let max_h = if has_max_h { Some(max_h) } else { None };
let min_h = if has_min_h { Some(min_h) } else { None };
let max_w = if has_max_w { Some(max_w) } else { None };
let min_w = if has_min_w { Some(min_w) } else { None };
let raw_align_self = align::RawAlignSelf::from(align_self);
let align_self = raw_align_self.try_into().ok();
with_current_shape_mut!(state, |shape: &mut Shape| {
let h_sizing = RawSizing::from(h_sizing);
let v_sizing = RawSizing::from(v_sizing);
let max_h = if has_max_h { Some(max_h) } else { None };
let min_h = if has_min_h { Some(min_h) } else { None };
let max_w = if has_max_w { Some(max_w) } else { None };
let min_w = if has_min_w { Some(min_w) } else { None };
let raw_align_self = align::RawAlignSelf::from(align_self);
let align_self = raw_align_self.try_into().ok();
shape.set_flex_layout_child_data(
margin_top,
margin_right,