pcbnew: Force rotation to grid

When setting the modification point of a group, we get the grid-snapped
coordinate

Fixes: lp:1674835
* https://bugs.launchpad.net/kicad/+bug/1674835
This commit is contained in:
Seth Hillbrand 2019-02-23 14:33:43 -08:00
parent 643d9901c7
commit 1be759c5c1
1 changed files with 4 additions and 3 deletions

View File

@ -684,6 +684,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
return 0;
updateModificationPoint( selection );
auto refPt = selection.GetReferencePoint();
const int rotateAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *editFrame, aEvent );
// When editing modules, all items have the same parent
@ -697,7 +698,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( !item->IsNew() && !EditingModules() )
m_commit->Modify( item );
static_cast<BOARD_ITEM*>( item )->Rotate( selection.GetReferencePoint(), rotateAngle );
static_cast<BOARD_ITEM*>( item )->Rotate( refPt, rotateAngle );
}
if( !m_dragging )
@ -1421,10 +1422,10 @@ bool EDIT_TOOL::updateModificationPoint( SELECTION& aSelection )
auto pos = item->GetPosition();
aSelection.SetReferencePoint( VECTOR2I( pos.x, pos.y ) );
}
// ...otherwise modify items with regard to the cursor position
// ...otherwise modify items with regard to the grid-snapped cursor position
else
{
m_cursor = getViewControls()->GetCursorPosition();
m_cursor = getViewControls()->GetCursorPosition( true );
aSelection.SetReferencePoint( m_cursor );
}