Fix keep-upright algo for footprint text.

Also removes PCB_FIELDs from rotation centre calc in
footprint editor if there is other stuff selected.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16896
This commit is contained in:
Jeff Young
2024-05-17 18:34:44 +01:00
parent 0772739cf1
commit 25bb3f77fa
4 changed files with 24 additions and 6 deletions
+18 -1
View File
@@ -2956,7 +2956,24 @@ bool EDIT_TOOL::updateModificationPoint( PCB_SELECTION& aSelection )
else
{
PCB_GRID_HELPER grid( m_toolMgr, frame()->GetMagneticItemsSettings() );
aSelection.SetReferencePoint( grid.BestSnapAnchor( aSelection.GetCenter(), nullptr ) );
VECTOR2I refPt = aSelection.GetCenter();
// Exclude text in the footprint editor if there's anything else selected
if( m_isFootprintEditor )
{
BOX2I nonFieldsBBox;
for( EDA_ITEM* item : aSelection.Items() )
{
if( !item->IsType( { PCB_TEXT_T, PCB_FIELD_T } ) )
nonFieldsBBox.Merge( item->GetBoundingBox() );
}
if( nonFieldsBBox.IsValid() )
refPt = nonFieldsBBox.GetCenter();
}
aSelection.SetReferencePoint( grid.BestSnapAnchor( refPt, nullptr ) );
}
return true;