sim: Prevent stepping

Introduced by 416e64a334.  The code
appears to have been stepped on purpose but this would be incorrect for
most applications.  There remains a good deal of cleanup in mathplot
available for the motivated dev.

Fixes: lp:1810311
* https://bugs.launchpad.net/kicad/+bug/1810311
This commit is contained in:
Seth Hillbrand 2019-03-26 06:47:31 -07:00
parent 175a2bc0b4
commit c1c4a0925d
1 changed files with 6 additions and 44 deletions

View File

@ -699,9 +699,6 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
wxCoord x0, y0;
bool first = true;
wxCoord minY, maxY;
bool minFirst = true;
while( GetNextXY( x, y ) )
{
double px = m_scaleX->TransformToPlot( x );
@ -713,58 +710,23 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
if( first )
{
first = false;
x0 = x1; y0 = y1;
minY = y1;
maxY = y1;
x0 = x1;
y0 = y1;
continue;
}
if( x0 == x1 ) // continue until a new X coordinate is reached
{
// determine min and max, so they can also be marked on the plot
if( y1 > maxY )
{
maxY = y1;
minFirst = true;
}
if( y1 < minY )
{
minY = y1;
minFirst = false;
}
continue;
}
wxCoord firstY = minFirst ? minY : maxY;
wxCoord secondY = minFirst ? maxY : minY;
if( ( x0 >= startPx ) && ( x0 <= endPx ) )
{
bool outDown = ( y0 > maxYpx ) && ( firstY > maxYpx );
bool outUp = ( y0 < minYpx ) && ( firstY < minYpx );
if( !outUp && !outDown )
{
dc.DrawLine( x0, y0, x0, firstY );
// UpdateViewBoundary(x1, firstY);
}
}
bool outDown = ( firstY > maxYpx ) && ( secondY > maxYpx );
bool outUp = ( firstY < minYpx ) && ( secondY < minYpx );
bool outDown = ( y0 > maxYpx ) && ( y1 > maxYpx );
bool outUp = ( y0 < minYpx ) && ( y1 < minYpx );
bool outLeft = ( x1 < startPx ) && ( x0 < startPx );
bool outRight = ( x1 > endPx ) && ( x0 > endPx );
if( !( outUp || outDown || outLeft || outRight ) )
{
dc.DrawLine( x0, firstY, x1, secondY );
// UpdateViewBoundary(x1, secondY);
}
dc.DrawLine( x0, y0, x1, y1 );
x0 = x1;
y0 = secondY;
minY = y1;
maxY = y1;
y0 = y1;
}
}