Fix a minor inconsistency between router and DRC
Also make sure collision highlighting runs at the starting location of a drag. See: https://gitlab.com/kicad/code/kicad/-/issues/7672
This commit is contained in:
parent
0377eea45e
commit
6cbc3fb97d
|
@ -91,6 +91,7 @@ private:
|
||||||
TRACK m_dummyTrack;
|
TRACK m_dummyTrack;
|
||||||
ARC m_dummyArc;
|
ARC m_dummyArc;
|
||||||
VIA m_dummyVia;
|
VIA m_dummyVia;
|
||||||
|
int m_clearanceEpsilon;
|
||||||
|
|
||||||
std::map<std::pair<const PNS::ITEM*, const PNS::ITEM*>, int> m_clearanceCache;
|
std::map<std::pair<const PNS::ITEM*, const PNS::ITEM*>, int> m_clearanceCache;
|
||||||
std::map<std::pair<const PNS::ITEM*, const PNS::ITEM*>, int> m_holeClearanceCache;
|
std::map<std::pair<const PNS::ITEM*, const PNS::ITEM*>, int> m_holeClearanceCache;
|
||||||
|
@ -106,6 +107,10 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard,
|
||||||
m_dummyArc( aBoard ),
|
m_dummyArc( aBoard ),
|
||||||
m_dummyVia( aBoard )
|
m_dummyVia( aBoard )
|
||||||
{
|
{
|
||||||
|
if( aBoard )
|
||||||
|
m_clearanceEpsilon = aBoard->GetDesignSettings().GetDRCEpsilon();
|
||||||
|
else
|
||||||
|
m_clearanceEpsilon = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,7 +296,7 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
|
||||||
if( isCopper( aA ) && ( !aB || isCopper( aB ) ) )
|
if( isCopper( aA ) && ( !aB || isCopper( aB ) ) )
|
||||||
{
|
{
|
||||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_CLEARANCE, aA, aB, layer, &constraint ) )
|
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_CLEARANCE, aA, aB, layer, &constraint ) )
|
||||||
rv = constraint.m_Value.Min();
|
rv = constraint.m_Value.Min() - m_clearanceEpsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isEdge( aA ) || ( aB && isEdge( aB ) ) )
|
if( isEdge( aA ) || ( aB && isEdge( aB ) ) )
|
||||||
|
@ -299,7 +304,7 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
|
||||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_EDGE_CLEARANCE, aA, aB, layer, &constraint ) )
|
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_EDGE_CLEARANCE, aA, aB, layer, &constraint ) )
|
||||||
{
|
{
|
||||||
if( constraint.m_Value.Min() > rv )
|
if( constraint.m_Value.Min() > rv )
|
||||||
rv = constraint.m_Value.Min();
|
rv = constraint.m_Value.Min() - m_clearanceEpsilon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +331,7 @@ int PNS_PCBNEW_RULE_RESOLVER::HoleClearance( const PNS::ITEM* aA, const PNS::ITE
|
||||||
layer = aB->Layer();
|
layer = aB->Layer();
|
||||||
|
|
||||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_HOLE_CLEARANCE, aA, aB, layer, &constraint ) )
|
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_HOLE_CLEARANCE, aA, aB, layer, &constraint ) )
|
||||||
rv = constraint.m_Value.Min();
|
rv = constraint.m_Value.Min() - m_clearanceEpsilon;
|
||||||
|
|
||||||
m_holeClearanceCache[ key ] = rv;
|
m_holeClearanceCache[ key ] = rv;
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -351,7 +356,7 @@ int PNS_PCBNEW_RULE_RESOLVER::HoleToHoleClearance( const PNS::ITEM* aA, const PN
|
||||||
layer = aB->Layer();
|
layer = aB->Layer();
|
||||||
|
|
||||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_HOLE_TO_HOLE, aA, aB, layer, &constraint ) )
|
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_HOLE_TO_HOLE, aA, aB, layer, &constraint ) )
|
||||||
rv = constraint.m_Value.Min();
|
rv = constraint.m_Value.Min() - m_clearanceEpsilon;
|
||||||
|
|
||||||
m_holeToHoleClearanceCache[ key ] = rv;
|
m_holeToHoleClearanceCache[ key ] = rv;
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -1636,6 +1636,9 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
||||||
// Set initial cursor
|
// Set initial cursor
|
||||||
setCursor();
|
setCursor();
|
||||||
|
|
||||||
|
// Send an initial movement to prime the collision detection
|
||||||
|
m_router->Move( p, nullptr );
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
setCursor();
|
setCursor();
|
||||||
|
|
Loading…
Reference in New Issue