mathplot: fix freeze in scale ticks calculation
This commit is contained in:
parent
36297f84c3
commit
f4033f776f
|
@ -1005,7 +1005,10 @@ void mpScaleY::recalculateTicks ( wxDC & dc, mpWindow & w )
|
||||||
double zeroOffset = 100000000.0;
|
double zeroOffset = 100000000.0;
|
||||||
//printf("maxVVis %.3f\n", maxVvis);
|
//printf("maxVVis %.3f\n", maxVvis);
|
||||||
|
|
||||||
while ( v < maxVvis )
|
const int iterLimit = 1000;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while ( v < maxVvis && i < iterLimit)
|
||||||
{
|
{
|
||||||
m_tickValues.push_back(v);
|
m_tickValues.push_back(v);
|
||||||
|
|
||||||
|
@ -1016,6 +1019,12 @@ void mpScaleY::recalculateTicks ( wxDC & dc, mpWindow & w )
|
||||||
v+=bestStep;
|
v+=bestStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// something weird happened...
|
||||||
|
if ( i == iterLimit )
|
||||||
|
{
|
||||||
|
m_tickValues.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if ( zeroOffset <= bestStep )
|
if ( zeroOffset <= bestStep )
|
||||||
{
|
{
|
||||||
for( double& t: m_tickValues )
|
for( double& t: m_tickValues )
|
||||||
|
@ -3625,4 +3634,3 @@ double mpFXY::y2s(double y) const
|
||||||
{
|
{
|
||||||
return m_scaleY->TransformToPlot( y );
|
return m_scaleY->TransformToPlot( y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue