Snap to pads when placing via

Fixes https://gitlab.com/kicad/code/kicad/issues/9873
This commit is contained in:
Jonathan Haas 2021-12-06 15:35:10 +01:00 committed by Jeff Young
parent 95087c6de5
commit 04b0435c45
1 changed files with 7 additions and 0 deletions

View File

@ -2555,6 +2555,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
PCB_VIA* via = static_cast<PCB_VIA*>( aItem );
wxPoint position = via->GetPosition();
PCB_TRACK* track = findTrack( via );
PAD* pad = findPad( via );
if( track )
{
@ -2563,6 +2564,12 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
aItem->SetPosition( (wxPoint) snap );
}
else if( pad && m_gridHelper.GetSnap()
&& m_frame->GetMagneticItemsSettings()->pads
== MAGNETIC_OPTIONS::CAPTURE_ALWAYS )
{
aItem->SetPosition( pad->GetPosition() );
}
}
bool PlaceItem( BOARD_ITEM* aItem, BOARD_COMMIT& aCommit ) override