forked from organicmaps/organicmaps
Fixed recovering of follow-and-rotate mode in routing
This commit is contained in:
parent
910edd581d
commit
9917832e07
4 changed files with 20 additions and 5 deletions
|
@ -991,7 +991,13 @@ void AnimationSystem::CombineAnimation(drape_ptr<Animation> animation)
|
|||
for (auto it = lst.begin(); it != lst.end();)
|
||||
{
|
||||
auto & anim = *it;
|
||||
if (!anim->CouldBeBlendedWith(*animation))
|
||||
if (anim->GetInterruptedOnCombine())
|
||||
{
|
||||
anim->Interrupt();
|
||||
SaveAnimationResult(*anim);
|
||||
it = lst.erase(it);
|
||||
}
|
||||
else if (!anim->CouldBeBlendedWith(*animation))
|
||||
{
|
||||
if (!anim->CouldBeInterrupted())
|
||||
{
|
||||
|
@ -1014,6 +1020,7 @@ void AnimationSystem::CombineAnimation(drape_ptr<Animation> animation)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PushAnimation(move(animation));
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ public:
|
|||
Animation(bool couldBeInterrupted, bool couldBeBlended)
|
||||
: m_couldBeInterrupted(couldBeInterrupted)
|
||||
, m_couldBeBlended(couldBeBlended)
|
||||
, m_interruptedOnCombine(false)
|
||||
{}
|
||||
|
||||
virtual void OnStart() { if (m_onStartAction != nullptr) m_onStartAction(this); }
|
||||
|
@ -136,12 +137,20 @@ public:
|
|||
bool CouldBeInterrupted() const { return m_couldBeInterrupted; }
|
||||
bool CouldBeBlendedWith(Animation const & animation) const;
|
||||
|
||||
void SetInterruptedOnCombine(bool enable) { m_interruptedOnCombine = enable; }
|
||||
bool GetInterruptedOnCombine() const { return m_interruptedOnCombine; }
|
||||
|
||||
protected:
|
||||
TAction m_onStartAction;
|
||||
TAction m_onFinishAction;
|
||||
TAction m_onInterruptAction;
|
||||
|
||||
// Animation could be interrupted in case of blending impossibility.
|
||||
bool m_couldBeInterrupted;
|
||||
// Animation could be blended with other animations.
|
||||
bool m_couldBeBlended;
|
||||
// Animation must be interrupted in case of combining another animation.
|
||||
bool m_interruptedOnCombine;
|
||||
};
|
||||
|
||||
class Interpolator
|
||||
|
|
|
@ -37,6 +37,8 @@ public:
|
|||
, m_duration(duration)
|
||||
, m_elapsedTime(0.0)
|
||||
{
|
||||
SetInterruptedOnCombine(true);
|
||||
|
||||
m_objects.insert(Animation::MapPlane);
|
||||
m_properties.insert(Animation::Position);
|
||||
}
|
||||
|
|
|
@ -644,10 +644,7 @@ void MyPositionController::DeactivateRouting()
|
|||
m_isInRouting = false;
|
||||
|
||||
ChangeMode(location::Follow);
|
||||
if (m_mode == location::FollowAndRotate)
|
||||
ChangeModelView(m_position, 0.0, m_centerPixelPosition, kDoNotChangeZoom);
|
||||
else
|
||||
ChangeModelView(0.0);
|
||||
ChangeModelView(m_position, 0.0, m_centerPixelPosition, kDoNotChangeZoom);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue