mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0032604: Visualization, AIS_LightSource - improve dragging robustness
This commit is contained in:
parent
956d91571c
commit
f9ae10ed21
@ -257,27 +257,29 @@ Standard_Boolean AIS_LightSource::ProcessDragging (const Handle(AIS_InteractiveC
|
||||
{
|
||||
case AIS_DragAction_Start:
|
||||
{
|
||||
myStartTransform = theDragFrom;
|
||||
myLocTrsfStart = LocalTransformation();
|
||||
return Standard_True;
|
||||
}
|
||||
case AIS_DragAction_Update:
|
||||
{
|
||||
theCtx->MainSelector()->Pick (myStartTransform.x(), myStartTransform.y(), theView);
|
||||
mySensSphere->ResetLastDetectedPoint();
|
||||
SetLocalTransformation (myLocTrsfStart);
|
||||
theCtx->MainSelector()->Pick (theDragFrom.x(), theDragFrom.y(), theView);
|
||||
gp_Pnt aStartPosition = mySensSphere->LastDetectedPoint();
|
||||
|
||||
mySensSphere->ResetLastDetectedPoint();
|
||||
theCtx->MainSelector()->Pick (theDragTo.x(), theDragTo.y(), theView);
|
||||
gp_Pnt aCurrPosition = mySensSphere->LastDetectedPoint();
|
||||
if (aCurrPosition.X() != RealLast() && aStartPosition.Distance (aCurrPosition) > Precision::Confusion())
|
||||
if (aCurrPosition.X() != RealLast()
|
||||
&& aStartPosition.Distance (aCurrPosition) > Precision::Confusion())
|
||||
{
|
||||
gp_Quaternion aQRot;
|
||||
aQRot.SetRotation (gp_Vec (gp_Pnt (0, 0, 0), aStartPosition), gp_Vec (gp_Pnt (0, 0, 0), aCurrPosition));
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetRotation (aQRot);
|
||||
SetLocalTransformation (myLocTrsfStart * aTrsf);
|
||||
myLocTrsfStart = LocalTransformation();
|
||||
myStartTransform = theDragTo;
|
||||
theOwner->Selectable()->ClearDynamicHighlight (theCtx->MainPrsMgr());
|
||||
theCtx->HilightWithColor (this, Handle(Prs3d_Drawer)(), false);
|
||||
const Standard_Integer aHiMod = HasHilightMode() ? HilightMode() : 0;
|
||||
theOwner->UpdateHighlightTrsf (theCtx->CurrentViewer(), theCtx->MainPrsMgr(), aHiMod);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@ -475,7 +477,7 @@ void AIS_LightSource::updateLightLocalTransformation()
|
||||
// =======================================================================
|
||||
void AIS_LightSource::setLocalTransformation (const Handle(TopLoc_Datum3D)& theTrsf)
|
||||
{
|
||||
const gp_Trsf aTrsf = theTrsf->Transformation();
|
||||
const gp_Trsf aTrsf = !theTrsf.IsNull() ? theTrsf->Transformation() : gp_Trsf();
|
||||
switch (myLightSource->Type())
|
||||
{
|
||||
case Graphic3d_TypeOfLightSource_Ambient:
|
||||
|
@ -259,7 +259,6 @@ protected:
|
||||
Aspect_TypeOfMarker myCodirMarkerType; //!< icon of arrow co-directional to camera direction (look from)
|
||||
Aspect_TypeOfMarker myOpposMarkerType; //!< icon of arrow opposite to camera direction (look at)
|
||||
|
||||
Graphic3d_Vec2i myStartTransform; //!< position of starting transformation
|
||||
gp_Trsf myLocTrsfStart; //!< object transformation before transformation
|
||||
Standard_Real mySize; //!< presentation size
|
||||
Standard_Integer myNbArrows; //!< number of directional light arrows
|
||||
|
@ -58,6 +58,12 @@ public:
|
||||
//! Returns the position of detected point on the sphere.
|
||||
const gp_Pnt& LastDetectedPoint() const { return myLastDetectedPoint; }
|
||||
|
||||
//! Invalidate the position of detected point on the sphere.
|
||||
void ResetLastDetectedPoint()
|
||||
{
|
||||
myLastDetectedPoint = gp_Pnt (RealLast(), RealLast(), RealLast());
|
||||
}
|
||||
|
||||
protected:
|
||||
gp_Pnt myCenter;
|
||||
gp_Pnt myLastDetectedPoint;
|
||||
|
Loading…
x
Reference in New Issue
Block a user