Fixed a GridComponent slide transition issue when used in the system view.

Also fixed a general navigation issue.
This commit is contained in:
Leon Styhre 2022-11-25 22:35:35 +01:00
parent 0cd814a4d1
commit dfcf041efc
2 changed files with 20 additions and 13 deletions

View file

@ -318,6 +318,11 @@ void SystemView::onCursorChanged(const CursorState& state)
Animation* anim;
float animTime {380.0f};
if (mGrid != nullptr) {
animTime = 250.0f;
}
else {
float timeDiff {1.0f};
// If startPos is inbetween two positions then reduce the time slightly as the distance will
@ -330,6 +335,7 @@ void SystemView::onCursorChanged(const CursorState& state)
if (timeDiff != 1.0f)
animTime =
glm::clamp(std::fabs(glm::mix(0.0f, animTime, timeDiff * 1.5f)), 200.0f, animTime);
}
if (transitionStyle == "fade") {
float startFade {mFadeOpacity};

View file

@ -348,9 +348,10 @@ template <typename T> bool GridComponent<T>::input(InputConfig* config, Input in
return true;
}
if (config->isMappedLike("down", input)) {
if (mCursor >= (mColumns * mRowCount) - mColumns &&
static_cast<int>(mEntries.size()) - mCursor <= mColumns &&
mEntries.size() % mColumns == 0)
if (mCursor >= (mColumns * mRowCount) - mColumns && size() - mCursor <= mColumns &&
size() % mColumns == 0)
return true;
if (size() < mColumns)
return true;
if (mCancelTransitionsCallback)
mCancelTransitionsCallback();