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
(cherry picked from commit 0129191ec0
)
This commit is contained in:
parent
53d8e2c8c3
commit
ecb0c9b5d4
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
|
||||
#include "item_modification_routine.h"
|
||||
#include <geometry/geometry_utils.h>
|
||||
|
||||
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<unsigned>( pcbIUScale.mmToIU( 200 ) );
|
||||
VECTOR2I new_end = GetClampedCoords( *intersection, edge_padding );
|
||||
|
||||
handler.MarkItemModified( aLine );
|
||||
aLine.SetStart( furthest_pt );
|
||||
aLine.SetEnd( *intersection );
|
||||
aLine.SetEnd( new_end );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue