2011-07-23 20 views
0

我正在使用谷歌地图V3,我正在寻找一位听众来捕捉地图的移动(导航),我可以这样做吗?如何在Google地图中捕捉地图运动?

如果是,我该怎么做,怎样才能知道x和y的移动大小?

编辑: 因为我在地图上有一个标记,当我点击标记时div出现在标记的相同位置,但是当我移动地图时,制造商以相同的方式移动,但是DIV仍处于固定位置,如何以相同方式移动div?

回答

1

这些地图事件 '的bounds_changed' 将协助:

neLatLngObject = boundsObject.getNorthEast(); 
swLatLngObject = boundsObject.getSouthWest(); 
// or the center of bounds: 
ctrLatLngObject = boundsObject.getCenter(); 

到:

google.maps.event.addListener(map, 'bounds_changed', function() { 
    // whatsoever..., i.e. 
    boundsObject = map.getBounds(); 
}); 

它返回由两个LatLng对象(NE和SW),其值的范围对象可以像被检索找到两点之间的距离看这里:Calculate distance between two points in google maps V3

相关问题