mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 03:55:40 +00:00
Added a rowTransitions property to GridComponent.
This commit is contained in:
parent
3ec8ec14ca
commit
0a2a6d1907
|
@ -161,6 +161,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"itemSize", NORMALIZED_PAIR},
|
{"itemSize", NORMALIZED_PAIR},
|
||||||
{"itemScale", FLOAT},
|
{"itemScale", FLOAT},
|
||||||
{"itemTransitions", STRING},
|
{"itemTransitions", STRING},
|
||||||
|
{"rowTransitions", STRING},
|
||||||
{"itemSpacing", NORMALIZED_PAIR},
|
{"itemSpacing", NORMALIZED_PAIR},
|
||||||
{"itemHorizontalAlignment", STRING},
|
{"itemHorizontalAlignment", STRING},
|
||||||
{"itemVerticalAlignment", STRING},
|
{"itemVerticalAlignment", STRING},
|
||||||
|
|
|
@ -102,6 +102,7 @@ private:
|
||||||
float mItemScale;
|
float mItemScale;
|
||||||
glm::vec2 mItemSpacing;
|
glm::vec2 mItemSpacing;
|
||||||
bool mInstantItemTransitions;
|
bool mInstantItemTransitions;
|
||||||
|
bool mInstantRowTransitions;
|
||||||
float mHorizontalMargin;
|
float mHorizontalMargin;
|
||||||
float mVerticalMargin;
|
float mVerticalMargin;
|
||||||
float mUnfocusedItemOpacity;
|
float mUnfocusedItemOpacity;
|
||||||
|
@ -136,6 +137,7 @@ GridComponent<T>::GridComponent()
|
||||||
, mItemScale {1.05f}
|
, mItemScale {1.05f}
|
||||||
, mItemSpacing {0.0f, 0.0f}
|
, mItemSpacing {0.0f, 0.0f}
|
||||||
, mInstantItemTransitions {false}
|
, mInstantItemTransitions {false}
|
||||||
|
, mInstantRowTransitions {false}
|
||||||
, mHorizontalMargin {0.0f}
|
, mHorizontalMargin {0.0f}
|
||||||
, mVerticalMargin {0.0f}
|
, mVerticalMargin {0.0f}
|
||||||
, mUnfocusedItemOpacity {1.0f}
|
, mUnfocusedItemOpacity {1.0f}
|
||||||
|
@ -583,6 +585,22 @@ void GridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elem->has("rowTransitions")) {
|
||||||
|
const std::string& rowTransitions {elem->get<std::string>("rowTransitions")};
|
||||||
|
if (rowTransitions == "animate") {
|
||||||
|
mInstantRowTransitions = false;
|
||||||
|
}
|
||||||
|
else if (rowTransitions == "instant") {
|
||||||
|
mInstantRowTransitions = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mInstantRowTransitions = false;
|
||||||
|
LOG(LogWarning) << "GridComponent: Invalid theme configuration, property "
|
||||||
|
"\"rowTransitions\" for element \""
|
||||||
|
<< element.substr(5) << "\" defined as \"" << rowTransitions << "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If itemSpacing is not defined, then it's automatically calculated so that scaled items
|
// If itemSpacing is not defined, then it's automatically calculated so that scaled items
|
||||||
// don't overlap. If the property is present but one axis is defined as -1 then set this
|
// don't overlap. If the property is present but one axis is defined as -1 then set this
|
||||||
// axis to the same pixel value as the other axis.
|
// axis to the same pixel value as the other axis.
|
||||||
|
@ -716,7 +734,11 @@ template <typename T> void GridComponent<T>::onCursorChanged(const CursorState&
|
||||||
f -= posMax;
|
f -= posMax;
|
||||||
|
|
||||||
mEntryOffset = f;
|
mEntryOffset = f;
|
||||||
mScrollPos = {(endRow * t) + (startRow * (1.0f - t))};
|
|
||||||
|
if (mInstantRowTransitions)
|
||||||
|
mScrollPos = endRow;
|
||||||
|
else
|
||||||
|
mScrollPos = {(endRow * t) + (startRow * (1.0f - t))};
|
||||||
|
|
||||||
if (mInstantItemTransitions) {
|
if (mInstantItemTransitions) {
|
||||||
mTransitionFactor = 1.0f;
|
mTransitionFactor = 1.0f;
|
||||||
|
|
Loading…
Reference in a new issue