← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix warp-to-nearest pad bug with T hotkey

 

Hi,

This patch fixes a GAL usability quirk with the T hotkey (find and move).

Fixes: https://bugs.launchpad.net/kicad/+bug/1571214

Cheers,

John
From 191412b93ba263f69d69e75cabb7758b175607bd Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Mon, 6 Feb 2017 18:16:36 +0800
Subject: [PATCH] Warp to module when 'find-moving' modules in GAL

Perviously, the generic snapping code would choose the nearest of the
module origin and origin of each module pad when selecting a module
using the "Find module" tool (T hotkey).

This is unlikely to be expected unless the cursor is already near the
correct pad or the module centre.

New behaviour is to warp the cursor to the module centre first, then
select the module. This means that the cursor is already nearest the
main module origin anchor, so that is what will be used.

Fixes: lp:1571214
* https://bugs.launchpad.net/kicad/+bug/1571214
---
 pcbnew/tools/selection_tool.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index ccb9d7252..26e36bbd2 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -714,6 +714,10 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
 
     if( module )
     {
+        // place cursor on module origin first, so the generic anchor snap
+        // doesn't just choose the closest pin for us
+        getViewControls()->WarpCursor( module->GetPosition(), true, true );
+
         clearSelection();
         toggleSelection( module );
         m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
-- 
2.11.0


Follow ups