mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-18 04:45:39 +00:00
Fixed some erratic camera movement issues during extreme SystemView navigation input.
This commit is contained in:
parent
d31536af4b
commit
24fe15a84f
|
@ -222,7 +222,9 @@ std::vector<HelpPrompt> SystemView::getHelpPrompts()
|
||||||
|
|
||||||
void SystemView::onCursorChanged(const CursorState& state)
|
void SystemView::onCursorChanged(const CursorState& state)
|
||||||
{
|
{
|
||||||
int cursor {mPrimary->getCursor()};
|
const int cursor {mPrimary->getCursor()};
|
||||||
|
const std::string& transitionStyle {Settings::getInstance()->getString("TransitionStyle")};
|
||||||
|
mFadeTransitions = transitionStyle == "fade";
|
||||||
|
|
||||||
// Avoid double updates.
|
// Avoid double updates.
|
||||||
if (cursor != mLastCursor) {
|
if (cursor != mLastCursor) {
|
||||||
|
@ -237,6 +239,33 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
video->stopVideoPlayer();
|
video->stopVideoPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int scrollVelocity {mPrimary->getScrollingVelocity()};
|
||||||
|
|
||||||
|
// This is needed to avoid erratic camera movements during extreme navigation input when using
|
||||||
|
// slide transitions. This should very rarely occur during normal application usage.
|
||||||
|
if (transitionStyle == "slide") {
|
||||||
|
bool resetCamOffset {false};
|
||||||
|
|
||||||
|
if (scrollVelocity == -1 && mPreviousScrollVelocity == 1) {
|
||||||
|
if (mLastCursor > cursor && mCamOffset > static_cast<float>(mLastCursor))
|
||||||
|
resetCamOffset = true;
|
||||||
|
else if (mLastCursor > cursor && mCamOffset < static_cast<float>(cursor))
|
||||||
|
resetCamOffset = true;
|
||||||
|
else if (mLastCursor < cursor && mCamOffset <= static_cast<float>(cursor) &&
|
||||||
|
mCamOffset != static_cast<float>(mLastCursor))
|
||||||
|
resetCamOffset = true;
|
||||||
|
}
|
||||||
|
else if (scrollVelocity == 1 && mPreviousScrollVelocity == -1) {
|
||||||
|
if (mLastCursor > cursor && mCamOffset < static_cast<float>(mLastCursor))
|
||||||
|
resetCamOffset = true;
|
||||||
|
else if (mLastCursor < cursor && mCamOffset > static_cast<float>(cursor))
|
||||||
|
resetCamOffset = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resetCamOffset)
|
||||||
|
mCamOffset = static_cast<float>(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
mLastCursor = cursor;
|
mLastCursor = cursor;
|
||||||
|
|
||||||
for (auto& video : mSystemElements[cursor].videoComponents)
|
for (auto& video : mSystemElements[cursor].videoComponents)
|
||||||
|
@ -252,10 +281,9 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
startViewVideos();
|
startViewVideos();
|
||||||
updateHelpPrompts();
|
updateHelpPrompts();
|
||||||
|
|
||||||
int scrollVelocity {mPrimary->getScrollingVelocity()};
|
const float posMax {static_cast<float>(mPrimary->getNumEntries())};
|
||||||
|
const float target {static_cast<float>(cursor)};
|
||||||
float startPos {mCamOffset};
|
float startPos {mCamOffset};
|
||||||
float posMax {static_cast<float>(mPrimary->getNumEntries())};
|
|
||||||
float target {static_cast<float>(cursor)};
|
|
||||||
float endPos {target};
|
float endPos {target};
|
||||||
|
|
||||||
if (mPreviousScrollVelocity > 0 && scrollVelocity == 0 && mCamOffset > posMax - 1.0f)
|
if (mPreviousScrollVelocity > 0 && scrollVelocity == 0 && mCamOffset > posMax - 1.0f)
|
||||||
|
@ -287,9 +315,6 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
if (scrollVelocity != 0)
|
if (scrollVelocity != 0)
|
||||||
mPreviousScrollVelocity = scrollVelocity;
|
mPreviousScrollVelocity = scrollVelocity;
|
||||||
|
|
||||||
std::string transitionStyle {Settings::getInstance()->getString("TransitionStyle")};
|
|
||||||
mFadeTransitions = transitionStyle == "fade";
|
|
||||||
|
|
||||||
Animation* anim;
|
Animation* anim;
|
||||||
|
|
||||||
float animTime {380.0f};
|
float animTime {380.0f};
|
||||||
|
|
Loading…
Reference in a new issue