diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 79abe4525..c72613168 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -169,6 +169,7 @@ std::map> {"reflectionsOpacity", FLOAT}, {"reflectionsFalloff", FLOAT}, {"unfocusedItemOpacity", FLOAT}, + {"imageFit", STRING}, {"fastScrolling", BOOLEAN}, {"defaultLogo", PATH}, // For backward compatibility with legacy themes. {"logoSize", NORMALIZED_PAIR}, // For backward compatibility with legacy themes. @@ -286,6 +287,7 @@ std::map> {"image", {{"pos", NORMALIZED_PAIR}, {"size", NORMALIZED_PAIR}, + {"cropSize", NORMALIZED_PAIR}, {"maxSize", NORMALIZED_PAIR}, {"origin", NORMALIZED_PAIR}, {"rotation", FLOAT}, diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index e4727e5f6..bbeedd24a 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -467,6 +467,12 @@ void ImageComponent::applyTheme(const std::shared_ptr& theme, imageMaxSize.y = glm::clamp(imageMaxSize.y, 0.001f, 3.0f); setMaxSize(imageMaxSize * scale); } + else if (elem->has("cropSize")) { + glm::vec2 imageCropSize {elem->get("cropSize")}; + imageCropSize.x = glm::clamp(imageCropSize.x, 0.001f, 3.0f); + imageCropSize.y = glm::clamp(imageCropSize.y, 0.001f, 3.0f); + setCroppedSize(imageCropSize * scale); + } } if (elem->has("interpolation")) {