From 0debaa586617ee6bfae5fc4b2e2444a61eed1ece Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 16 Aug 2020 13:30:05 -0700 Subject: [PATCH] Update selection ratsnest should do slow updates sometimes When rotating/mirroring/etc, the selection ratsnest should be recalculated to keep the lines correctly connected for the fast tree move. Fixes https://gitlab.com/kicad/code/kicad/issues/5194 --- pcbnew/tools/pcb_inspection_tool.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pcbnew/tools/pcb_inspection_tool.cpp b/pcbnew/tools/pcb_inspection_tool.cpp index ef21012aa4..fe95c8d19d 100644 --- a/pcbnew/tools/pcb_inspection_tool.cpp +++ b/pcbnew/tools/pcb_inspection_tool.cpp @@ -426,7 +426,20 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent ) int PCB_INSPECTION_TOOL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent ) { - VECTOR2I* delta = aEvent.Parameter(); + VECTOR2I delta; + + // If we have passed the simple move vector, we can update without recalculation + if( aEvent.Parameter() ) + { + delta = *aEvent.Parameter(); + delete aEvent.Parameter(); + } + else + { + // We can delete the existing map to force a recalculation + delete m_dynamicData; + m_dynamicData = nullptr; + } auto selectionTool = m_toolMgr->GetTool(); auto& selection = selectionTool->GetSelection(); @@ -440,10 +453,9 @@ int PCB_INSPECTION_TOOL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent ) } else { - calculateSelectionRatsnest( *delta ); + calculateSelectionRatsnest( delta ); } - delete delta; return 0; }