Add a sensitivity value to improve issue #0000772
This commit is contained in:
@@ -54,10 +54,12 @@ struct NavigationStyleP {
|
||||
SbVec3f focal1, focal2;
|
||||
SbRotation endRotation;
|
||||
SoTimerSensor * animsensor;
|
||||
float sensitivity;
|
||||
|
||||
NavigationStyleP()
|
||||
{
|
||||
this->animationsteps = 0;
|
||||
this->sensitivity = 2.0f;
|
||||
}
|
||||
static void viewAnimationCB(void * data, SoSensor * sensor);
|
||||
};
|
||||
@@ -780,6 +782,14 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
|
||||
this->spinprojector->project(lastpos);
|
||||
SbRotation r;
|
||||
this->spinprojector->projectAndGetRotation(pointerpos, r);
|
||||
float sensitivity = getSensitivity();
|
||||
if (sensitivity > 1.0f) {
|
||||
SbVec3f axis;
|
||||
float radians;
|
||||
r.getValue(axis, radians);
|
||||
radians = sensitivity * radians;
|
||||
r.setValue(axis, radians);
|
||||
}
|
||||
r.invert();
|
||||
this->reorientCamera(viewer->getCamera(), r);
|
||||
|
||||
@@ -923,6 +933,16 @@ void NavigationStyle::stopAnimating(void)
|
||||
NavigationStyle::IDLE : NavigationStyle::INTERACT);
|
||||
}
|
||||
|
||||
void NavigationStyle::setSensitivity(float val)
|
||||
{
|
||||
PRIVATE(this)->sensitivity = val;
|
||||
}
|
||||
|
||||
float NavigationStyle::getSensitivity() const
|
||||
{
|
||||
return PRIVATE(this)->sensitivity;
|
||||
}
|
||||
|
||||
void NavigationStyle::setZoomInverted(SbBool on)
|
||||
{
|
||||
this->invertZoom = on;
|
||||
|
||||
@@ -110,6 +110,9 @@ public:
|
||||
void stopAnimating(void);
|
||||
SbBool isAnimating(void) const;
|
||||
|
||||
void setSensitivity(float);
|
||||
float getSensitivity() const;
|
||||
|
||||
void setZoomInverted(SbBool);
|
||||
SbBool isZoomInverted() const;
|
||||
void setZoomStep(float);
|
||||
|
||||
@@ -140,6 +140,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::W
|
||||
OnChange(*hGrp,"BacklightIntensity");
|
||||
OnChange(*hGrp,"NavigationStyle");
|
||||
OnChange(*hGrp,"OrbitStyle");
|
||||
OnChange(*hGrp,"Sensitivity");
|
||||
|
||||
stopSpinTimer = new QTimer(this);
|
||||
connect(stopSpinTimer, SIGNAL(timeout()), this, SLOT(stopAnimating()));
|
||||
@@ -274,6 +275,10 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
|
||||
int style = rGrp.GetInt("OrbitStyle",1);
|
||||
_viewer->navigationStyle()->setOrbitStyle(NavigationStyle::OrbitStyle(style));
|
||||
}
|
||||
else if (strcmp(Reason,"Sensitivity") == 0) {
|
||||
float val = rGrp.GetFloat("Sensitivity",2.0f);
|
||||
_viewer->navigationStyle()->setSensitivity(val);
|
||||
}
|
||||
else if (strcmp(Reason,"InvertZoom") == 0) {
|
||||
bool on = rGrp.GetBool("InvertZoom", false);
|
||||
_viewer->navigationStyle()->setZoomInverted(on);
|
||||
|
||||
Reference in New Issue
Block a user