eeschema: fix mistaken wire removal bug

The wire between two points should not be trimmed if it starts or ends
on one of the component's connection points.
This commit is contained in:
Seth Hillbrand 2018-10-07 14:42:20 -07:00
parent 3024ded91e
commit d2906f7975
1 changed files with 4 additions and 2 deletions

View File

@ -340,12 +340,14 @@ void SCH_EDIT_FRAME::EndSegment()
std::vector< wxPoint > pts;
item->GetConnectionPoints( pts );
std::remove_if( pts.begin(), pts.end(), [ segment ]( const wxPoint& aPt )
{ return segment->IsEndPoint( aPt ); } );
if( pts.size() > 2 )
continue;
// Do not trim wires that connect directly to an endpoint
pts.erase( std::remove_if( pts.begin(), pts.end(), [ &segment ]( const wxPoint& aPt )
{ return segment->IsEndPoint( aPt ); } ), pts.end() );
for( auto i = pts.begin(); i != pts.end(); i++ )
for( auto j = i + 1; j != pts.end(); j++ )
TrimWire( *i, *j, true );