mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-01 17:36:21 +03:00
Fix: don't move grid during panning
This commit is contained in:
parent
032a3aa3e4
commit
f891937306
@ -1510,6 +1510,10 @@ void AIS_ViewController::handlePanning (const Handle(V3d_View)& theView)
|
||||
AbortViewAnimation();
|
||||
|
||||
const Handle(Graphic3d_Camera)& aCam = theView->Camera();
|
||||
aCam->SetPanningVector(aCam->PanningVector() +
|
||||
gp_Vec2d(theView->Convert(myGL.Panning.Delta.x()),
|
||||
theView->Convert(myGL.Panning.Delta.y())));
|
||||
|
||||
if (aCam->IsOrthographic()
|
||||
|| !hasPanningAnchorPoint())
|
||||
{
|
||||
|
@ -289,6 +289,17 @@ public:
|
||||
myRotationPoint = theRotationPoint;
|
||||
};
|
||||
|
||||
//! Get panning translation.
|
||||
//! @return the panning translation.
|
||||
gp_Vec2d PanningVector() const { return myPanningVector; }
|
||||
|
||||
//! Sets panning translation.
|
||||
//! @param thePanningVector [in] the panning translation.
|
||||
void SetPanningVector(const gp_Vec2d &thePanningVector)
|
||||
{
|
||||
myPanningVector = thePanningVector;
|
||||
};
|
||||
|
||||
//! Get distance of Eye from camera Center.
|
||||
//! @return the distance.
|
||||
Standard_Real Distance() const { return myDistance; }
|
||||
@ -854,6 +865,7 @@ private:
|
||||
gp_Dir myDirection;//!< Camera view direction (from eye)
|
||||
gp_Pnt myEye; //!< Camera eye position
|
||||
gp_Pnt myRotationPoint;
|
||||
gp_Vec2d myPanningVector;
|
||||
Standard_Real myDistance; //!< distance from Eye to Center
|
||||
|
||||
gp_XYZ myAxialScale; //!< World axial scale.
|
||||
|
@ -2599,6 +2599,9 @@ void OpenGl_View::renderGrid()
|
||||
aTranslationInv.SetColumn (3, -aRotationVec);
|
||||
OpenGl_Mat4 aWorldViewStateCorrected = aTranslationInv * aWorldViewCurrent * aTranslation;
|
||||
aPosition.ChangeCoord() += gp_XYZ (aWorldViewStateCorrected (0, 3), aWorldViewStateCorrected (1, 3), -aZFar);
|
||||
|
||||
gp_XYZ aPanningVector (aCamera->PanningVector().X(), aCamera->PanningVector().Y(), 0.0);
|
||||
aPosition.ChangeCoord() -= aPanningVector;
|
||||
}
|
||||
OpenGl_Mat4 aTranslation;
|
||||
aTranslation.SetColumn (3, Graphic3d_Vec4 ((float)aPosition.X(), (float)aPosition.Y(), (float)aPosition.Z(), 1.0));
|
||||
|
Loading…
x
Reference in New Issue
Block a user