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 ); } };