diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index e2cc7bb9c6..9766f16c3c 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -2416,16 +2416,10 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) if( ( aOther->Type() == PCB_ZONE_T || aOther->Type() == PCB_FP_ZONE_T ) && static_cast( aOther )->GetIsRuleArea() ) { - ZONE* zone = static_cast( aOther ); + ZONE* ruleArea = static_cast( aOther ); - if( zone->GetDoNotAllowVias() ) - return true; - - constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, aVia, nullptr, - UNDEFINED_LAYER ); - - if( constraint.m_DisallowFlags ) - return true; + if( ruleArea->GetDoNotAllowVias() ) + return ruleArea->Outline()->Collide( aVia->GetPosition(), aVia->GetWidth() / 2 ); return false; } @@ -2531,6 +2525,12 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) checkedItems.insert( item ); } + DRC_CONSTRAINT constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, aVia, nullptr, + UNDEFINED_LAYER ); + + if( constraint.m_DisallowFlags ) + return true; + return false; }