Google maps V3 JS no happen “center_changed” from UIWebView iOS6(iPhone)

拜拜、爱过 提交于 2019-12-05 07:47:04

This is something that doesn't work on google maps on IOS devices. The center_changed is fired when the map is dragged but the center does not update until the drag is complete. So the answer is, 'no', you can not do this.

It sounds like you want the drag event, not center_changed. From the Google Maps Javascript API V3 Reference:

drag: this event is repeatedly fired while the user drags the map.

Something like this:

google.maps.event.addListener(map, 'drag', function(){
    var mce = map.getCenter();
    moveCenterLat = mce.lat();
    moveCenterLng = mce.lng();
});

Edit: It seems the map bounds are no longer updated while dragging, so although the drag event does fire while the map is being dragged, both getCenter() returns the coordinates of the map when the drag started. Thanks to @Zubair for pointing this out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!