Fix snapping to anchors in PICKER_TOOL & highlighting of pasted items

This commit is contained in:
Tomasz Włostowski 2017-09-25 00:18:51 +02:00
parent 931a1ccaff
commit 3fb926a8f2
2 changed files with 8 additions and 2 deletions

View File

@ -871,6 +871,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems )
for ( auto item : aItems ) for ( auto item : aItems )
{ {
item->SetSelected();
selection.Add( item ); selection.Add( item );
editTool->GetCurrentCommit()->Add( item ); editTool->GetCurrentCommit()->Add( item );
} }

View File

@ -54,12 +54,16 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
while( OPT_TOOL_EVENT evt = Wait() ) 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 ) ) if( evt->IsClick( BUT_LEFT ) )
{ {
bool getNext = false; bool getNext = false;
auto cursorPos = controls->GetCursorPosition();
m_picked = grid.BestSnapAnchor( cursorPos, nullptr );
m_picked = p;
if( m_clickHandler ) if( m_clickHandler )
{ {
try try
@ -87,6 +91,7 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
} }
reset(); reset();
controls->ForceCursorPosition( false );
getEditFrame<PCB_BASE_FRAME>()->SetNoToolSelected(); getEditFrame<PCB_BASE_FRAME>()->SetNoToolSelected();
return 0; return 0;