Commit 382c6bd2 authored by Maciej Suminski's avatar Maciej Suminski

Move tool is activated when drag event starts nearby selected items.

parent b04de0ca
......@@ -111,8 +111,28 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
}
else
{
// Now user wants to drag the selected items
bool runTool = false;
// Check if dragging event started within the currently selected items bounding box
std::set<BOARD_ITEM*>::iterator it, it_end;
for( it = m_selectedItems.begin(), it_end = m_selectedItems.end(); it != it_end; ++it )
{
BOX2I itemBox = (*it)->ViewBBox();
itemBox.Inflate( 500000 ); // Give some margin for gripping an item
if( itemBox.Contains( evt->Position() ) )
{
// Click event occurred within a selected item bounding box
// -> user wants to drag selected items
runTool = true;
break;
}
}
if( runTool )
m_toolMgr->InvokeTool( "pcbnew.InteractiveMove" );
else
clearSelection();
}
}
else if( dragging )
......@@ -131,7 +151,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
{
if( m_selectedItems.find( aItem ) != m_selectedItems.end() )
if( aItem->IsSelected() )
{
aItem->ClearSelected();
m_selectedItems.erase( aItem );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment