diff --git a/common/view/view_controls.cpp b/common/view/view_controls.cpp index eedfd766eb..46be594694 100644 --- a/common/view/view_controls.cpp +++ b/common/view/view_controls.cpp @@ -66,6 +66,8 @@ void VC_SETTINGS::Reset() m_autoPanSpeed = 0.15; m_warpCursor = false; m_enableMousewheelPan = false; + m_panWithRightButton = false; + m_panWithLeftButton = false; } diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 0e55104579..e8d67ca1f6 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -55,6 +55,10 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this ); m_parentPanel->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this ); + m_parentPanel->Connect( wxEVT_RIGHT_UP, + wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this ); + m_parentPanel->Connect( wxEVT_RIGHT_DOWN, + wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this ); #if defined _WIN32 || defined _WIN64 m_parentPanel->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( WX_VIEW_CONTROLS::onEnter ), NULL, this ); @@ -223,7 +227,9 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent ) { case IDLE: case AUTO_PANNING: - if( aEvent.MiddleDown() ) + if( aEvent.MiddleDown() || + ( aEvent.LeftDown() && m_settings.m_panWithLeftButton ) || + ( aEvent.RightDown() && m_settings.m_panWithRightButton ) ) { m_dragStartPoint = VECTOR2D( aEvent.GetX(), aEvent.GetY() ); m_lookStartPoint = m_view->GetCenter(); @@ -236,7 +242,7 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent ) break; case DRAG_PANNING: - if( aEvent.MiddleUp() ) + if( aEvent.MiddleUp() || aEvent.LeftUp() || aEvent.RightUp() ) m_state = IDLE; break; diff --git a/include/view/view_controls.h b/include/view/view_controls.h index acc2df3952..bc01d0f315 100644 --- a/include/view/view_controls.h +++ b/include/view/view_controls.h @@ -83,6 +83,12 @@ struct VC_SETTINGS ///> Mousewheel (2-finger touchpad) panning bool m_enableMousewheelPan; + + ///> Allow panning with the right button in addition to middle + bool m_panWithRightButton; + + ///> Allow panning with the left button in addition to middle + bool m_panWithLeftButton; }; @@ -309,6 +315,12 @@ public: */ virtual void CenterOnCursor() const = 0; + void SetAdditionalPanButtons( bool aLeft = false, bool aRight = false ) + { + m_settings.m_panWithLeftButton = aLeft; + m_settings.m_panWithRightButton = aRight; + } + /** * Function Reset() * Restores the default VIEW_CONTROLS settings.