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
This commit is contained in:
parent
8dddd9cc2c
commit
0129191ec0
|
@ -22,6 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "item_modification_routine.h"
|
#include "item_modification_routine.h"
|
||||||
|
#include <geometry/geometry_utils.h>
|
||||||
|
|
||||||
namespace
|
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 int dist_end = ( *intersection - aSeg.B ).EuclideanNorm();
|
||||||
|
|
||||||
const VECTOR2I& furthest_pt = ( dist_start < dist_end ) ? aSeg.B : aSeg.A;
|
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 );
|
handler.MarkItemModified( aLine );
|
||||||
aLine.SetStart( furthest_pt );
|
aLine.SetStart( furthest_pt );
|
||||||
aLine.SetEnd( *intersection );
|
aLine.SetEnd( new_end );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue