Fix selection logic to handle LIB_ITEM as well as SCH_ITEM.
Fixes https://gitlab.com/kicad/code/kicad/issues/9954
This commit is contained in:
parent
88fc6d25a7
commit
885979ba75
|
@ -1233,19 +1233,22 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
view->Query( area.ViewBBox(), nearbyViewItems );
|
view->Query( area.ViewBBox(), nearbyViewItems );
|
||||||
|
|
||||||
// Build lists of nearby items and their children
|
// Build lists of nearby items and their children
|
||||||
std::vector<SCH_ITEM*> nearbyItems;
|
std::vector<EDA_ITEM*> nearbyItems;
|
||||||
std::vector<SCH_ITEM*> nearbyChildren;
|
std::vector<EDA_ITEM*> nearbyChildren;
|
||||||
|
|
||||||
for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems )
|
for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems )
|
||||||
{
|
{
|
||||||
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( pair.first );
|
EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first );
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
item->ClearFlags( TEMP_SELECTED | STARTPOINT | ENDPOINT );
|
item->ClearFlags( TEMP_SELECTED | STARTPOINT | ENDPOINT );
|
||||||
nearbyItems.push_back( item );
|
nearbyItems.push_back( item );
|
||||||
|
}
|
||||||
|
|
||||||
item->RunOnChildren(
|
if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item ) )
|
||||||
|
{
|
||||||
|
sch_item->RunOnChildren(
|
||||||
[&]( SCH_ITEM* aChild )
|
[&]( SCH_ITEM* aChild )
|
||||||
{
|
{
|
||||||
nearbyChildren.push_back( aChild );
|
nearbyChildren.push_back( aChild );
|
||||||
|
@ -1259,7 +1262,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
bool anyAdded = false;
|
bool anyAdded = false;
|
||||||
bool anySubtracted = false;
|
bool anySubtracted = false;
|
||||||
auto selectItem =
|
auto selectItem =
|
||||||
[&]( SCH_ITEM* aItem )
|
[&]( EDA_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( m_subtractive || ( m_exclusive_or && aItem->IsSelected() ) )
|
if( m_subtractive || ( m_exclusive_or && aItem->IsSelected() ) )
|
||||||
{
|
{
|
||||||
|
@ -1274,7 +1277,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for( SCH_ITEM* item : nearbyItems )
|
for( EDA_ITEM* item : nearbyItems )
|
||||||
{
|
{
|
||||||
if( Selectable( item ) && item->HitTest( selectionRect, isWindowSelection ) )
|
if( Selectable( item ) && item->HitTest( selectionRect, isWindowSelection ) )
|
||||||
{
|
{
|
||||||
|
@ -1283,7 +1286,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( SCH_ITEM* item : nearbyChildren )
|
for( EDA_ITEM* item : nearbyChildren )
|
||||||
{
|
{
|
||||||
if( Selectable( item )
|
if( Selectable( item )
|
||||||
&& !item->GetParent()->HasFlag( TEMP_SELECTED )
|
&& !item->GetParent()->HasFlag( TEMP_SELECTED )
|
||||||
|
|
Loading…
Reference in New Issue