PNS: Avoid flickering clearances on new items

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9773
This commit is contained in:
Jon Evans 2021-11-25 15:38:04 -05:00
parent 63718323bc
commit da458535c4
3 changed files with 11 additions and 0 deletions

View File

@ -88,6 +88,8 @@ public:
int ClearanceEpsilon() const { return m_clearanceEpsilon; }
void ClearCacheForItem( const PNS::ITEM* aItem ) override;
private:
int holeRadius( const PNS::ITEM* aItem ) const;
@ -294,6 +296,12 @@ bool PNS_PCBNEW_RULE_RESOLVER::QueryConstraint( PNS::CONSTRAINT_TYPE aType,
}
void PNS_PCBNEW_RULE_RESOLVER::ClearCacheForItem( const PNS::ITEM* aItem )
{
m_clearanceCache.erase( std::make_pair( aItem, nullptr ) );
}
int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB )
{
std::pair<const PNS::ITEM*, const PNS::ITEM*> key( aA, aB );

View File

@ -94,6 +94,8 @@ public:
PNS::CONSTRAINT* aConstraint ) = 0;
virtual wxString NetName( int aNet ) = 0;
virtual void ClearCacheForItem( const ITEM* aItem ) {}
};
/**

View File

@ -548,6 +548,7 @@ void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent, bool aDragging )
for( ITEM* item : added )
{
GetRuleResolver()->ClearCacheForItem( item );
int clearance = GetRuleResolver()->Clearance( item, nullptr );
m_iface->DisplayItem( item, clearance, aDragging );
}