Delete full track needs proper scoping

This should not run if the action is "Cut".  Additionally, we need to
transfer the expanded selection to selectionCopy in order for it to
proceed with the deletion.  There is also no need for this to be limited
to the Hover action, so this section was removed.

Fixes https://gitlab.com/kicad/code/kicad/issues/9385
This commit is contained in:
Seth Hillbrand 2021-10-12 13:45:41 -07:00
parent c1e6fdfb47
commit 5a6f230a2c
1 changed files with 8 additions and 10 deletions

View File

@ -1828,6 +1828,14 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
}
}
// in "alternative" mode, deletion is not just a simple list of selected items,
// it removes whole tracks, not just segments
if( isAlt && ( selectionCopy.HasType( PCB_TRACE_T ) || selectionCopy.HasType( PCB_VIA_T ) ) )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectConnection, true );
}
selectionCopy = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
@ -1835,16 +1843,6 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
true /* prompt user regarding locked items */ );
}
bool isHover = selectionCopy.IsHover();
// in "alternative" mode, deletion is not just a simple list of selected items,
// it removes whole tracks, not just segments
if( isAlt && isHover
&& ( selectionCopy.HasType( PCB_TRACE_T ) || selectionCopy.HasType( PCB_VIA_T ) ) )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectConnection, true );
}
// As we are about to remove items, they have to be removed from the selection first
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );