Thanks, but this doesn't work for me: it fires on single clicks and simply waits for 500ms before firing doSomethingUseful.
I really need a 'taphold' event: i.e. only fires if the user clicks the map *and deliberately holds* it for 500ms. That way, you can be certain the user hasn't just touched the map while moving the phone between hands - they really mean to fire the event. I think this would be a really useful event for Google Maps. Any ideas, anyone? On Jun 10, 12:29 am, Esa <[email protected]> wrote: > On Jun 8, 8:34 pm, Anna PS <[email protected]> wrote: > > >Long-clickseems like a very handy event for mobile users > > Absolutely. I been doing it with something like: > > google.maps.event.addListener(map, 'mousedown', function(){ > clearTimeout(map.pressButtonTimer); > map.pressButtonTimer = setTimeout(function(){ > doSomethingUseful(); > }, 500); > }); > > clearTimeout() is essential. Note that you can often see 'if()' > statement with clearTimeout but that is not needed by Ecma standard. > > map.pressButtonTimer is a variable name, not any API property. -- 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 [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-js-api-v3?hl=en.
