Browse Source

Fix broken label position algorithm in Eagle schematic importer.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20593
revert-0c36e162
Wayne Stambaugh 6 months ago
parent
commit
aa1dbcba34
  1. 8
      eeschema/sch_io/eagle/sch_io_eagle.cpp

8
eeschema/sch_io/eagle/sch_io_eagle.cpp

@ -1674,13 +1674,13 @@ SCH_IO_EAGLE::findNearestLinePoint( const VECTOR2I& aPoint,
VECTOR2I nearestPoint;
const SEG* nearestLine = nullptr;
float d, mindistance = std::numeric_limits<float>::max();
double d, mindistance = std::numeric_limits<double>::max();
// Find the nearest start, middle or end of a line from the list of lines.
for( const SEG& line : aLines )
{
VECTOR2I testpoint = line.A;
d = sqrt( abs( ( ( aPoint.x - testpoint.x ) ^ 2 ) + ( ( aPoint.y - testpoint.y ) ^ 2 ) ) );
d = aPoint.Distance( testpoint );
if( d < mindistance )
{
@ -1690,7 +1690,7 @@ SCH_IO_EAGLE::findNearestLinePoint( const VECTOR2I& aPoint,
}
testpoint = line.Center();
d = sqrt( abs( ( ( aPoint.x - testpoint.x ) ^ 2 ) + ( ( aPoint.y - testpoint.y ) ^ 2 ) ) );
d = aPoint.Distance( testpoint );
if( d < mindistance )
{
@ -1700,7 +1700,7 @@ SCH_IO_EAGLE::findNearestLinePoint( const VECTOR2I& aPoint,
}
testpoint = line.B;
d = sqrt( abs( ( ( aPoint.x - testpoint.x ) ^ 2 ) + ( ( aPoint.y - testpoint.y ) ^ 2 ) ) );
d = aPoint.Distance( testpoint );
if( d < mindistance )
{

Loading…
Cancel
Save