On Nov 12, 3:27 pm, Greg45 <
gre...@gmail.com> wrote:
> somebody can help me please?
If you mean a back button like v2 "Return to last result", it goes
something like this. Push the map state into an array after each
movement. The problem is to find the right event for that. 'idle' is
triggered too often for the purpose. I quickly tried with
'tilesloaded' and that works better.
var status = [];
google.maps.event.addListener(map, 'tilesloaded', function(){
var current = {};
current.center = map.getCenter();
current.zoom = map.getZoom();
current.mapTypeId = map.getMapTypeId();
status.push(current);
});
To go back to the previous state, take the last entry from the array
by pop():
function back(){
map.setOptions(status.pop());
}
with a html button:
<button onclick="back();">Back</button>