From 1be759c5c155d8eadb4c722171cdffecbfcdb0e1 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 23 Feb 2019 14:33:43 -0800 Subject: [PATCH] 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 --- pcbnew/tools/edit_tool.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 0fb4869596..45ee495d02 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -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( item )->Rotate( selection.GetReferencePoint(), rotateAngle ); + static_cast( 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 ); }