From 3fb926a8f2d852e892d5789f3b6aac5f8ebdb2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Mon, 25 Sep 2017 00:18:51 +0200 Subject: [PATCH] Fix snapping to anchors in PICKER_TOOL & highlighting of pasted items --- pcbnew/tools/pcbnew_control.cpp | 1 + pcbnew/tools/picker_tool.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index fbddbec1ab..ff92486450 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -871,6 +871,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector& aItems ) for ( auto item : aItems ) { + item->SetSelected(); selection.Add( item ); editTool->GetCurrentCommit()->Add( item ); } diff --git a/pcbnew/tools/picker_tool.cpp b/pcbnew/tools/picker_tool.cpp index a6ddd6a8df..a8e63d68ad 100644 --- a/pcbnew/tools/picker_tool.cpp +++ b/pcbnew/tools/picker_tool.cpp @@ -54,12 +54,16 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) while( OPT_TOOL_EVENT evt = Wait() ) { + auto mousePos = controls->GetMousePosition(); + auto p = grid.BestSnapAnchor( mousePos, nullptr ); + controls->ForceCursorPosition( true, p ); + if( evt->IsClick( BUT_LEFT ) ) { bool getNext = false; - auto cursorPos = controls->GetCursorPosition(); - m_picked = grid.BestSnapAnchor( cursorPos, nullptr ); + m_picked = p; + if( m_clickHandler ) { try @@ -87,6 +91,7 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) } reset(); + controls->ForceCursorPosition( false ); getEditFrame()->SetNoToolSelected(); return 0;