mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Added a new cropSize property to the image element.
This commit is contained in:
parent
fa7b317982
commit
b9a2a146b7
|
@ -169,6 +169,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"reflectionsOpacity", FLOAT},
|
{"reflectionsOpacity", FLOAT},
|
||||||
{"reflectionsFalloff", FLOAT},
|
{"reflectionsFalloff", FLOAT},
|
||||||
{"unfocusedItemOpacity", FLOAT},
|
{"unfocusedItemOpacity", FLOAT},
|
||||||
|
{"imageFit", STRING},
|
||||||
{"fastScrolling", BOOLEAN},
|
{"fastScrolling", BOOLEAN},
|
||||||
{"defaultLogo", PATH}, // For backward compatibility with legacy themes.
|
{"defaultLogo", PATH}, // For backward compatibility with legacy themes.
|
||||||
{"logoSize", NORMALIZED_PAIR}, // For backward compatibility with legacy themes.
|
{"logoSize", NORMALIZED_PAIR}, // For backward compatibility with legacy themes.
|
||||||
|
@ -286,6 +287,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"image",
|
{"image",
|
||||||
{{"pos", NORMALIZED_PAIR},
|
{{"pos", NORMALIZED_PAIR},
|
||||||
{"size", NORMALIZED_PAIR},
|
{"size", NORMALIZED_PAIR},
|
||||||
|
{"cropSize", NORMALIZED_PAIR},
|
||||||
{"maxSize", NORMALIZED_PAIR},
|
{"maxSize", NORMALIZED_PAIR},
|
||||||
{"origin", NORMALIZED_PAIR},
|
{"origin", NORMALIZED_PAIR},
|
||||||
{"rotation", FLOAT},
|
{"rotation", FLOAT},
|
||||||
|
|
|
@ -467,6 +467,12 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
imageMaxSize.y = glm::clamp(imageMaxSize.y, 0.001f, 3.0f);
|
imageMaxSize.y = glm::clamp(imageMaxSize.y, 0.001f, 3.0f);
|
||||||
setMaxSize(imageMaxSize * scale);
|
setMaxSize(imageMaxSize * scale);
|
||||||
}
|
}
|
||||||
|
else if (elem->has("cropSize")) {
|
||||||
|
glm::vec2 imageCropSize {elem->get<glm::vec2>("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")) {
|
if (elem->has("interpolation")) {
|
||||||
|
|
Loading…
Reference in a new issue