Why do you need to add that to the pcbnew opengl canvas? I can already pan with the ctrl and shift modifiers on linux.
2015-11-01 11:54 GMT+01:00 Yauhen Kharuzhy <[email protected]>: > Add handling of horizontal mouse wheel scrolling to new GL pcbnew canvas > and to 3d-viewer like eeschema has (left-right panning with Shift key down). > > Horizontal scrolling events are usual case for touchpads and TrackPoint > devices. > > Signed-off-by: Yauhen Kharuzhy <[email protected]> > --- > 3d-viewer/3d_canvas.cpp | 6 ++++-- > common/view/wx_view_controls.cpp | 26 ++++++++++++++++++++++++-- > 2 files changed, 28 insertions(+), 4 deletions(-) > > diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp > index 24d022a..c8d7e84 100644 > --- a/3d-viewer/3d_canvas.cpp > +++ b/3d-viewer/3d_canvas.cpp > @@ -285,12 +285,14 @@ void EDA_3D_CANVAS::SetView3D( int keycode ) > > void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event ) > { > + int axis = event.GetWheelAxis(); > + > if( event.ShiftDown() ) > { > if( event.GetWheelRotation() < 0 ) > - SetView3D( WXK_UP ); // move up > + SetView3D( (axis == wxMOUSE_WHEEL_VERTICAL) ? WXK_UP : WXK_RIGHT > ); > else > - SetView3D( WXK_DOWN ); // move down > + SetView3D( (axis == wxMOUSE_WHEEL_VERTICAL) ? WXK_DOWN : > WXK_LEFT ); > } > else if( event.ControlDown() ) > { > diff --git a/common/view/wx_view_controls.cpp > b/common/view/wx_view_controls.cpp > index 3484a15..b745d1b 100644 > --- a/common/view/wx_view_controls.cpp > +++ b/common/view/wx_view_controls.cpp > @@ -102,14 +102,36 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent ) > VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), > false ) * > ( (double) aEvent.GetWheelRotation() * > wheelPanSpeed ); > double scrollSpeed; > + double deltaX = 0.0, deltaY = 0.0; > > if( std::abs( scrollVec.x ) > std::abs( scrollVec.y ) ) > scrollSpeed = scrollVec.x; > else > scrollSpeed = scrollVec.y; > > - VECTOR2D delta( aEvent.ControlDown() ? -scrollSpeed : 0.0, > - aEvent.ShiftDown() ? -scrollSpeed : 0.0 ); > + int axis = aEvent.GetWheelAxis(); > + > + switch( axis ) > + { > + case wxMOUSE_WHEEL_VERTICAL: > + if( aEvent.ControlDown() ) > + { > + deltaX = -scrollSpeed; > + deltaY = 0.0; > + } > + else > + { > + deltaY = -scrollSpeed; > + deltaX = 0; > + } > + break; > + case wxMOUSE_WHEEL_HORIZONTAL: > + deltaX = scrollSpeed; > + deltaY = 0.0; > + break; > + } > + > + VECTOR2D delta( deltaX, deltaY ); > > m_view->SetCenter( m_view->GetCenter() + delta ); > } > -- > 2.5.3 > > > _______________________________________________ > Mailing list: https://launchpad.net/~kicad-developers > Post to : [email protected] > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

