Eeschema: Check if user wants to warp mouse to origin of moved object

CHANGED: When moving a footprint, Eeschema was always warping the mouse
when moving an item regardless of the state of the "Warp mouse to
origin of moved object" checkbox.  This MR now honors the state of the
checkbox when moving schematic items.

NOTE: Issue 5279 originally only mentioned Pcbnew, but after the fix
for Pcbnew was submitted, a user pointed out it also happened in
Eeschema.  Becuase of this, there are two MRs that "fix" the same issue.

Fixes https://gitlab.com/kicad/code/kicad/issues/5279
This commit is contained in:
PJM 2020-09-17 17:16:08 -07:00 committed by Seth Hillbrand
parent 5feb4d3a7a
commit c8879d9034
1 changed files with 13 additions and 4 deletions

View File

@ -304,12 +304,21 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
}
else
{
std::vector<SCH_ITEM*> items;
if( m_frame->GetMoveWarpsCursor() )
{
// User wants to warp the mouse
std::vector<SCH_ITEM*> items;
for( EDA_ITEM* item : selection )
items.push_back( static_cast<SCH_ITEM*>( item ) );
for( EDA_ITEM* item : selection )
items.push_back( static_cast<SCH_ITEM*>( item ) );
m_cursor = grid.BestDragOrigin( m_cursor, items );
m_cursor = grid.BestDragOrigin( m_cursor, items );
}
else
{
// User does not want to warp the mouse
m_cursor = getViewControls()->GetCursorPosition( true );
}
}