From 04b0435c45293b128d4b469bd1109d209a8287df Mon Sep 17 00:00:00 2001 From: Jonathan Haas Date: Mon, 6 Dec 2021 15:35:10 +0100 Subject: [PATCH] Snap to pads when placing via Fixes https://gitlab.com/kicad/code/kicad/issues/9873 --- pcbnew/tools/drawing_tool.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 29737453f8..65d1a13f1e 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -2555,6 +2555,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) PCB_VIA* via = static_cast( 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