Fix selecting pads of footprints in groups.
This commit is contained in:
parent
f95e77499b
commit
67985510a8
|
@ -71,22 +71,23 @@ void PCB_GROUP::RemoveAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @return if not in the footprint editor and aItem is in a footprint, returns the
|
||||||
|
* footprint's parent group. Otherwise, returns the aItem's parent group.
|
||||||
|
*/
|
||||||
|
PCB_GROUP* getClosestGroup( BOARD_ITEM* aItem, bool isFootprintEditor )
|
||||||
|
{
|
||||||
|
if( !isFootprintEditor && aItem->GetParent() && aItem->GetParent()->Type() == PCB_FOOTPRINT_T )
|
||||||
|
return aItem->GetParent()->GetParentGroup();
|
||||||
|
else
|
||||||
|
return aItem->GetParentGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Returns the top level group inside the aScope group, or nullptr
|
/// Returns the top level group inside the aScope group, or nullptr
|
||||||
PCB_GROUP* getNestedGroup( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootprintEditor )
|
PCB_GROUP* getNestedGroup( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootprintEditor )
|
||||||
{
|
{
|
||||||
PCB_GROUP* group = nullptr;
|
PCB_GROUP* group = getClosestGroup( aItem, isFootprintEditor );
|
||||||
|
|
||||||
if( isFootprintEditor )
|
|
||||||
{
|
|
||||||
group = aItem->GetParentGroup();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( aItem->GetParent() && aItem->GetParent()->Type() == PCB_FOOTPRINT_T )
|
|
||||||
group = aItem->GetParent()->GetParentGroup();
|
|
||||||
else
|
|
||||||
group = aItem->GetParentGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( group == aScope )
|
if( group == aScope )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -111,7 +112,9 @@ PCB_GROUP* PCB_GROUP::TopLevelGroup( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool
|
||||||
|
|
||||||
bool PCB_GROUP::WithinScope( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootprintEditor )
|
bool PCB_GROUP::WithinScope( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootprintEditor )
|
||||||
{
|
{
|
||||||
if( aItem->GetParentGroup() && aItem->GetParentGroup() == aScope )
|
PCB_GROUP* group = getClosestGroup( aItem, isFootprintEditor );
|
||||||
|
|
||||||
|
if( group && group == aScope )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PCB_GROUP* nested = getNestedGroup( aItem, aScope, isFootprintEditor );
|
PCB_GROUP* nested = getNestedGroup( aItem, aScope, isFootprintEditor );
|
||||||
|
|
Loading…
Reference in New Issue