Fix width column factor computation in table
This commit is contained in:
parent
6e71c7dd6f
commit
a3d42e2d37
1 changed files with 51 additions and 51 deletions
|
|
@ -250,11 +250,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let width_factor =
|
let width_factor = width.fill_factor();
|
||||||
width.fill_factor().max(size.width.fill_factor());
|
|
||||||
let height_factor = size.height.fill_factor();
|
let height_factor = size.height.fill_factor();
|
||||||
|
|
||||||
if width_factor != 0 || height_factor != 0 {
|
if width_factor != 0 || height_factor != 0 || size.width.is_fill() {
|
||||||
column_factors[column] =
|
column_factors[column] =
|
||||||
column_factors[column].max(width_factor);
|
column_factors[column].max(width_factor);
|
||||||
|
|
||||||
|
|
@ -332,56 +331,57 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if width_factor != 0
|
if width_factor == 0
|
||||||
|| size.width.fill_factor() != 0
|
&& size.width.fill_factor() == 0
|
||||||
|| size.height.fill_factor() != 0
|
&& size.height.fill_factor() == 0
|
||||||
{
|
{
|
||||||
let row_factor = row_factors[row];
|
continue;
|
||||||
|
|
||||||
let max_width = if width_factor == 0 {
|
|
||||||
if size.width.is_fill() {
|
|
||||||
metrics.columns[column]
|
|
||||||
} else {
|
|
||||||
(available.width - x).max(0.0)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
width_unit * width_factor as f32
|
|
||||||
};
|
|
||||||
|
|
||||||
let max_height = if row_factor == 0 {
|
|
||||||
if size.height.is_fill() {
|
|
||||||
metrics.rows[row]
|
|
||||||
} else {
|
|
||||||
(available.height - y).max(0.0)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
height_unit * row_factor as f32
|
|
||||||
};
|
|
||||||
|
|
||||||
let limits = layout::Limits::new(
|
|
||||||
Size::ZERO,
|
|
||||||
Size::new(max_width, max_height),
|
|
||||||
)
|
|
||||||
.width(width);
|
|
||||||
|
|
||||||
let layout = cell.as_widget().layout(state, renderer, &limits);
|
|
||||||
let size = limits.resolve(
|
|
||||||
if let Length::Fixed(_) = width {
|
|
||||||
width
|
|
||||||
} else {
|
|
||||||
table_fluid
|
|
||||||
},
|
|
||||||
Length::Shrink,
|
|
||||||
layout.size(),
|
|
||||||
);
|
|
||||||
|
|
||||||
metrics.columns[column] =
|
|
||||||
metrics.columns[column].max(size.width);
|
|
||||||
metrics.rows[row] = metrics.rows[row].max(size.height);
|
|
||||||
cells[i] = layout;
|
|
||||||
|
|
||||||
y += size.height + spacing_y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let row_factor = row_factors[row];
|
||||||
|
|
||||||
|
let max_width = if width_factor == 0 {
|
||||||
|
if size.width.is_fill() {
|
||||||
|
metrics.columns[column]
|
||||||
|
} else {
|
||||||
|
(available.width - x).max(0.0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
width_unit * width_factor as f32
|
||||||
|
};
|
||||||
|
|
||||||
|
let max_height = if row_factor == 0 {
|
||||||
|
if size.height.is_fill() {
|
||||||
|
metrics.rows[row]
|
||||||
|
} else {
|
||||||
|
(available.height - y).max(0.0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
height_unit * row_factor as f32
|
||||||
|
};
|
||||||
|
|
||||||
|
let limits = layout::Limits::new(
|
||||||
|
Size::ZERO,
|
||||||
|
Size::new(max_width, max_height),
|
||||||
|
)
|
||||||
|
.width(width);
|
||||||
|
|
||||||
|
let layout = cell.as_widget().layout(state, renderer, &limits);
|
||||||
|
let size = limits.resolve(
|
||||||
|
if let Length::Fixed(_) = width {
|
||||||
|
width
|
||||||
|
} else {
|
||||||
|
table_fluid
|
||||||
|
},
|
||||||
|
Length::Shrink,
|
||||||
|
layout.size(),
|
||||||
|
);
|
||||||
|
|
||||||
|
metrics.columns[column] = metrics.columns[column].max(size.width);
|
||||||
|
metrics.rows[row] = metrics.rows[row].max(size.height);
|
||||||
|
cells[i] = layout;
|
||||||
|
|
||||||
|
y += size.height + spacing_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// THIRD PASS
|
// THIRD PASS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue