← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] mousewheelpan + ctrl = zooming

 

Thank you, Wayne, for your response. I'm attached the checked patches.

2017-01-16 20:07 GMT+02:00 Wayne Stambaugh <stambaughw@xxxxxxxxx>:

> You are not being ignored.  I can't speak for all of the lead developers
> but I've been really busy so pretty much everyone has been getting
> ignored by me.  It's not intentional, it's just the reality of my
> current work load.
>
> Patch is giving me an unexpected eof with 3d_viewer-pan_step.patch.
>
> Did you address Bernhard's concern about the behavior of the GAL
> canvases as well as the legacy canvas?  I don't remember seeing anything
> but I may have missed it.
>
> On 1/16/2017 11:29 AM, Константин Барановский wrote:
> > Hello. I'm sorry for disturbing you, but I'm not understand why my
> > messages are ignored. Proposed feature not needed for no one, except me?
> > Or I'm made something wrong? Please, give any comment.
> >
> > 2017-01-06 12:03 GMT+02:00 Константин Барановский
> > <baranovskiykonstantin@xxxxxxxxx <mailto:baranovskiykonstantin@xxxxxxxxx
> >>:
> >
> >     2016-11-23 0:22 GMT+02:00 Maciej Sumiński <maciej.suminski@xxxxxxx
> >     <mailto:maciej.suminski@xxxxxxx>>:
> >
> >         I could not apply the second patch, it gives me "unexpected end
> >         of file
> >         in patch" error. Would you verify the file?
> >
> >
> >      I downloaded both patches and checked them, they looks good for me.
> >     I do not got any problems or errors.
> >
> >
>
diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
index 2688125..c5fb5cf 100644
--- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp
+++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
@@ -443,7 +443,15 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent &event )
         if( event.GetWheelRotation() < 0 )
             delta_move = -delta_move;
 
-    if( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
+    // mousewheel_panning enabled:
+    //      wheel           -> pan;
+    //      wheel + ctrl    -> zooming.
+    // mousewheel_panning disabled:
+    //      wheel + shift   -> vertical scrolling;
+    //      wheel + ctrl    -> horizontal scrolling;
+    //      wheel           -> zooming;
+
+    if( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) && !event.ControlDown() )
     {
         if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL )
             m_settings.CameraGet().Pan( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
@@ -452,12 +460,12 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent &event )
 
         mouseActivity = true;
     }
-    else if( event.ShiftDown() )
+    else if( event.ShiftDown() &&  !m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
     {
         m_settings.CameraGet().Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
         mouseActivity = true;
     }
-    else if( event.ControlDown() )
+    else if( event.ControlDown() && !m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
     {
         m_settings.CameraGet().Pan( SFVEC3F( delta_move, 0.0f, 0.0f ) );
         mouseActivity = true;
diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp
index a705791..72cf624 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -981,15 +981,26 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
 
     if( m_enableMousewheelPan )
     {
-        wxPoint newStart = GetViewStart();
-        if( axis == wxMOUSE_WHEEL_HORIZONTAL )
-            newStart.x += wheelRotation;
+        // MousewheelPAN + Ctrl = zooming
+        if( event.ControlDown() )
+        {
+            if( wheelRotation > 0 )
+                cmd.SetId( ID_POPUP_ZOOM_IN );
+            else if( wheelRotation < 0)
+                cmd.SetId( ID_POPUP_ZOOM_OUT );
+        }
         else
-            newStart.y -= wheelRotation;
-
-        wxPoint center = GetScreenCenterLogicalPosition();
-        GetParent()->SetScrollCenterPosition( center );
-        Scroll( newStart );
+        {
+            wxPoint newStart = GetViewStart();
+            if( axis == wxMOUSE_WHEEL_HORIZONTAL )
+                newStart.x += wheelRotation;
+            else
+                newStart.y -= wheelRotation;
+
+            wxPoint center = GetScreenCenterLogicalPosition();
+            GetParent()->SetScrollCenterPosition( center );
+            Scroll( newStart );
+        }
     }
     else if( wheelRotation > 0 )
     {
diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp
index 845d2af..3f80f62 100644
--- a/common/view/wx_view_controls.cpp
+++ b/common/view/wx_view_controls.cpp
@@ -98,7 +98,16 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
 {
     const double wheelPanSpeed = 0.001;
 
-    if( aEvent.ControlDown() || aEvent.ShiftDown() || m_enableMousewheelPan )
+    // mousewheelpan disabled:
+    //      wheel + ctrl    -> horizontal scrolling;
+    //      wheel + shift   -> vertical scrolling;
+    //      wheel           -> zooming;
+    // mousewheelpan enabled:
+    //      wheel           -> pan;
+    //      wheel + ctrl    -> zooming.
+
+    if( ( !m_enableMousewheelPan && ( aEvent.ControlDown() || aEvent.ShiftDown() ) ) ||
+        ( m_enableMousewheelPan && !aEvent.ControlDown() ) )
     {
         // Scrolling
         VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
index 268812565..bd25e88f4 100644
--- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp
+++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
@@ -438,7 +438,7 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent &event )
     float delta_move = m_delta_move_step_factor * m_settings.CameraGet().ZoomGet();
 
     if( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
-        delta_move *= (0.05f * event.GetWheelRotation());
+        delta_move *= (0.01f * event.GetWheelRotation());
     else
         if( event.GetWheelRotation() < 0 )
             delta_move = -delta_move;

Follow ups

References