Fixed an issue where two BadgeComponent default values were not always set.

This commit is contained in:
Leon Styhre 2022-04-15 21:26:07 +02:00
parent 5c7c62b16a
commit a149124252

View file

@ -241,6 +241,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
} }
} }
mFlexboxComponent.setLines(3);
if (elem->has("lines")) { if (elem->has("lines")) {
const unsigned int lines {elem->get<unsigned int>("lines")}; const unsigned int lines {elem->get<unsigned int>("lines")};
if (lines < 1 || lines > 10) { if (lines < 1 || lines > 10) {
@ -251,10 +252,8 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
mFlexboxComponent.setLines(lines); mFlexboxComponent.setLines(lines);
} }
} }
else {
mFlexboxComponent.setLines(3);
}
mFlexboxComponent.setItemsPerLine(4);
if (elem->has("itemsPerLine")) { if (elem->has("itemsPerLine")) {
const unsigned int itemsPerLine {elem->get<unsigned int>("itemsPerLine")}; const unsigned int itemsPerLine {elem->get<unsigned int>("itemsPerLine")};
if (itemsPerLine < 1 || itemsPerLine > 10) { if (itemsPerLine < 1 || itemsPerLine > 10) {
@ -266,9 +265,6 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
mFlexboxComponent.setItemsPerLine(itemsPerLine); mFlexboxComponent.setItemsPerLine(itemsPerLine);
} }
} }
else {
mFlexboxComponent.setItemsPerLine(4);
}
if (elem->has("itemMargin")) { if (elem->has("itemMargin")) {
glm::vec2 itemMargin = elem->get<glm::vec2>("itemMargin"); glm::vec2 itemMargin = elem->get<glm::vec2>("itemMargin");