Include footprint center as snap point

Only when footprint center isn't approximate the footprint origin as
well.  This can help when moving/aligning THT footprints

Fixes https://gitlab.com/kicad/code/kicad/issues/7385
This commit is contained in:
Seth Hillbrand 2021-02-01 12:02:24 -08:00
parent 54f5a47208
commit 29632e8b6f
1 changed files with 10 additions and 1 deletions

View File

@ -485,7 +485,16 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
}
// if the cursor is not over a pad, then drag the footprint by its origin
addAnchor( footprint->GetPosition(), ORIGIN | SNAPPABLE, footprint );
VECTOR2I position = footprint->GetPosition();
addAnchor( position, ORIGIN | SNAPPABLE, footprint );
// Add the footprint center point if it is markedly different from the origin
VECTOR2I center = footprint->GetFootprintRect().Centre();
VECTOR2I grid( GetGrid() );
if( ( center - position ).SquaredEuclideanNorm() > grid.SquaredEuclideanNorm() )
addAnchor( footprint->GetFootprintRect().Centre(), ORIGIN | SNAPPABLE, footprint );
break;
}