]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_SketcherMgr.cpp
Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom into Dev_0.7.1
[modules/shaper.git] / src / PartSet / PartSet_SketcherMgr.cpp
index cce44aaa856d8a3a04c7f7fcfc1849eec8214c32..bd8b15dd374cf64f4a89baa5f06a3df0c1edfb83 100644 (file)
@@ -141,6 +141,9 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
   if (!(theEvent->buttons() & Qt::LeftButton))
     return;
 
+  // Clear dragging mode
+  myIsDragging = false;
+
   ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
   ModuleBase_Operation* aOperation = aWorkshop->currentOperation();
   // Use only for sketch operations
@@ -190,7 +193,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
 
     if (isSketcher) {
       myIsDragging = true;
-
       get2dPoint(theWnd, theEvent, myCurrentPoint);
       myDragDone = false;
       launchEditing();
@@ -214,32 +216,30 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse
 {
   ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
   ModuleBase_Operation* aOp = aWorkshop->currentOperation();
-  if (!aOp)
-    return;
-  if (!sketchOperationIdList().contains(aOp->id()))
-    return;
-
+  if (aOp) {
+    if (sketchOperationIdList().contains(aOp->id())) {
   get2dPoint(theWnd, theEvent, myClickedPoint);
 
-  // Only for sketcher operations
-  ModuleBase_IViewer* aViewer = aWorkshop->viewer();
-  if (myIsDragging) {
-    aWorkshop->viewer()->enableSelection(myPreviousSelectionEnabled);
-    myIsDragging = false;
-    if (myDragDone) {
-      //aOp->commit();
-      myFeature2AttributeMap.clear();
-
-      // Reselect edited object
-      /*aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
-      if (theEvent->modifiers() & Qt::ShiftModifier)
-        aViewer->AISContext()->ShiftSelect();
-      else
-        aViewer->AISContext()->Select();
-        */
-      return;
+      // Only for sketcher operations
+      ModuleBase_IViewer* aViewer = aWorkshop->viewer();
+      if (myIsDragging) {
+        if (myDragDone) {
+          //aOp->commit();
+          myFeature2AttributeMap.clear();
+
+          // Reselect edited object
+          /*aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
+          if (theEvent->modifiers() & Qt::ShiftModifier)
+            aViewer->AISContext()->ShiftSelect();
+          else
+            aViewer->AISContext()->Select();
+            */
+        }
+      }
     }
   }
+  aWorkshop->viewer()->enableSelection(myPreviousSelectionEnabled);
+  myIsDragging = false;
 }
 
 void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
@@ -259,6 +259,8 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve
     aViewer->enableSelection(false);
 
     ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+    if (!aOperation)
+      return;
     if (aOperation->id().toStdString() == SketchPlugin_Sketch::ID())
       return; // No edit operation activated