Support single-field-mirroring in Symbol Editor.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13395
This commit is contained in:
Jeff Young 2023-11-20 22:55:51 +00:00
parent f3fdfa73e6
commit f9c8f6ab79
1 changed files with 40 additions and 10 deletions

View File

@ -213,8 +213,37 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
saveCopyInUndoList( m_frame->GetCurSymbol(), UNDO_REDO::LIBEDIT );
if( selection.GetSize() == 1 )
{
mirrorPoint = item->GetPosition();
switch( item->Type() )
{
case LIB_FIELD_T:
{
LIB_FIELD* field = static_cast<LIB_FIELD*>( item );
if( xAxis )
field->SetVertJustify( TO_VJUSTIFY( -field->GetVertJustify() ) );
else
field->SetHorizJustify( TO_HJUSTIFY( -field->GetHorizJustify() ) );
break;
}
default:
if( xAxis )
item->MirrorVertical( mirrorPoint );
else
item->MirrorHorizontal( mirrorPoint );
break;
}
m_frame->UpdateItem( item, false, true );
}
else
{
mirrorPoint = m_frame->GetNearestHalfGridPosition( mapCoords( selection.GetCenter() ) );
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
@ -228,6 +257,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
m_frame->UpdateItem( item, false, true );
}
}
if( item->IsMoving() )
{