Hi Andrew,

I need the double click functionality too (for the polylines but it's
the same discussion). I thought of the scheme you suggested too and
tried to implement it but it does not seem to work. What happens is,
in the first click it is possible to catch the click on the polygon
and get the time and location of the click. But if the user clicks
again and it is (rightly) interpreted as a double click. The second
click event is not fired on the polygon (or polyline) because now the
event is a double click, which means the double click event is created
and is handled by the map (which zooms in in my case).

Weirdly as the polyline handles the first click and there is no way to
know if that's a single click or double click on the polyline level,
my polyline responds to the click event and the map responds to the
double click event which results in an infowindow being displayed (in
my case) on the polyline and map zooming in.

Am I missing sth? Is there any other simple way to implement double
click on the polylines and also to get rid of the weird behaviour I
described?

Thanks,
Ozgur

On Sep 10, 11:49 am, Andrew Leach <[email protected]>
wrote:
> On Sep 10, 3:55 pm, EB <[email protected]> wrote:
>
> > How do I create a marker in a polygon.  Anytime I mouse over the
> > polygon to create the marker, polygon gets the focus and click for a
> > marker doesn't generate any event.
>
> Actually it does. A click on the polygon generates a click event on
> the polygon (are you listening for that?) and then a click on the map
> but passing the overlay, not the latlng (are you just expecting a
> latlng?)
>
> To get the map to respond to a click on the overlay, add a listener to
> the polygon and trigger a click on the map passing the latlng.
>
> > Also is there
> > a way to get a double click event on the polygon/polyline.  When a
> > double click on the polygon happens, I want to initiate an AJAX call
> > to retrieve some data.
>
> There's no documented double-click event on polygons, although you may
> find an undocumented one works. If not, you need to imitate one by
> using the click event and a timeout.
>
> On click, check to see if the singleclick flag is set.
> - If it is not, set a singleclick flag and set a timeout to run the
> singleclick code after 300ms (or whatever value)
> - If it is set, this must be a double-click. Clear the timeout and run
> the doubleclick code.
> The single-click code must clear the flag. Because functions executed
> by setTimeout operate in global scope, the flag and other variables
> must be global too.
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to