From c001c26575df25e211d0dc1efd47ec0986316ae2 Mon Sep 17 00:00:00 2001 From: PJM Date: Wed, 17 Feb 2021 23:06:07 -0800 Subject: [PATCH] Pcbnew: Drag selections containing only tracks or vias CHANGED: If the user made a selection and then tried dragging it, the drag would only succeed if the selection contained at least one footprint. Selections with only tracks and vias would instead make KiCad drag a new selection box. This MR allows routing of selections of a single track or via, while moving selections containing more than one item, whether or not they also contain a footprint. Fixes https://gitlab.com/kicad/code/kicad/issues/7539 --- pcbnew/tools/pcb_selection_tool.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 154c1e8d44..c14eb29a3a 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -398,9 +398,12 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) // Yes -> run the move tool and wait till it finishes TRACK* track = dynamic_cast( m_selection.GetItem( 0 ) ); - if( track && trackDragAction == TRACK_DRAG_ACTION::DRAG ) + // If there is only item in the selection and it's a track, then we need to route it + bool doRouting = ( track && ( 1 == m_selection.GetSize() ) ); + + if( doRouting && trackDragAction == TRACK_DRAG_ACTION::DRAG ) m_toolMgr->RunAction( PCB_ACTIONS::drag45Degree, true ); - else if( track && trackDragAction == TRACK_DRAG_ACTION::DRAG_FREE_ANGLE ) + else if( doRouting && trackDragAction == TRACK_DRAG_ACTION::DRAG_FREE_ANGLE ) m_toolMgr->RunAction( PCB_ACTIONS::dragFreeAngle, true ); else m_toolMgr->RunAction( PCB_ACTIONS::move, true );