Fix frustration with mirroring autoplaced fields

When the user asks to mirror a symbol is is frequently to get the
reference/value on the other side of the symbol for placement purposes.
Autoplacing the fields here keeps the text where they were initially
which can be frustating to work around.

This commit treats the mirror command as a user request to change where
the fields are
This commit is contained in:
Seth Hillbrand 2022-04-25 12:50:45 -07:00
parent 1a70465927
commit 25474b347c
1 changed files with 14 additions and 2 deletions

View File

@ -772,9 +772,21 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
else
symbol->SetOrientation( SYM_MIRROR_Y );
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
symbol->AutoAutoplaceFields( m_frame->GetScreen() );
// If the user asks to mirror the symbol, don't keep their text in the
// same place
symbol->RunOnChildren(
[&]( SCH_ITEM* aChild )
{
if( SCH_FIELD* field = dyn_cast<SCH_FIELD*>( aChild ) )
{
if( vertical )
field->SetVertJustify( TO_VJUSTIFY( -field->GetVertJustify() ) );
else
field->SetHorizJustify( TO_HJUSTIFY( -field->GetHorizJustify() ) );
}
} );
symbol->ClearFieldsAutoplaced();
break;
}