mirror of
https://github.com/ratatui/ratatui.git
synced 2025-10-02 07:21:24 +00:00
layout: force constraint that width and height are non-negative
This commit is contained in:
parent
ac99104114
commit
f474c76e19
@ -209,6 +209,8 @@ fn split(area: Rect, layout: &Layout) -> Vec<Rect> {
|
|||||||
let mut ccs: Vec<CassowaryConstraint> =
|
let mut ccs: Vec<CassowaryConstraint> =
|
||||||
Vec::with_capacity(elements.len() * 4 + layout.constraints.len() * 6);
|
Vec::with_capacity(elements.len() * 4 + layout.constraints.len() * 6);
|
||||||
for elt in &elements {
|
for elt in &elements {
|
||||||
|
ccs.push(elt.width | GE(REQUIRED) | 0f64);
|
||||||
|
ccs.push(elt.height | GE(REQUIRED) | 0f64);
|
||||||
ccs.push(elt.left() | GE(REQUIRED) | f64::from(dest_area.left()));
|
ccs.push(elt.left() | GE(REQUIRED) | f64::from(dest_area.left()));
|
||||||
ccs.push(elt.top() | GE(REQUIRED) | f64::from(dest_area.top()));
|
ccs.push(elt.top() | GE(REQUIRED) | f64::from(dest_area.top()));
|
||||||
ccs.push(elt.right() | LE(REQUIRED) | f64::from(dest_area.right()));
|
ccs.push(elt.right() | LE(REQUIRED) | f64::from(dest_area.right()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user