Restore unique-item filtering when collecting nearby items from view.

Fixes https://gitlab.com/kicad/code/kicad/issues/12076
This commit is contained in:
Jeff Young 2022-07-23 15:09:16 +01:00
parent cb77e68076
commit f48755cc67
1 changed files with 14 additions and 12 deletions

View File

@ -1275,16 +1275,17 @@ 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<EDA_ITEM*> nearbyItems; std::unordered_set<EDA_ITEM*> nearbyItems;
std::vector<EDA_ITEM*> nearbyChildren; std::vector<EDA_ITEM*> nearbyChildren;
std::vector<EDA_ITEM*> flaggedItems; std::vector<EDA_ITEM*> flaggedItems;
for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems ) for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems )
{ {
if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first ) ) if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first ) )
{
if( nearbyItems.insert( item ).second )
{ {
item->ClearFlags( CANDIDATE ); item->ClearFlags( CANDIDATE );
nearbyItems.push_back( item );
if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item ) ) if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item ) )
{ {
@ -1296,6 +1297,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
} }
} }
} }
}
EDA_RECT selectionRect( area.GetOrigin(), wxSize( width, height ) ); EDA_RECT selectionRect( area.GetOrigin(), wxSize( width, height ) );
selectionRect.Normalize(); selectionRect.Normalize();