Fixed an issue where ComponentList could generate elements with negative widths

This commit is contained in:
Leon Styhre 2024-08-13 21:41:17 +02:00
parent 3f8abb0807
commit eccc5095fb

View file

@ -382,6 +382,10 @@ void ComponentList::updateElementSize(const ComponentListRow& row)
width -= it->component->getSize().x;
}
// This can happen if the element has zero width, or close to zero width.
if (width < 0.0f)
width = 0.0f;
// Redistribute the "unused" width equally among the components if resizeWidth is set to true.
width = width / resizeVec.size();
for (auto it = resizeVec.cbegin(); it != resizeVec.cend(); ++it)