Changed: Use table width used min-width and allow table cells to properly fit

--HG--
branch : develop
This commit is contained in:
Nimetu 2019-04-30 22:52:38 +03:00
parent f275bcc279
commit cbe4bf33d6

View file

@ -843,6 +843,19 @@ namespace NLGUI
ratio -= _Columns[i].TableRatio; ratio -= _Columns[i].TableRatio;
} }
// force table width to fit all columns
// if width is set, then use column min width
if (ForceWidthMin > 0)
tableWidthMax = std::min(_LastParentW - borderWidth, std::max(tableWidthMax, tableWidth));
else
tableWidthMax = std::min(_LastParentW - borderWidth, std::max(tableWidthMax, tableMaxContentWidth));
if (tableWidthMax < 0)
tableWidthMax = 0;
if (tableWidthMax < tableWidthMin)
std::swap(tableWidthMin, tableWidthMax);
// Eval table size with all percent cells resized // Eval table size with all percent cells resized
sint32 tableWidthSizeAfterPercent = tableWidth; sint32 tableWidthSizeAfterPercent = tableWidth;
for (i=0; i<_Columns.size(); i++) for (i=0; i<_Columns.size(); i++)