On Jan 30, 5:13 pm, kuba <[email protected]> wrote:
> I'm looking for a way to pan the map as it's doing now, but over a
> much greater distance - from one side of London to the other for
> example - without the tiles redrawing when it's panning.
What do you mean by "without the tiles redrawing"?
If you pan to an area which is far away from the start area, then the
panning will not be animated, but a sudden jump.
If you want to keep it smooth, you'd have to do it in stages, of less
than one map width/height each time, using window.setTimeout() or
another mechanism that detects when each step is completed, for
example
// WARNING - NOT FULLY TESTED - RUN AT YOUR OWN RISK !!!
function longPan(times,target) {
if (times < 0) {
return;
}
var center = map.getCenter();
if (center.lng().toFixed(6) != target.lng().toFixed(6)) {
window.setTimeout(function(){longPan(times,target)},10);
return;
}
var cont = map.getContainer();
wPx = cont.clientWidth * 0.05;
centerPx = map.fromLatLngToDivPixel(center);
var targetPx = new GPoint(centerPx.x - wPx,centerPx.y);
var target = map.fromDivPixelToLatLng(targetPx);
map.panTo(target);
times--;
window.setTimeout(function(){longPan(times,target)},10);
}
// Call the above function with
longPan(100,map.getCenter());
You'll need to make your var map global. Right now, it is local.
You can play with it and try to find optimal vaues for the
'step' (0.05) and the number of times the move is repeated (100)
And BTW, have a look at your page with Firefox! ;-)
--
Marcelo - http://maps.forum.nu
--
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---