From c8879d9034874eb5924ebc18d96d46e264968c50 Mon Sep 17 00:00:00 2001 From: PJM Date: Thu, 17 Sep 2020 17:16:08 -0700 Subject: [PATCH] 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 --- eeschema/tools/sch_move_tool.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 88b33b8a53..a3766ce5c0 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -304,12 +304,21 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) } else { - std::vector items; + if( m_frame->GetMoveWarpsCursor() ) + { + // User wants to warp the mouse + std::vector items; - for( EDA_ITEM* item : selection ) - items.push_back( static_cast( item ) ); + for( EDA_ITEM* item : selection ) + items.push_back( static_cast( 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 ); + } }