From aa68a3817a6549cf3a989a3b5f4ba1a328f2806b Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Fri, 8 Mar 2024 21:23:12 +0300 Subject: [PATCH] Fix zone cross-probing from DRC dialog. --- pcbnew/dialogs/dialog_drc.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 6e553f864b..5355764f3e 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -487,6 +487,8 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent ) if( item->Type() == PCB_ZONE_T ) { + m_frame->FocusOnItem( item, principalLayer ); + m_frame->GetBoard()->GetConnectivity()->RunOnUnconnectedEdges( [&]( CN_EDGE& edge ) { @@ -499,12 +501,25 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent ) return true; if( edge.GetSourceNode()->Parent() == a - && edge.GetTargetNode()->Parent() == b ) + && edge.GetTargetNode()->Parent() == b ) { - if( item == a ) - m_frame->FocusOnLocation( edge.GetSourcePos() ); + VECTOR2I focusPos; + + if( item == a && item == b ) + { + focusPos = ( node->m_Type == RC_TREE_NODE::MAIN_ITEM ) + ? edge.GetSourcePos() + : edge.GetTargetPos(); + } else - m_frame->FocusOnLocation( edge.GetTargetPos() ); + { + focusPos = ( item == edge.GetSourceNode()->Parent() ) + ? edge.GetSourcePos() + : edge.GetTargetPos(); + } + + m_frame->FocusOnLocation( focusPos ); + m_frame->RefreshCanvas(); return false; }