Your assumption (listening to the event of clicking on the map and checking its purpose) sounds correct, since there is no implementation for accessing the controls.
This works for me (now):
google.maps.event.addDomListener(map.getDiv(),'click',
function(e)
{
var t=e.target,
a=[null,'left','right','up','down'];
if(
t.parentNode.parentNode.hasAttribute('controlwidth')
&&
t.parentNode.childNodes.length==5
&&
t.parentNode.firstChild.tagName=='IMG'
&&
t.parentNode.firstChild.src
=="http://maps.gstatic.com/mapfiles/mapcontrols3d7.png"
)
{
for(var i=1;i<t.parentNode.childNodes.length;++i)
{
if(t.parentNode.childNodes[i]==t)
{
alert('You\'ve clicked on \n>>>'+a[i]+
'\nyou may call a function now.');
}
}
}
});
http://jsfiddle.net/doktormolle/fwgMy/
But it only works until Google changes the markup, and that may be tomorrow.
The best approach would be to hide the panorama and create your own control.
source
share