← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix artifacts on touchpad scroll (fixes lp:1735669)

 

​This fixes artifacts remaining on the screen when touchpad scrolling is
enabled.
https://bugs.launchpad.net/kicad/+bug/1735669

The attached patch is tested on MacOS and Linux.  Could someone with a
Windows laptop check that the performance of touchpad scrolling is not
affected?

Thanks!
Seth
From 6b49b117f17a79116eb852b5222b209b90f7cfbf Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Mon, 4 Dec 2017 16:02:28 -0800
Subject: [PATCH] Fix touchpad scrolling with mousewheelPan

Fixes: lp:1735669
* https://bugs.launchpad.net/kicad/+bug/1735669
---
 common/draw_panel.cpp | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp
index b8e579573..716c1e0d2 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -996,25 +996,31 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
                 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
         {
+            if( event.ShiftDown() && !event.ControlDown() )
+                axis = wxMOUSE_WHEEL_HORIZONTAL;
+
             wxPoint newStart = GetViewStart();
+            wxPoint center = GetParent()->GetScrollCenterPosition();
+            double scale = GetParent()->GetScreen()->GetScalingFactor();
+
             if( axis == wxMOUSE_WHEEL_HORIZONTAL )
+            {
                 newStart.x += wheelRotation;
+                center.x += KiROUND( (double) wheelRotation / scale );
+            }
             else
+            {
                 newStart.y -= wheelRotation;
+                center.y -= KiROUND( (double) wheelRotation / scale );
+            }
+            Scroll( newStart );
 
-            wxPoint center = GetScreenCenterLogicalPosition();
             GetParent()->SetScrollCenterPosition( center );
-            Scroll( newStart );
+            GetParent()->SetCrossHairPosition( center, true );
+            GetParent()->RedrawScreen( center, false );
         }
     }
     else if( wheelRotation > 0 )
-- 
2.11.0


Follow ups