Added clamping of 0.0 to 1.0 to the rotationOrigin property.

This commit is contained in:
Leon Styhre 2022-08-30 19:56:38 +02:00
parent 496b60fa7d
commit eced44934e

View file

@ -361,7 +361,7 @@ void GuiComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("rotation")) if (elem->has("rotation"))
setRotationDegrees(elem->get<float>("rotation")); setRotationDegrees(elem->get<float>("rotation"));
if (elem->has("rotationOrigin")) if (elem->has("rotationOrigin"))
setRotationOrigin(elem->get<glm::vec2>("rotationOrigin")); setRotationOrigin(glm::clamp(elem->get<glm::vec2>("rotationOrigin"), 0.0f, 1.0f));
} }
if (properties & ThemeFlags::Z_INDEX && elem->has("zIndex")) if (properties & ThemeFlags::Z_INDEX && elem->has("zIndex"))