Ah sorry, pasted incorrect code...
It is listening for "click" and works fine. It displays the street
clicked on in a seperate DIV or I can put the DIV above the map.
function initialize() {
if (GBrowserIsCompatible()) {
var myPano = new GStreetviewPanorama(document.getElementById
("pano"));
GEvent.addListener(myPano, "error", handleNoFlash);
map = new GMap2(document.getElementById("map"));
usePointFromPostcode(post, setCenterToPoint);
map.setCenter(new GLatLng(point), 14);
map.addControl(new GMapTypeControl());
map.addControl(new GSmallMapControl());
svOverlay = new GStreetviewOverlay();
map.addOverlay(svOverlay);
GEvent.addListener(map,"click", function(overlay, latlng) {
myPano.setLocationAndPOV(latlng);
});
}
}
This all works.
1. Now if I want this to trigger without a click on the map and just
to use the base from map, i.e. not "click". I'm struggling to have it
auto execute .
or
2. They click on the road and bring up the street view. Now if I want
to have a button to remove the street view, how do I reset it ?
Thanks and sorry for the mistake in code supplying.
Markus
On Apr 20, 10:52 am, Andrew Leach <[email protected]>
wrote:
> On Apr 20, 10:21 am, "[email protected]" <[email protected]>
> wrote:
>
> > Hi.
>
> > Thanks for you rapid response.
>
> > This question is more related to how the trigger of this part is
> > executed automatically:
>
> > /* ISSUE IS HERE */
> > GEvent.addListener(map, function(overlay, latlng) {
> > myPano.setLocationAndPOV(latlng);
> > });
> > }
> > }
>
> What is that listener listening for? GEvent.addListener needs three
> parameters: the clicked object, the event listened for, and a handler
> function.
>
> You will also need to handle a click on an overlay, because in that
> case latlng will be null and the next line will fail.
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---