← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] mousewheelpan + ctrl = zooming

 

In attachment placed new patch, that contains both previous patches and in
mousewheelpan mode, with pressed Shift key, does horizontal scrolling.

So, in common, we will get:

* mousewheelpan disabled:
- mousewheel = zooming;
- mousewheel + ctrl = horizontal scrolling;
- mousewheel + shift = vertical scrolling;

* mousewheelpan enabled:
- touchpad two finger scrolling = pan;
- mousewheel = vertical scrolling;
-> mousewheel (touchpad two finger scrolling) + ctrl = zooming;
-> mousewheel (touchpad two finger scrolling)  + shift = horizontal
scrolling.

This patch adds two last options and decreases the pan step in 3d-viewer to
be more comfortable.
It works in eeschema, pcbnew (legacy, openGL, cairo), 3d-viewer, gerbview.

2017-01-17 11:27 GMT+02:00 Maciej Sumiński <maciej.suminski@xxxxxxx>:

> Hi Konstantin,
>
> Your patches were not ignored, the problem was neither me nor Wayne
> could fully apply the patches in their original version. Thank you for
> correcting this.
>
> I still hold my previous remark about wheel scroll and shift+wheel
> scroll doing the same thing when touchpad panning is enabled. Instead,
> shift+wheel scroll could perform horizontal scrolling in touchpad
> panning mode.
>
> Regards,
> Orson
>
> On 01/16/2017 07:38 PM, Константин Барановский wrote:
> > 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@
> gmail.com
> >>>> :
> >>>
> >>>     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.
> >>>
> >>>
> >>
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> >
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
>
From 028e2790af92389d8449765d0ff95fc0ce498c3b Mon Sep 17 00:00:00 2001
From: Baranovskiy Konstantin <baranovskiykonstantin@xxxxxxxxx>
Date: Tue, 17 Jan 2017 17:36:31 +0200
Subject: [PATCH] Improved MousewheelPAN mode.

---
 3d-viewer/3d_canvas/eda_3d_canvas.cpp | 19 +++++++++++++-----
 common/draw_panel.cpp                 | 36 +++++++++++++++++++++++++++--------
 common/view/wx_view_controls.cpp      | 14 ++++++++++++--
 3 files changed, 54 insertions(+), 15 deletions(-)

diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
index 8fa4e083d..212f951bd 100644
--- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp
+++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp
@@ -439,26 +439,35 @@ 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;
 
-    if( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
+    // mousewheel_panning enabled:
+    //      wheel           -> pan;
+    //      wheel + shift   -> horizontal scrolling;
+    //      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 )
+        if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL || event.ShiftDown() )
             m_settings.CameraGet().Pan( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
         else
             m_settings.CameraGet().Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
 
         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 a70579105..d32446406 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -981,15 +981,35 @@ 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() && !event.ShiftDown() )
+        {
+            if( wheelRotation > 0 )
+                cmd.SetId( ID_POPUP_ZOOM_IN );
+            else if( wheelRotation < 0)
+                cmd.SetId( ID_POPUP_ZOOM_OUT );
+        }
+        // MousewheelPAN + Shift = horizontal scrolling
+        else if( event.ShiftDown() && !event.ControlDown() )
+        {
+            if( wheelRotation > 0 )
+                cmd.SetId( ID_PAN_LEFT );
+            else if( wheelRotation < 0)
+                cmd.SetId( ID_PAN_RIGHT );
+        }
+        // Without modifiers MousewheelPAN - just pan
         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 845d2af62..1f390fd00 100644
--- a/common/view/wx_view_controls.cpp
+++ b/common/view/wx_view_controls.cpp
@@ -98,7 +98,17 @@ 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;
+    //      wheel + shift   -> horizontal scrolling.
+
+    if( ( !m_enableMousewheelPan && ( aEvent.ControlDown() || aEvent.ShiftDown() ) ) ||
+        ( m_enableMousewheelPan && !aEvent.ControlDown() ) )
     {
         // Scrolling
         VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
@@ -109,7 +119,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
 
         if ( m_enableMousewheelPan )
         {
-            if ( axis == wxMOUSE_WHEEL_HORIZONTAL )
+            if ( axis == wxMOUSE_WHEEL_HORIZONTAL || aEvent.ShiftDown() )
                 scrollX = scrollVec.x;
             else
                 scrollY = -scrollVec.y;
-- 
2.11.0


Follow ups

References