Wow, thanks!

I sense that either javascript's or google maps's event management is
not very sophisticated yet.  You just saved me a BUNCH of time, so
thank you very much indeed.

   -- Owen


On Oct 3, 11:13 pm, marcelo <[EMAIL PROTECTED]> wrote:
> Upon a double click, the API will still fire two single clicks, so
> what I do is to use only the single click event and separate single
> from double clicks with a setTimeout, like this:
>
> // Global variable
> var clckTimeOut = null;
>
> // Only single click listener
> GEvent.addListener(map,'click',mapClick);
>
> function mapClick(ol,latlon,olLatlon) {
>         if (clckTimeOut) {
>                 window.clearTimeout(clckTimeOut);
>                 clckTimeOut = null;
>                 doubleClick(ol,latlon);
>         }
>         else {
>                 clckTimeOut = window.setTimeout(function()
> {singleClick(ol,latlon,olLatlon)},500);
>         }
>
> }
>
> function doubleClick(ol,latlon,olLatlon) {
>         // Process double click
>
> }
>
> function singleClick(ol,latlon,olLatlon) {
>         window.clearTimeout(clckTimeOut);
>         clckTimeOut = null;
>         // Process single click
>
> }
>
> Working example:http://maps.forum.nu/gm_main.html
>
> --
> Marcelo -http://maps.forum.nu
> --
--~--~---------~--~----~------------~-------~--~----~
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