Instant dragging (without prior selection).
This commit is contained in:
parent
9783aaf3e6
commit
6a1d344541
|
@ -141,10 +141,18 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( m_selection.Empty() || m_additive )
|
if( m_selection.Empty() || m_additive )
|
||||||
{
|
{
|
||||||
// If nothings has been selected or user wants to select more
|
if( !selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ), false ) )
|
||||||
// draw the selection box
|
{
|
||||||
selectMultiple();
|
// If nothings has been selected or user wants to select more
|
||||||
|
// draw the selection box
|
||||||
|
selectMultiple();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check if dragging has started within any of selected items bounding box
|
// Check if dragging has started within any of selected items bounding box
|
||||||
|
@ -205,7 +213,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
|
bool SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere, bool aAllowDisambiguation )
|
||||||
{
|
{
|
||||||
BOARD* pcb = getModel<BOARD>( PCB_T );
|
BOARD* pcb = getModel<BOARD>( PCB_T );
|
||||||
BOARD_ITEM* item;
|
BOARD_ITEM* item;
|
||||||
|
@ -220,11 +228,13 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
|
||||||
case 0:
|
case 0:
|
||||||
if( !m_additive )
|
if( !m_additive )
|
||||||
clearSelection();
|
clearSelection();
|
||||||
break;
|
|
||||||
|
return false;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
toggleSelection( collector[0] );
|
toggleSelection( collector[0] );
|
||||||
break;
|
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Remove unselectable items
|
// Remove unselectable items
|
||||||
|
@ -238,17 +248,25 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
|
||||||
if( collector.GetCount() == 1 )
|
if( collector.GetCount() == 1 )
|
||||||
{
|
{
|
||||||
toggleSelection( collector[0] );
|
toggleSelection( collector[0] );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if( collector.GetCount() > 1 )
|
|
||||||
|
else if( aAllowDisambiguation && collector.GetCount() > 1 )
|
||||||
{
|
{
|
||||||
item = disambiguationMenu( &collector );
|
item = disambiguationMenu( &collector );
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
|
{
|
||||||
toggleSelection( item );
|
toggleSelection( item );
|
||||||
}
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -130,8 +130,11 @@ private:
|
||||||
* place, there is a menu displayed that allows to choose the item.
|
* place, there is a menu displayed that allows to choose the item.
|
||||||
*
|
*
|
||||||
* @param aWhere is the place where the item should be selected.
|
* @param aWhere is the place where the item should be selected.
|
||||||
|
* @param aAllowDisambiguation decides what to do in case of disambiguation. If true, then
|
||||||
|
* a menu is shown, otherise function finishes without selecting anything.
|
||||||
|
* @return True if an item was selected, false otherwise.
|
||||||
*/
|
*/
|
||||||
void selectSingle( const VECTOR2I& aWhere );
|
bool selectSingle( const VECTOR2I& aWhere, bool aAllowDisambiguation = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function selectMultiple()
|
* Function selectMultiple()
|
||||||
|
|
Loading…
Reference in New Issue