Clamped the themeable origin values to 0.0 to 1.0

This commit is contained in:
Leon Styhre 2022-02-19 20:24:25 +01:00
parent 374a66dd76
commit 4b0d3a4ecb

View file

@ -342,7 +342,7 @@ void GuiComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
// Position + size also implies origin. // Position + size also implies origin.
if ((properties & ORIGIN || (properties & POSITION && properties & ThemeFlags::SIZE)) && if ((properties & ORIGIN || (properties & POSITION && properties & ThemeFlags::SIZE)) &&
elem->has("origin")) { elem->has("origin")) {
setOrigin(elem->get<glm::vec2>("origin")); setOrigin(glm::clamp(elem->get<glm::vec2>("origin"), 0.0f, 1.0f));
} }
if (properties & ThemeFlags::ROTATION) { if (properties & ThemeFlags::ROTATION) {