Don't reset cursor x position during a sim refresh.
The sim may not be complete yet. And even if it is, the user didn't ask us to move their cursor. Just leave it where it is with an undefined y value. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15672
This commit is contained in:
parent
ef92429ac2
commit
e5bce16e31
|
@ -283,17 +283,13 @@ void CURSOR::doSetCoordX( double aValue )
|
|||
int minIdx = maxIdx - 1;
|
||||
|
||||
// Out of bounds checks
|
||||
if( minIdx < 0 )
|
||||
if( minIdx < 0 || maxIdx >= (int) dataX.size() )
|
||||
{
|
||||
minIdx = 0;
|
||||
maxIdx = 1;
|
||||
m_coords.x = dataX[0];
|
||||
}
|
||||
else if( maxIdx >= (int) dataX.size() )
|
||||
{
|
||||
maxIdx = dataX.size() - 1;
|
||||
minIdx = maxIdx - 1;
|
||||
m_coords.x = dataX[maxIdx];
|
||||
// Simulation may not be complete yet, or we may have a cursor off the beginning or end
|
||||
// of the data. Either way, that's where the user put it. Don't second guess them; just
|
||||
// leave its y value undefined.
|
||||
m_coords.y = NAN;
|
||||
return;
|
||||
}
|
||||
|
||||
const double leftX = dataX[minIdx];
|
||||
|
|
|
@ -2438,7 +2438,7 @@ void SIMULATOR_FRAME_UI::updatePlotCursors()
|
|||
auto formatValue =
|
||||
[this]( double aValue, int aCursorId, int aCol ) -> wxString
|
||||
{
|
||||
if( !m_simulatorFrame->SimFinished() && aCol == 1 )
|
||||
if( ( !m_simulatorFrame->SimFinished() && aCol == 1 ) || std::isnan( aValue ) )
|
||||
return wxS( "--" );
|
||||
else
|
||||
return SPICE_VALUE( aValue ).ToString( m_cursorFormats[ aCursorId ][ aCol ] );
|
||||
|
|
Loading…
Reference in New Issue