Move footprint when selecting locked pad

Prompting to unlock is obtrusive and blocks the common action of
dragging from a pad to align footprints.  The less common action of
editing pads in layout can be accomplished after unlocking the pads

Fixes https://gitlab.com/kicad/code/kicad/issues/6997
This commit is contained in:
Seth Hillbrand 2021-01-07 19:44:28 -08:00
parent 24435df6b0
commit 9424d66d22
2 changed files with 19 additions and 1 deletions

View File

@ -333,6 +333,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
std::set<BOARD_ITEM*> to_add;
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
{
@ -340,7 +342,19 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
if( item->Type() == PCB_MARKER_T )
aCollector.Remove( item );
/// Locked pads do not get moved independently of the footprint
if( item->Type() == PCB_PAD_T && item->IsLocked() )
{
if( !aCollector.HasItem( item->GetParent() ) )
to_add.insert( item->GetParent() );
aCollector.Remove( item );
}
}
for( BOARD_ITEM* item : to_add )
aCollector.Append( item );
},
true /* prompt user regarding locked items */ );

View File

@ -415,7 +415,11 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
auto handlePadShape =
[&]( PAD* aPad )
{
addAnchor( aPad->GetPosition(), CORNER | SNAPPABLE, aPad );
addAnchor( aPad->GetPosition(), ORIGIN | SNAPPABLE, aPad );
/// If we are getting a drag point, we don't want to center the edge of pads
if( aFrom )
return;
const std::shared_ptr<SHAPE> eshape = aPad->GetEffectiveShape( aPad->GetLayer() );