From 7b5d75a02129dfa236a8c5e1838980cae245b873 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 15 Mar 2017 16:08:38 +0300 Subject: [PATCH] Fix for constraint selection problem --- src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 729d13be5..8f77dbb15 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -51,9 +51,9 @@ class SketcherPrs_SymbolArray: public OpenGl_PrimitiveArray { public: SketcherPrs_SymbolArray(const OpenGl_GraphicDriver* theDriver, - const Handle(SketcherPrs_SymbolPrs)& theObj) + const Handle(SketcherPrs_SymbolPrs)& theObj, const Handle(AIS_InteractiveContext)& theCtx) :OpenGl_PrimitiveArray(theDriver, theObj->myPntArray->Type(), theObj->myPntArray->Indices(), - theObj->myPntArray->Attributes(), theObj->myPntArray->Bounds()), myObj(theObj) {} + theObj->myPntArray->Attributes(), theObj->myPntArray->Bounds()), myObj(theObj), myContext(theCtx) {} virtual void Render(const Handle(OpenGl_Workspace)& theWorkspace) const { @@ -78,10 +78,18 @@ public: } } OpenGl_PrimitiveArray::Render(theWorkspace); + + // Update selection position only if there is no selected object + // because it can corrupt selection of other objects + if ((myContext->NbCurrents() == 0) && (myContext->NbSelected() == 0)) { + myContext->MainSelector()->RebuildSensitivesTree(myObj); + myContext->MainSelector()->RebuildObjectsTree (false); + } } private: Handle(SketcherPrs_SymbolPrs) myObj; + Handle(AIS_InteractiveContext) myContext; }; @@ -259,7 +267,7 @@ void SketcherPrs_SymbolPrs::Compute( // Pint the group with custom procedure (see Render) SketcherPrs_SymbolArray* aElem = - new SketcherPrs_SymbolArray((OpenGl_GraphicDriver*)aDriver->This(), this); + new SketcherPrs_SymbolArray((OpenGl_GraphicDriver*)aDriver->This(), this, GetContext()); aGroup->AddElement(aElem); // Disable frustum culling for this object by marking it as mutable -- 2.39.2