Does the Google Maps API V3 support the Touch event?

We are experiencing a problem with GoogleMaps. The problem is mainly related to touch screens. We tried to solve the problem, but so far failed.

We found in this article that the Google V3 Maps API does not support touch events? Is this true or false?

UPDATE

This problem was fixed in error.

https://issuetracker.google.com/issues/35824421

and was resolved in version 3.27 of the Google Maps JavaScript API in December 2016.

+4
source share
2 answers

In my experience, the events mousedown , mouseup , dragstart , dragend work fine instead of touchstart , touchmove , touchend .

 google.maps.event.addListener(myMap, "mousedown", function(event){...}); 

I am sure that gesture events gesture not be supported, as they are used for zoom functions.

If you need gestures, you will need to create your own recognizer by tracking mousedown events, storing them in an array, then tracking positions to determine angles, distances, etc.

+13
source

They are not currently supported. See here for an interactive map that shows demos of currently available events:

https://developers.google.com/maps/documentation/javascript/events#EventsOverview

This page also indicates that:

For a complete list of events, see the JavaScript API for Google Maps. Directory.

Event related events are not available on this page, therefore they are not supported.

Commenting on the accepted answer, the supported events are not strictly equivalent (touching is clearly semantically different from a mouse click), and in my experience the results may be variable (for example, in some cases, touching may trigger the onclick event on Google maps, and in some cases it may cause the mouseover event to fire), therefore, to reliably control this type of occurrence, when you "borrow" these events to detect a touch, some error processing may be required.

Here is a good article on handling touch by the listener:

https://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwiwm6y38dXXAhWHVbwKHRdUCY4QFggmMAA&url=https%3A%2F%2on% df2 way-to-detect-touch-with-javascript-7791a3346685 & usg = AOvVaw3pWv0R_AESWKqwF72D0hix

0
source

All Articles