From 082bbd49e7167cbefc8a9e9b61683b6999401fbd Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 26 Mar 2019 06:47:31 -0700 Subject: [PATCH] sim: Prevent stepping Introduced by 416e64a33419cc33c8cd37dbd1e1155bb0b6efc5. 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 commit c1c4a0925d04144fc895ddc2a42ebbd165c4a9e1) --- common/widgets/mathplot.cpp | 50 +++++-------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index 51d342f7db..643c329ca2 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -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; } }