Made it possible to set negative values for the selectedItemMargins carousel property.

This commit is contained in:
Leon Styhre 2023-01-29 23:05:28 +01:00
parent 2501a0aa26
commit 6c8985fe3e

View file

@ -1261,7 +1261,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (mType == CarouselType::HORIZONTAL || mType == CarouselType::VERTICAL) { if (mType == CarouselType::HORIZONTAL || mType == CarouselType::VERTICAL) {
if (elem->has("selectedItemMargins")) { if (elem->has("selectedItemMargins")) {
const glm::vec2 selectedItemMargins { const glm::vec2 selectedItemMargins {
glm::clamp(elem->get<glm::vec2>("selectedItemMargins"), 0.0f, 1.0f)}; glm::clamp(elem->get<glm::vec2>("selectedItemMargins"), -1.0f, 1.0f)};
if (mType == CarouselType::HORIZONTAL) if (mType == CarouselType::HORIZONTAL)
mSelectedItemMargins = selectedItemMargins * Renderer::getScreenWidth(); mSelectedItemMargins = selectedItemMargins * Renderer::getScreenWidth();
else else