Extension snaps: don't accept empty batches

These shouldn't be bad, and probably don't actually happen,
but they will act to clear extant construction lines for no
new shown items, so may as well be clear that they don't
do anything.
This commit is contained in:
John Beard 2024-10-05 22:53:34 +01:00
parent 095e414f12
commit 312996f0a2
2 changed files with 14 additions and 2 deletions

View File

@ -212,6 +212,13 @@ HashConstructionBatchSources( const CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM_BATC
void CONSTRUCTION_MANAGER::ProposeConstructionItems( CONSTRUCTION_ITEM_BATCH aBatch,
bool aIsPersistent )
{
if( aBatch.empty() )
{
// There's no point in proposing an empty batch
// It would just clear existing construction items for nothing new
return;
}
const std::size_t hash = HashConstructionBatchSources( aBatch, aIsPersistent );
m_activationHelper->ProposeActivation(

View File

@ -270,9 +270,14 @@ void PCB_GRID_HELPER::AddConstructionItems( std::vector<BOARD_ITEM*> aItems, boo
}
}
// At this point, constructionDrawables can be empty, which is fine
// (it means there's no additional construction geometry to draw, but
// the item is still going to be proposed for activation)
constructionItemsBatch.emplace_back( CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM{
CONSTRUCTION_MANAGER::SOURCE::FROM_ITEMS, item,
std::move( constructionDrawables ) } );
CONSTRUCTION_MANAGER::SOURCE::FROM_ITEMS,
item,
std::move( constructionDrawables ),
} );
}
if( referenceOnlyPoints.size() )