Touch and center zoom like with MouseWheel

Topics: WPF
Jan 18, 2012 at 6:19 PM

Hi,

We are testing your very interesting API on multitouch devices. We added pan with one finger, but we have some problems for zooming with several fingers.

I look at the method called OnMouseWheel in GMapControl and I perform the same code below when I put 2 or 3 fingers in touch callback :

// Set current position
Core.currentPosition = FromLocalToLatLng((int)scaleCenterPoint.X, (int)scaleCenterPoint.Y);

// Save last scale center
Core.mouseLastZoom.X = (int)scaleCenterPoint.X;
Core.mouseLastZoom.Y = (int)scaleCenterPoint.Y;

Core.MouseWheelZooming = true;

Zoom = myScaleFactor;

Core.MouseWheelZooming = false;


This code works very well when I perform a test from button click with a scale center and a scale factor as examples.

But when I test this code in touch callback (manipulations API), it does'nt work : I don't have a center scale like MousePositionWithoutCenter (Bing or Google Maps like).

Do you have any idea to solve our problems ?

Thanks,

Thitony


Jan 18, 2012 at 8:16 PM

it's complicated... and i don't have touch device, maybe in the next life when economy will be operational ;}

Jan 18, 2012 at 8:42 PM

;}

you have no idea where the problem might come ?

It is strange that it works well when I apply the position and zoom through a click of a button but not when I applied successively ... I still tried to apply the new zoom and offset only every 50 milliseconds, but it makes no difference ...

You can simulate touch devices with the simulator provided by Microsoft Surface 2 SDK (http://www.microsoft.com/download/en/details.aspx?id=26716)

Jan 18, 2012 at 8:49 PM

hm.. i might try, thanks