From 886291938d88c75999825d679283c1f04edcde24 Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 22 Sep 2017 10:23:18 +0300 Subject: [PATCH] refs #1324: implementation of the "chained operations" for panning --- src/OCCViewer/OCCViewer_ViewManager.cxx | 13 ++++++++++++- src/OCCViewer/OCCViewer_ViewManager.h | 6 ++++++ src/OCCViewer/OCCViewer_ViewWindow.cxx | 10 ++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewManager.cxx b/src/OCCViewer/OCCViewer_ViewManager.cxx index c1f2b4d50..4e3b9d6b8 100755 --- a/src/OCCViewer/OCCViewer_ViewManager.cxx +++ b/src/OCCViewer/OCCViewer_ViewManager.cxx @@ -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; +} diff --git a/src/OCCViewer/OCCViewer_ViewManager.h b/src/OCCViewer/OCCViewer_ViewManager.h index c29474ebf..e4ac7c119 100755 --- a/src/OCCViewer/OCCViewer_ViewManager.h +++ b/src/OCCViewer/OCCViewer_ViewManager.h @@ -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 diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index a4bce4220..45a9f37c0 100644 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -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( 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 ) { -- 2.39.2