From 0129191ec0c5d72962711b9393528317e8b9eb34 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 1 Mar 2024 15:56:40 -0800 Subject: [PATCH] Limit where the intersection of two lines can be This avoids generating lines where we are unable to select them because they get too close to the border Fixes https://gitlab.com/kicad/code/kicad/-/issues/16959 --- pcbnew/tools/item_modification_routine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/item_modification_routine.cpp b/pcbnew/tools/item_modification_routine.cpp index c95abcb7a2..1ad0e22206 100644 --- a/pcbnew/tools/item_modification_routine.cpp +++ b/pcbnew/tools/item_modification_routine.cpp @@ -22,6 +22,7 @@ */ #include "item_modification_routine.h" +#include namespace { @@ -291,10 +292,14 @@ void LINE_EXTENSION_ROUTINE::ProcessLinePair( PCB_SHAPE& aLineA, PCB_SHAPE& aLin const int dist_end = ( *intersection - aSeg.B ).EuclideanNorm(); const VECTOR2I& furthest_pt = ( dist_start < dist_end ) ? aSeg.B : aSeg.A; + // Note, the drawing tool has COORDS_PADDING of 20mm, but we need a larger buffer + // or we are not able to select the generated segments + unsigned int edge_padding = static_cast( pcbIUScale.mmToIU( 200 ) ); + VECTOR2I new_end = GetClampedCoords( *intersection, edge_padding ); handler.MarkItemModified( aLine ); aLine.SetStart( furthest_pt ); - aLine.SetEnd( *intersection ); + aLine.SetEnd( new_end ); } };