+ fix issue with rotation enter with panning
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5103 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
c7985e5c06
commit
9158a92e4f
|
@ -247,7 +247,10 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
// is it just a middle click?
|
||||
if (tmp.getValue() < dci && !this->lockrecenter) {
|
||||
panToCenter(panningplane, posn);
|
||||
if (!this->moveToPoint(pos)) {
|
||||
panToCenter(panningplane, posn);
|
||||
this->interactiveCountDec();
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,10 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
// is it just a left click?
|
||||
if (tmp.getValue() < dci && !this->lockrecenter) {
|
||||
panToCenter(panningplane, posn);
|
||||
if (!this->moveToPoint(pos)) {
|
||||
panToCenter(panningplane, posn);
|
||||
this->interactiveCountDec();
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +276,10 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
// is it just a middle click?
|
||||
if (tmp.getValue() < dci && !this->lockrecenter) {
|
||||
panToCenter(panningplane, posn);
|
||||
if (!this->moveToPoint(pos)) {
|
||||
panToCenter(panningplane, posn);
|
||||
this->interactiveCountDec();
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,10 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
// is it just a left click?
|
||||
if (tmp.getValue() < dci && !this->lockrecenter) {
|
||||
panToCenter(panningplane, posn);
|
||||
if (!this->moveToPoint(pos)) {
|
||||
panToCenter(panningplane, posn);
|
||||
this->interactiveCountDec();
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +240,10 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
|||
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
|
||||
// is it just a middle click?
|
||||
if (tmp.getValue() < dci && !this->lockrecenter) {
|
||||
panToCenter(panningplane, posn);
|
||||
if (!this->moveToPoint(pos)) {
|
||||
panToCenter(panningplane, posn);
|
||||
this->interactiveCountDec();
|
||||
}
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,6 +281,32 @@ void NavigationStyle::seekToPoint(const SbVec3f& scenepos)
|
|||
viewer->seekToPoint(scenepos);
|
||||
}
|
||||
|
||||
SbBool NavigationStyle::moveToPoint(const SbVec2s screenpos)
|
||||
{
|
||||
SoCamera* cam = viewer->getCamera();
|
||||
if (cam == 0) return FALSE;
|
||||
|
||||
SoRayPickAction rpaction(viewer->getViewportRegion());
|
||||
rpaction.setPoint(screenpos);
|
||||
rpaction.setRadius(2);
|
||||
rpaction.apply(viewer->getSceneManager()->getSceneGraph());
|
||||
|
||||
SoPickedPoint * picked = rpaction.getPickedPoint();
|
||||
if (!picked) {
|
||||
this->interactiveCountInc();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SbVec3f hitpoint;
|
||||
hitpoint = picked->getPoint();
|
||||
|
||||
SbVec3f direction;
|
||||
cam->orientation.getValue().multVec(SbVec3f(0, 0, -1), direction);
|
||||
cam->focalDistance = viewer->getSeekDistance();
|
||||
cam->position = hitpoint - cam->focalDistance.getValue() * direction;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void NavigationStyle::setCameraOrientation(const SbRotation& rot)
|
||||
{
|
||||
SoCamera* cam = viewer->getCamera();
|
||||
|
|
|
@ -149,6 +149,7 @@ protected:
|
|||
void setSeekMode(SbBool enable);
|
||||
SbBool seekToPoint(const SbVec2s screenpos);
|
||||
void seekToPoint(const SbVec3f& scenepos);
|
||||
SbBool moveToPoint(const SbVec2s screenpos);
|
||||
|
||||
void reorientCamera(SoCamera * camera, const SbRotation & rot);
|
||||
void panCamera(SoCamera * camera,
|
||||
|
|
Loading…
Reference in New Issue
Block a user