Widgets/BoxLayout: Try to fix widget layout
This commit is contained in:
parent
0c29bce3d8
commit
81c5322331
|
|
@ -65,6 +65,7 @@ namespace Nz
|
|||
Nz::Vector2f layoutSize = GetSize();
|
||||
float maxLayoutSize = layoutSize[axis];
|
||||
float availableSpace = maxLayoutSize - m_spacing * (widgetChildCount - 1);
|
||||
float optimalSize = availableSpace / widgetChildCount;
|
||||
|
||||
// Handle size
|
||||
ForEachWidgetChild([&](BaseWidget* child)
|
||||
|
|
@ -94,6 +95,8 @@ namespace Nz
|
|||
else
|
||||
m_state->solver.addConstraint({ (sizeVar >= maxLayoutSize) | kiwi::strength::medium });
|
||||
|
||||
m_state->solver.addConstraint({ (sizeVar >= optimalSize) | kiwi::strength::medium });
|
||||
|
||||
sizeSum = sizeSum + sizeVar;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue