Gui: Apply Law of Demeter to starting and stopping animations
This commit is contained in:
@@ -1067,9 +1067,19 @@ SbBool NavigationStyle::isAnimating() const
|
||||
return this->currentmode == NavigationStyle::SPINNING;
|
||||
}
|
||||
|
||||
NavigationAnimator* NavigationStyle::getAnimator() const
|
||||
void NavigationStyle::startAnimating(const std::shared_ptr<NavigationAnimation>& animation, bool wait) const
|
||||
{
|
||||
return this->animator;
|
||||
if (wait) {
|
||||
animator->startAndWait(animation);
|
||||
}
|
||||
else {
|
||||
animator->start(animation);
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationStyle::stopAnimating() const
|
||||
{
|
||||
animator->stop();
|
||||
}
|
||||
|
||||
void NavigationStyle::setSensitivity(float val)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <Base/BaseClass.h>
|
||||
#include <Gui/Namespace.h>
|
||||
#include <FCGlobal.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
// forward declarations
|
||||
class SoEvent;
|
||||
@@ -54,6 +54,7 @@ namespace Gui {
|
||||
class View3DInventorViewer;
|
||||
class NavigationAnimator;
|
||||
class AbstractMouseSelection;
|
||||
class NavigationAnimation;
|
||||
|
||||
/**
|
||||
* @author Werner Mayer
|
||||
@@ -124,7 +125,8 @@ public:
|
||||
SbBool isAnimationEnabled() const;
|
||||
|
||||
SbBool isAnimating() const;
|
||||
NavigationAnimator* getAnimator() const;
|
||||
void startAnimating(const std::shared_ptr<NavigationAnimation>& animation, bool wait = false) const;
|
||||
void stopAnimating() const;
|
||||
|
||||
void setSensitivity(float);
|
||||
float getSensitivity() const;
|
||||
|
||||
@@ -3110,12 +3110,7 @@ void View3DInventorViewer::startAnimation(const SbRotation& orientation,
|
||||
auto animation = std::make_shared<FixedTimeAnimation>(
|
||||
navigation, orientation, rotationCenter, translation, duration);
|
||||
|
||||
if (wait) {
|
||||
navigation->getAnimator()->startAndWait(animation);
|
||||
}
|
||||
else {
|
||||
navigation->getAnimator()->start(animation);
|
||||
}
|
||||
navigation->startAnimating(animation, wait);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3127,12 +3122,12 @@ void View3DInventorViewer::startAnimation(const SbRotation& orientation,
|
||||
void View3DInventorViewer::startSpinningAnimation(const SbVec3f& axis, float velocity)
|
||||
{
|
||||
auto animation = std::make_shared<SpinningAnimation>(navigation, axis, velocity);
|
||||
navigation->getAnimator()->start(animation);
|
||||
navigation->startAnimating(animation);
|
||||
}
|
||||
|
||||
void View3DInventorViewer::stopAnimating()
|
||||
{
|
||||
navigation->getAnimator()->stop();
|
||||
navigation->stopAnimating();
|
||||
}
|
||||
|
||||
void View3DInventorViewer::setPopupMenuEnabled(const SbBool on)
|
||||
|
||||
Reference in New Issue
Block a user