Skip to content
This repository was archived by the owner on Jul 4, 2024. It is now read-only.
This repository was archived by the owner on Jul 4, 2024. It is now read-only.

Interactive Data display in KeyboardNavigation #39

Description

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;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions