diff --git a/src/AIS/AIS_LightSource.cxx b/src/AIS/AIS_LightSource.cxx index c48e80528f..91ae697643 100644 --- a/src/AIS/AIS_LightSource.cxx +++ b/src/AIS/AIS_LightSource.cxx @@ -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: diff --git a/src/AIS/AIS_LightSource.hxx b/src/AIS/AIS_LightSource.hxx index 0e6dbc6bfa..c2da38840c 100644 --- a/src/AIS/AIS_LightSource.hxx +++ b/src/AIS/AIS_LightSource.hxx @@ -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 diff --git a/src/Select3D/Select3D_SensitiveSphere.hxx b/src/Select3D/Select3D_SensitiveSphere.hxx index 3202401b3c..765d6276e1 100644 --- a/src/Select3D/Select3D_SensitiveSphere.hxx +++ b/src/Select3D/Select3D_SensitiveSphere.hxx @@ -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;