Here is a small hack to make the reset button works on v3. I use jQuery here.
var attachEventToResetButton;
// Attach event to the reset button
var attachResetEvent = function(){
var $resetImg = $('img[src*=mapcontrols3d6.png]');
// We have to check if the image is available yet.
// The reason is although the map has been loaded, the navigation might
// take some time to load and we don't know when it will be fully loaded.
// There doesn't seem to have an event for "Navigation loaded" in the API
// So here is a way to work around
if ($resetImg.length > 0)
{
$resetImg.css('cursor', 'pointer').attr('title', 'Return to center').click(function(){
alert('Clicked on reset button');
// Put your code to reset the map here. For example:
//map.setMapTypeId(MAP_TYPE_ID);
//map.setCenter(new google.maps.LatLng(LAT, LNG));
//map.setZoom(ZOOM_LEVEL);
});
window.clearInterval(attachEventToResetButton);
}
}
// Periodically checking to attach event to the reset button
attachEventToResetButton = window.setInterval(attachResetEvent, 500);
What I did was, I notice that the reset image filename is 'mapcontrols3d6.png'. So I set an interval to check if that image has been loaded (ie. available) yet. If yes, I attach a function into it.
As this is a hack, it has some issue. The main one is we have to rely on the reset image file name. So finger cross that Google won't update this.
Does anyone have any better way?