I should add to the above code:

var G = google.maps; // global
// Sorry, I can't be bothered typing "google.maps." every time. ;-)


--
Marcelo - http://maps.forum.nu
--



On Dec 10, 7:17 am, Marcelo <marcelo...@hotmail.com> wrote:
> What is your definition of "the pegman has been dropped onto the
> map"?
> When the user moves the pegman from one position to another, it is
> also "dropped on the map", but does that count, or is it only the
> first drop that you're looking for?
>
> If visible_changed doesn't suit your purposes then perhaps you can use
> pano_changed and check getPosition() in the event handler. If you only
> want to act on the first drop you can make "position" a global
> variable and compare it to the last position in the event handler, for
> example
>
> var position; //global
> var lastPosition = null; //global
> // ...
>
> var svp = new G.StreetViewPanorama(svpContainer,svpOptions);
>
> G.event.addListener(svp, 'pano_changed', function(){
>   position = svp.getPosition();
>   if (typeof position != 'undefined') {
>     //pegman has been dropped on a valid position
>     if (lastPosition) {
>       // This is not the first drop. Do noting.
>     }
>     else {
>       // This is the first drop.
>       // add whatever action you want to take on the first drop
>     }
>     lastPosition = position;
>   }
>   else {
>     lastPosition = null;
>   }
>
> });
>
> --
> Marcelo -http://maps.forum.nu
> --
>
> On Dec 10, 6:33 am, spiderplant0 <spiderpla...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Here's a fork of the code I'm using to prototype...
> > jsfiddle.net/spiderplant0/fubNj/
> > This should help you understand the issues with visibility_changed
> > etc.
> > The question is pretty simple: Detect if, and only if, the pegman has
> > been dropped onto the map.
> > Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to