WPF Touch to Zoom and Pan

Topics: WPF
Aug 25, 2011 at 5:27 AM

Hi guys, I'm new at this so bear with me.

I included GMap.NET into my project. In this project, I have a GMapControl object on my user interface that displays the map. I subsequently use <GMapControl variable name>_ManipulationDelta() event to update the <GMapControl variable name>.Position. And this works fine for touch to pan. Zoom has interesting behaviour, as follows.

I noticed that <GMapControl variable name>.Zoom is of type 'double'. Therefore, I used the same ManipulationDelta to get the pinch to zoom. Subsequently, I did:

Map.Zoom += mRelativeDelta.Scale.X - 1;      to zoom in

or

Map.Zoom -= 1 - mRelativeDelta.Scale.Y;        to zoom out

 

And the zoom works fine on its on too. However, when I combine the Pan and Zoom behaviour together, some funky behaviour is observed. The zooming action attempts to pan at the same time. And subsequently, having zoomed in/out, the pan action is finicky and attempts to pan in opposite directions. This behaviour is eliminated when i use discrete values of type 'int' for Map.Zoom instead of type 'double'.

Does anyone know what is causing this behaviour in GMapControl.cs?

Why does the zoom value need to be rounded to an integer?

Coordinator
Aug 30, 2011 at 5:30 PM

can't test panning, sorry