I read the source code KeyboardNavigation.cs in InteractiveDataDisplay.WPF . i just don't no why need
IsZoomEnable(rect)
to check before setting the zooming.
private void DoZoom(double factor) { if (masterPlot != null) { var rect = masterPlot.PlotRect;
if (IsHorizontalNavigationEnabled)
rect.X = rect.X.Zoom(factor);
if (IsVerticalNavigationEnabled)
rect.Y = rect.Y.Zoom(factor);
if (IsZoomEnable(rect))// why need this check?
{
masterPlot.SetPlotRect(rect);
masterPlot.IsAutoFitEnabled = false;
}
}
}
private bool IsZoomEnable(DataRect rect)
{
bool res = true;
if (IsHorizontalNavigationEnabled)
{
double e_max = Math.Log(Math.Max(Math.Abs(rect.XMax), Math.Abs(rect.XMin)), 2);
double log = Math.Log(rect.Width, 2);
res = log > e_max - 40;
}
if (IsVerticalNavigationEnabled)
{
double e_max = Math.Log(Math.Max(Math.Abs(rect.YMax), Math.Abs(rect.YMin)), 2);
double log = Math.Log(rect.Height, 2);
res = res && log > e_max - 40;
}
return res;
}