]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3092: Do not relaunch editing on multi-selection if editing feature is still...
authorvsv <vsv@opencascade.com>
Mon, 2 Dec 2019 09:20:59 +0000 (12:20 +0300)
committervsv <vsv@opencascade.com>
Mon, 2 Dec 2019 09:20:59 +0000 (12:20 +0300)
src/PartSet/PartSet_SketcherMgr.cpp

index 695d8a0fef5f4a6ae3c1d2a8dc5eb6132d7ca001..bd4c35fae988df2c1cceee69b11d42889015f27b 100644 (file)
@@ -414,7 +414,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
     }
     // Init flyout point for radius rotation
     FeaturePtr aFeature = myCurrentSelection.begin().key();
-
     get2dPoint(theWnd, theEvent, myCurrentPoint);
     if (isSketcher) {
       if (aCanDrag) {
@@ -444,14 +443,33 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
       /// Internal edit should not be stored as editing operation as the result will be a
       /// creation operation, where previous selection should not be used(and will be cleared)
       myIsEditLaunching = !myModule->sketchReentranceMgr()->isInternalEditActive();
-      aFOperation->commit();
+
+      std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+        std::dynamic_pointer_cast<SketchPlugin_Feature>(aFOperation->feature());
+      bool isRelaunchEditing = true;
+      if (aSPFeature->isExternal()) {
+        foreach(FeaturePtr aF, myCurrentSelection.keys()) {
+          FeaturePtr aProducerFeature = PartSet_Tools::findRefsToMeFeature(aF,
+            aSPFeature->getKind());
+          if (aProducerFeature == aSPFeature) {
+            isRelaunchEditing = false;
+            break;
+          }
+        }
+      }
+      else
+        isRelaunchEditing = !myCurrentSelection.contains(aSPFeature);
+
+      if (isRelaunchEditing)
+        aFOperation->commit();
 
       if (aCanDrag) {
         myIsDragging = true;
         myDragDone = false;
       }
       myPreviousDrawModeEnabled = aViewer->enableDrawMode(false);
-      launchEditing();
+      if (isRelaunchEditing)
+        launchEditing();
       myIsEditLaunching = aPrevLaunchingState;
       if (aFeature.get() != NULL) {
         std::shared_ptr<SketchPlugin_Feature> aSPFeature =