Snap rotation center to half-grid, not grid

This commit is contained in:
Mikolaj Wielgus 2021-12-01 17:53:14 +01:00
parent e57bde6582
commit 3960c2441b
2 changed files with 3 additions and 3 deletions

View File

@ -544,7 +544,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
case SCH_SHEET_T: case SCH_SHEET_T:
{ {
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( head ); SCH_SHEET* sheet = static_cast<SCH_SHEET*>( head );
rotPoint = m_frame->GetNearestGridPosition( sheet->GetRotationCenter() ); rotPoint = m_frame->GetNearestHalfGridPosition( sheet->GetRotationCenter() );
// Rotate the sheet on itself. Sheets do not have an anchor point. // Rotate the sheet on itself. Sheets do not have an anchor point.
for( int i = 0; clockwise ? i < 3 : i < 1; ++i ) for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
@ -565,7 +565,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( moving && selection.HasReferencePoint() ) if( moving && selection.HasReferencePoint() )
rotPoint = (wxPoint) selection.GetReferencePoint(); rotPoint = (wxPoint) selection.GetReferencePoint();
else else
rotPoint = m_frame->GetNearestGridPosition( (wxPoint) selection.GetCenter() ); rotPoint = m_frame->GetNearestHalfGridPosition( (wxPoint) selection.GetCenter() );
} }
for( unsigned ii = 0; ii < selection.GetSize(); ii++ ) for( unsigned ii = 0; ii < selection.GetSize(); ii++ )

View File

@ -161,7 +161,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( selection.GetSize() == 1 ) if( selection.GetSize() == 1 )
rotPoint = item->GetPosition(); rotPoint = item->GetPosition();
else else
rotPoint = m_frame->GetNearestGridPosition( mapCoords( selection.GetCenter() ) ); rotPoint = m_frame->GetNearestHalfGridPosition( mapCoords( selection.GetCenter() ) );
for( unsigned ii = 0; ii < selection.GetSize(); ii++ ) for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
{ {