sim: Prevent stepping
Introduced by416e64a334
. 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 (cherry picked from commitc1c4a0925d
)
This commit is contained in:
parent
4e2e69c9cb
commit
082bbd49e7
|
@ -699,9 +699,6 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
|
||||||
wxCoord x0, y0;
|
wxCoord x0, y0;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
wxCoord minY, maxY;
|
|
||||||
bool minFirst = true;
|
|
||||||
|
|
||||||
while( GetNextXY( x, y ) )
|
while( GetNextXY( x, y ) )
|
||||||
{
|
{
|
||||||
double px = m_scaleX->TransformToPlot( x );
|
double px = m_scaleX->TransformToPlot( x );
|
||||||
|
@ -713,58 +710,23 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
|
||||||
if( first )
|
if( first )
|
||||||
{
|
{
|
||||||
first = false;
|
first = false;
|
||||||
x0 = x1; y0 = y1;
|
x0 = x1;
|
||||||
minY = y1;
|
y0 = y1;
|
||||||
maxY = y1;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( x0 == x1 ) // continue until a new X coordinate is reached
|
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;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
wxCoord firstY = minFirst ? minY : maxY;
|
bool outDown = ( y0 > maxYpx ) && ( y1 > maxYpx );
|
||||||
wxCoord secondY = minFirst ? maxY : minY;
|
bool outUp = ( y0 < minYpx ) && ( y1 < minYpx );
|
||||||
|
|
||||||
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 outLeft = ( x1 < startPx ) && ( x0 < startPx );
|
bool outLeft = ( x1 < startPx ) && ( x0 < startPx );
|
||||||
bool outRight = ( x1 > endPx ) && ( x0 > endPx );
|
bool outRight = ( x1 > endPx ) && ( x0 > endPx );
|
||||||
if( !( outUp || outDown || outLeft || outRight ) )
|
if( !( outUp || outDown || outLeft || outRight ) )
|
||||||
{
|
dc.DrawLine( x0, y0, x1, y1 );
|
||||||
dc.DrawLine( x0, firstY, x1, secondY );
|
|
||||||
// UpdateViewBoundary(x1, secondY);
|
|
||||||
}
|
|
||||||
|
|
||||||
x0 = x1;
|
x0 = x1;
|
||||||
y0 = secondY;
|
y0 = y1;
|
||||||
minY = y1;
|
|
||||||
maxY = y1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue