Check border changes in google map by touch event, in real time

I want to check border changes in a Google map using the Touch event. In particular, I want to create some system, if I touch the screen displaying the google map and change the borders, send something may point a new map to the server. Organize this system. The first time I used the bound_changed event. as below

google.maps.event.addListener(map, 'bounds_changed', (function () {
    var bar=map.getCenter()
    socket.emit('center_spe', bar);
}));

It works on my laptop! if i dragged the map with the mouse, send the google map variable in real time. but if I use a touch device, google map will send a “bar” when my touch is over.

Of course, I checked the list of events in the Google Maps developer link and I understand that there is no touch event event. like touchmove, touchstart etc. ( https://developers.google.com/maps/documentation/javascript/reference?hl=ko#Map )

Can magic make me check related changes in real time when I use a touch device? as shown below.

google.maps.event.addListener(map,"touchmove",function(event) { 
    var bar=event.latLng;
    socket.emit('message', bar);
}); 

(of course, in the Google map event there is no touch event, the above code does not work)

+3
source share
1 answer

Google Maps V3 API Events google.maps.Map Demo, , , , . . , bounds_changed, dragend events. , dragend. , :

google.maps.event.addListener(map, 'dragend', function(){
    console.log('drag ended');
});

- . bounds_changed, dragend-, , , :

google.maps.event.addListener( map, 'bounds_changed', function(e){ console.log('bound changed');} );
google.maps.event.addListener( map, 'dragend', function(){ google.maps.event.trigger(this, 'bounds_changed');} );

bounds_changed , (, ), bounds_changed , , . , dragend , Mobile. ( dragend) .

+1

All Articles