From 3bf24fae7abdd59adfbd21c45662152a99793abf Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 12 Aug 2019 20:30:25 +0100 Subject: [PATCH] Set selection reference point to top-left item. Fixes: lp:1771016 * https://bugs.launchpad.net/kicad/+bug/1771016 --- pcbnew/tools/pcbnew_control.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 3b214e3969..3140a30352 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -767,10 +767,16 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector& aItems, bool aIsN editTool->GetCurrentCommit()->Added( item ); } - selection.SetReferencePoint( VECTOR2I( 0, 0 ) ); + if( selection.Size() > 0 ) + { + BOARD_ITEM* item = (BOARD_ITEM*) selection.GetTopLeftItem(); - m_toolMgr->ProcessEvent( EVENTS::SelectedEvent ); - m_toolMgr->RunAction( PCB_ACTIONS::move, true ); + selection.SetReferencePoint( item->GetPosition() ); + getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false ); + + m_toolMgr->ProcessEvent( EVENTS::SelectedEvent ); + m_toolMgr->RunAction( PCB_ACTIONS::move, true ); + } return 0; }