mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-24 01:54:22 +00:00
Respect GridItem min/max width/height
This commit is contained in:
parent
ab2adfb6a8
commit
1a8d676f5b
1 changed files with 10 additions and 16 deletions
|
|
@ -918,26 +918,20 @@ struct Grid::BoxAlignment
|
|||
// align and justify
|
||||
auto r = area;
|
||||
|
||||
if (item.width != (float) GridItem::notAssigned)
|
||||
r.setWidth (item.width);
|
||||
|
||||
if (item.height != (float) GridItem::notAssigned)
|
||||
r.setHeight (item.height);
|
||||
if (item.width != (float) GridItem::notAssigned) r.setWidth (item.width);
|
||||
if (item.height != (float) GridItem::notAssigned) r.setHeight (item.height);
|
||||
if (item.maxWidth != GridItem::notAssigned) r.setWidth (jmin (item.maxWidth, r.getWidth()));
|
||||
if (item.minWidth != GridItem::notAssigned) r.setWidth (jmax (item.minWidth, r.getWidth()));
|
||||
if (item.maxHeight != GridItem::notAssigned) r.setHeight (jmin (item.maxHeight, r.getHeight()));
|
||||
if (item.minHeight != GridItem::notAssigned) r.setHeight (jmax (item.minHeight, r.getHeight()));
|
||||
|
||||
if (alignType == Grid::AlignItems::start && justifyType == Grid::JustifyItems::start)
|
||||
return r;
|
||||
|
||||
if (alignType == Grid::AlignItems::end)
|
||||
r.setY (r.getY() + (area.getHeight() - r.getHeight()));
|
||||
|
||||
if (justifyType == Grid::JustifyItems::end)
|
||||
r.setX (r.getX() + (area.getWidth() - r.getWidth()));
|
||||
|
||||
if (alignType == Grid::AlignItems::center)
|
||||
r.setCentre (r.getCentreX(), area.getCentreY());
|
||||
|
||||
if (justifyType == Grid::JustifyItems::center)
|
||||
r.setCentre (area.getCentreX(), r.getCentreY());
|
||||
if (alignType == Grid::AlignItems::end) r.setY (r.getY() + (area.getHeight() - r.getHeight()));
|
||||
if (justifyType == Grid::JustifyItems::end) r.setX (r.getX() + (area.getWidth() - r.getWidth()));
|
||||
if (alignType == Grid::AlignItems::center) r.setCentre (r.getCentreX(), area.getCentreY());
|
||||
if (justifyType == Grid::JustifyItems::center) r.setCentre (area.getCentreX(), r.getCentreY());
|
||||
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue