mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 17:45:38 +00:00
Fixed an issue where ComponentList could generate elements with negative widths
This commit is contained in:
parent
3f8abb0807
commit
eccc5095fb
|
@ -382,6 +382,10 @@ void ComponentList::updateElementSize(const ComponentListRow& row)
|
||||||
width -= it->component->getSize().x;
|
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.
|
// Redistribute the "unused" width equally among the components if resizeWidth is set to true.
|
||||||
width = width / resizeVec.size();
|
width = width / resizeVec.size();
|
||||||
for (auto it = resizeVec.cbegin(); it != resizeVec.cend(); ++it)
|
for (auto it = resizeVec.cbegin(); it != resizeVec.cend(); ++it)
|
||||||
|
|
Loading…
Reference in a new issue