且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google Maps API V3 是否支持触摸事件?

更新时间:2023-02-14 12:51:27

以我的经验,mousedownmouseupdragstartdragend 事件可以很好地代替 touchstarttouchmovetouchend.

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

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

我很确定将不支持 gesture 事件,因为它们用于双指缩放功能.

I'm pretty sure that gesture events are not going to be supported, since those are used for pinch-zoom functionality.

如果您需要手势,则必须通过跟踪鼠标按下事件、将它们存储在数组中、然后跟踪位置以确定角度、距离等来构建自己的识别器...

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