LayoutUtils: Style fix, remove leading space
This commit is contained in:
parent
4e8acd3232
commit
04b48a29bd
@ -176,11 +176,9 @@ BLayoutUtils::AlignInFrame(BView* view, BRect frame)
|
|||||||
{
|
{
|
||||||
BSize maxSize = view->MaxSize();
|
BSize maxSize = view->MaxSize();
|
||||||
BAlignment alignment = view->LayoutAlignment();
|
BAlignment alignment = view->LayoutAlignment();
|
||||||
|
|
||||||
if (view->HasHeightForWidth()) {
|
if (view->HasHeightForWidth()) {
|
||||||
// The view has height for width, so we do the horizontal alignment
|
// The view has height for width, so we do the horizontal alignment
|
||||||
// ourselves and restrict the height max constraint respectively.
|
// ourselves and restrict the height max constraint respectively.
|
||||||
|
|
||||||
if (maxSize.width < frame.Width()
|
if (maxSize.width < frame.Width()
|
||||||
&& alignment.horizontal != B_ALIGN_USE_FULL_WIDTH) {
|
&& alignment.horizontal != B_ALIGN_USE_FULL_WIDTH) {
|
||||||
frame.OffsetBy(floor((frame.Width() - maxSize.width)
|
frame.OffsetBy(floor((frame.Width() - maxSize.width)
|
||||||
@ -188,17 +186,14 @@ BLayoutUtils::AlignInFrame(BView* view, BRect frame)
|
|||||||
frame.right = frame.left + maxSize.width;
|
frame.right = frame.left + maxSize.width;
|
||||||
}
|
}
|
||||||
alignment.horizontal = B_ALIGN_USE_FULL_WIDTH;
|
alignment.horizontal = B_ALIGN_USE_FULL_WIDTH;
|
||||||
|
|
||||||
float minHeight;
|
float minHeight;
|
||||||
float maxHeight;
|
float maxHeight;
|
||||||
float preferredHeight;
|
float preferredHeight;
|
||||||
view->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight,
|
view->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight,
|
||||||
&preferredHeight);
|
&preferredHeight);
|
||||||
|
|
||||||
frame.bottom = frame.top + max_c(frame.Height(), minHeight);
|
frame.bottom = frame.top + max_c(frame.Height(), minHeight);
|
||||||
maxSize.height = minHeight;
|
maxSize.height = minHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = AlignInFrame(frame, maxSize, alignment);
|
frame = AlignInFrame(frame, maxSize, alignment);
|
||||||
view->MoveTo(frame.LeftTop());
|
view->MoveTo(frame.LeftTop());
|
||||||
view->ResizeTo(frame.Size());
|
view->ResizeTo(frame.Size());
|
||||||
|
Loading…
Reference in New Issue
Block a user