Use soft inequality constraints for the max area size.
Only if the alignment is set to use the full width/ height a hard inequality constraint is used.
This commit is contained in:
parent
18e5da6297
commit
25e1abc33c
@ -549,6 +549,8 @@ Area::_Init(LinearSpec* ls, XTab* left, YTab* top, XTab* right, YTab* bottom,
|
|||||||
// really above the bottom y-tab
|
// really above the bottom y-tab
|
||||||
fMinContentWidth = ls->AddConstraint(-1.0, fLeft, 1.0, fRight, kGE, 0);
|
fMinContentWidth = ls->AddConstraint(-1.0, fLeft, 1.0, fRight, kGE, 0);
|
||||||
fMinContentHeight = ls->AddConstraint(-1.0, fTop, 1.0, fBottom, kGE, 0);
|
fMinContentHeight = ls->AddConstraint(-1.0, fTop, 1.0, fBottom, kGE, 0);
|
||||||
|
|
||||||
|
InvalidateSizeConstraints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -619,26 +621,41 @@ Area::_UpdateMaxSizeConstraint(BSize max)
|
|||||||
max.width += LeftInset() + RightInset();
|
max.width += LeftInset() + RightInset();
|
||||||
max.height += TopInset() + BottomInset();
|
max.height += TopInset() + BottomInset();
|
||||||
|
|
||||||
|
const double kPriority = 100;
|
||||||
// we only need max constraints if the alignment is full height/width
|
// we only need max constraints if the alignment is full height/width
|
||||||
// otherwise we can just align the item in the free space
|
// otherwise we can just align the item in the free space
|
||||||
BAlignment alignment = fLayoutItem->Alignment();
|
BAlignment alignment = fLayoutItem->Alignment();
|
||||||
if (alignment.Vertical() == B_ALIGN_USE_FULL_HEIGHT) {
|
double priority = kPriority;
|
||||||
|
if (alignment.Vertical() == B_ALIGN_USE_FULL_HEIGHT)
|
||||||
|
priority = -1;
|
||||||
|
|
||||||
|
if (max.Height() < 20000) {
|
||||||
if (fMaxContentHeight == NULL) {
|
if (fMaxContentHeight == NULL) {
|
||||||
fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom,
|
fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom,
|
||||||
kLE, max.Height());
|
kLE, max.Height(), priority, priority);
|
||||||
} else
|
} else {
|
||||||
fMaxContentHeight->SetRightSide(max.Height());
|
fMaxContentHeight->SetRightSide(max.Height());
|
||||||
|
fMaxContentHeight->SetPenaltyNeg(priority);
|
||||||
|
fMaxContentHeight->SetPenaltyPos(priority);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
delete fMaxContentHeight;
|
delete fMaxContentHeight;
|
||||||
fMaxContentHeight = NULL;
|
fMaxContentHeight = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alignment.Horizontal() == B_ALIGN_USE_FULL_WIDTH) {
|
priority = kPriority;
|
||||||
|
if (alignment.Horizontal() == B_ALIGN_USE_FULL_WIDTH)
|
||||||
|
priority = -1;
|
||||||
|
|
||||||
|
if (max.Width() < 20000) {
|
||||||
if (fMaxContentWidth == NULL) {
|
if (fMaxContentWidth == NULL) {
|
||||||
fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight, kLE,
|
fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight, kLE,
|
||||||
max.Width());
|
max.Width(), priority, priority);
|
||||||
} else
|
} else {
|
||||||
fMaxContentWidth->SetRightSide(max.Width());
|
fMaxContentWidth->SetRightSide(max.Width());
|
||||||
|
fMaxContentWidth->SetPenaltyNeg(priority);
|
||||||
|
fMaxContentWidth->SetPenaltyPos(priority);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
delete fMaxContentWidth;
|
delete fMaxContentWidth;
|
||||||
fMaxContentWidth = NULL;
|
fMaxContentWidth = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user