mirror of
https://github.com/penpot/penpot.git
synced 2026-09-18 18:06:14 +00:00
🐛 Fix problems with flex layout in new render
This commit is contained in:
parent
0198d41757
commit
130b8c8214
@ -291,7 +291,8 @@
|
|||||||
(api/set-grid-layout-data shape)
|
(api/set-grid-layout-data shape)
|
||||||
|
|
||||||
(ctl/flex-layout? shape)
|
(ctl/flex-layout? shape)
|
||||||
(api/set-flex-layout shape)))
|
(api/set-flex-layout shape))
|
||||||
|
(api/set-layout-child shape))
|
||||||
|
|
||||||
;; Property not in WASM
|
;; Property not in WASM
|
||||||
nil))))
|
nil))))
|
||||||
|
|||||||
@ -53,15 +53,6 @@ struct LayoutAxis {
|
|||||||
is_auto_across: bool,
|
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 {
|
impl LayoutAxis {
|
||||||
fn new(
|
fn new(
|
||||||
shape: &Shape,
|
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)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
@ -624,6 +622,9 @@ pub fn reflow_flex_layout(
|
|||||||
}
|
}
|
||||||
|
|
||||||
result.push_back(Modifier::transform_propagate(child.id, transform));
|
result.push_back(Modifier::transform_propagate(child.id, transform));
|
||||||
|
if child.has_layout() {
|
||||||
|
result.push_back(Modifier::reflow(child.id));
|
||||||
|
}
|
||||||
|
|
||||||
shape_anchor = next_anchor(
|
shape_anchor = next_anchor(
|
||||||
layout_data,
|
layout_data,
|
||||||
|
|||||||
@ -792,6 +792,9 @@ pub fn reflow_grid_layout(
|
|||||||
}
|
}
|
||||||
|
|
||||||
result.push_back(Modifier::transform_propagate(child.id, transform));
|
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() {
|
if shape.is_layout_horizontal_auto() || shape.is_layout_vertical_auto() {
|
||||||
|
|||||||
@ -59,18 +59,19 @@ pub extern "C" fn set_layout_child_data(
|
|||||||
is_absolute: bool,
|
is_absolute: bool,
|
||||||
z_index: i32,
|
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| {
|
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(
|
shape.set_flex_layout_child_data(
|
||||||
margin_top,
|
margin_top,
|
||||||
margin_right,
|
margin_right,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user