mirror of
https://github.com/penpot/penpot.git
synced 2026-05-07 17:18:35 +00:00
🐛 Fix problem with margins in grid (#8748)
This commit is contained in:
parent
ca427bcd4e
commit
1539c074b4
@ -750,7 +750,8 @@ pub fn reflow_grid_layout(
|
||||
let mut new_width = child_bounds.width();
|
||||
if child.is_layout_horizontal_fill() {
|
||||
let margin_left = child.layout_item.map(|i| i.margin_left).unwrap_or(0.0);
|
||||
new_width = cell.width - margin_left;
|
||||
let margin_right = child.layout_item.map(|i| i.margin_right).unwrap_or(0.0);
|
||||
new_width = cell.width - margin_left - margin_right;
|
||||
let min_width = child.layout_item.and_then(|i| i.min_w).unwrap_or(MIN_SIZE);
|
||||
let max_width = child.layout_item.and_then(|i| i.max_w).unwrap_or(MAX_SIZE);
|
||||
new_width = new_width.clamp(min_width, max_width);
|
||||
@ -759,7 +760,8 @@ pub fn reflow_grid_layout(
|
||||
let mut new_height = child_bounds.height();
|
||||
if child.is_layout_vertical_fill() {
|
||||
let margin_top = child.layout_item.map(|i| i.margin_top).unwrap_or(0.0);
|
||||
new_height = cell.height - margin_top;
|
||||
let margin_bottom = child.layout_item.map(|i| i.margin_bottom).unwrap_or(0.0);
|
||||
new_height = cell.height - margin_top - margin_bottom;
|
||||
let min_height = child.layout_item.and_then(|i| i.min_h).unwrap_or(MIN_SIZE);
|
||||
let max_height = child.layout_item.and_then(|i| i.max_h).unwrap_or(MAX_SIZE);
|
||||
new_height = new_height.clamp(min_height, max_height);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user