]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for constraint selection problem
authorvsv <vsv@opencascade.com>
Wed, 15 Mar 2017 13:08:38 +0000 (16:08 +0300)
committervsv <vsv@opencascade.com>
Wed, 15 Mar 2017 13:08:52 +0000 (16:08 +0300)
src/SketcherPrs/SketcherPrs_SymbolPrs.cpp

index 729d13be56d0c8b9b3d5014566e222725d5a92c9..8f77dbb156e7ad51857b9c0d50b4cff8f41fd846 100644 (file)
@@ -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