Ignore percent layout size if there is only one widget.

This commit is contained in:
and3md 2017-08-16 20:43:18 +02:00
parent 9d8e314eac
commit 5bd0ea1d10
1 changed files with 2 additions and 3 deletions

View File

@ -110,7 +110,6 @@ class LayoutItems {
_maxSecondarySize = 0;
_measureParentSize.x = parentWidth;
_measureParentSize.y = parentHeight;
// bool
bool hasPercentSizeWidget = false;
size_t percenSizeWidgetIndex;
// measure
@ -133,8 +132,8 @@ class LayoutItems {
}
if (hasPercentSizeWidget) {
LayoutItem * item = &_list[percenSizeWidgetIndex];
item._measuredSize = to!int(_totalSize * ((1 / (1 - cast (double) (fromPercentSize(item._layoutSize, 100))/100)) - 1));
if (_totalSize > 0)
item._measuredSize = to!int(_totalSize * ((1 / (1 - cast (double) (fromPercentSize(item._layoutSize, 100))/100)) - 1));
_totalSize += item._measuredSize;
}
return _orientation == Orientation.Horizontal ? Point(_totalSize, _maxSecondarySize) : Point(_maxSecondarySize, _totalSize);