]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
refs #1324: implementation of the "chained operations" for panning
authorasl <asl@opencascade.com>
Fri, 22 Sep 2017 07:23:18 +0000 (10:23 +0300)
committerasl <asl@opencascade.com>
Fri, 22 Sep 2017 07:23:18 +0000 (10:23 +0300)
src/OCCViewer/OCCViewer_ViewManager.cxx
src/OCCViewer/OCCViewer_ViewManager.h
src/OCCViewer/OCCViewer_ViewWindow.cxx

index c1f2b4d5032af4a3b404de1a3be66828fcc2cc37..4e3b9d6b86ae8006ba745165e3f6a35dc4d77c34 100755 (executable)
@@ -28,7 +28,8 @@
   Constructor
 */
 OCCViewer_ViewManager::OCCViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop, bool DisplayTrihedron )
-: SUIT_ViewManager( study, theDesktop, new OCCViewer_Viewer( DisplayTrihedron ) )
+: SUIT_ViewManager( study, theDesktop, new OCCViewer_Viewer( DisplayTrihedron ) ),
+  myIsChainedOperations( false )
 {  
   setTitle( tr( "OCC_VIEW_TITLE" ) );
 }
@@ -50,3 +51,13 @@ void OCCViewer_ViewManager::contextMenuPopup( QMenu* popup )
   // if it is necessary invoke method CreatePopup of ViewPort
   // be sure that existing QPopupMenu menu is used for that.
 }
+
+bool OCCViewer_ViewManager::isChainedOperations() const
+{
+  return myIsChainedOperations;
+}
+
+void OCCViewer_ViewManager::setChainedOperations( bool isChainedOperations )
+{
+  myIsChainedOperations = isChainedOperations;
+}
index c29474ebfcd24436f76bfd717c900747978a59a1..e4ac7c119d71d7b6fea4222f6ef6e40f45bd6578 100755 (executable)
@@ -40,6 +40,12 @@ public:
   OCCViewer_Viewer* getOCCViewer() { return (OCCViewer_Viewer*) myViewModel; }
 
   virtual void      contextMenuPopup( QMenu* );
+
+  bool isChainedOperations() const;
+  void setChainedOperations( bool );
+
+private:
+  bool myIsChainedOperations;
 };
 
 #endif
index a4bce4220b4e3d0040794c9f2ae7b8446b4b8331..45a9f37c01ba6474a32b5d1db62bd31269a7b9a9 100644 (file)
@@ -1069,8 +1069,14 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
 #if OCC_VERSION_LARGE <= 0x07000000
     myViewPort->getView()->ZFitAll();
 #endif
-    resetState();
-    break;
+    {
+      OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( getViewManager() );
+      bool isChained = aMgr->isChainedOperations();
+      bool isReset = !( myOperation==PANVIEW && isChained ) || theEvent->button() == Qt::RightButton;
+      if( isReset )
+        resetState();
+      break;
+    }
 
   case PANGLOBAL:
     if ( theEvent->button() == Qt::LeftButton ) {