ThinkGeo.com    |     Documentation    |     Premium Support

Zoom in/out Behaviour

I develop an application using VB, Mapsuite 10 for WPF. I have noticed that when I zoom in/out using the mouse wheel I can zoom from Zoomlevel1 to Zoomlevel20 with one scroll. Sites like GoogleMaps and OpenStreetMaps allow the user zoom in/out only two or three zoomlevels with one scroll. Is there a way to implement this behaviour to my WPF map? I want to restrict the user and not allow him to change fast and continuously the zoomlevel.

Hi Marios,

We don’t have an API for it, but I think the code as below can do the same thing:

Timer timer;
bool quickWheelFlag = false;

    private void map_Loaded(object sender, RoutedEventArgs e)
    {
        timer = new Timer(600);
        timer.AutoReset = false;
        timer.Elapsed += Timer_Elapsed;
    .........


  private void ExtentOverlay_MapMouseWheel(object sender, MapMouseWheelInteractiveOverlayEventArgs e)
    {
        if (!quickWheelFlag)
        {
            quickWheelFlag = !quickWheelFlag;
        }
        else
        {
            map.ExtentOverlay.MouseWheelMode = MapMouseWheelMode.Disabled;
        }

        timer.Start();
    }

    private void Timer_Elapsed(object sender, ElapsedEventArgs e)
    {
        map.ExtentOverlay.MouseWheelMode = MapMouseWheelMode.Zooming;
        quickWheelFlag = false;
    }

You can also modify it to suitable your scenario.

Regards,

Ethan