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
This commit is contained in:
PJM 2021-02-17 23:06:07 -08:00 committed by Seth Hillbrand
parent b2cd97fd84
commit c001c26575
1 changed files with 5 additions and 2 deletions

View File

@ -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<TRACK*>( 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 );