← Back to team overview

kicad-developers team mailing list archive

[PATCH] mousewheelpan + ctrl = zooming

 

That patch allows to use mouse wheel + ctrl for zooming, when option "Use
touchpad to pan" is enabled.
diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp
index a705791..f4970d8 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -981,15 +981,25 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
 
     if( m_enableMousewheelPan )
     {
-        wxPoint newStart = GetViewStart();
-        if( axis == wxMOUSE_WHEEL_HORIZONTAL )
-            newStart.x += wheelRotation;
+        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 )
     {

Follow ups