移动打开的谷歌地图infoWindow

时间:2012-10-22 15:46:11

标签: javascript google-maps latitude-longitude infowindow

我以这种方式创建谷歌地图infoWindow

newMapView.infowindow.setContent(contentString);
newMapView.infowindow.setPosition(catMarker.getPosition());
newMapView.infowindow.open(newMapView.map);

但需要将地图中心移动一点点。尝试做类似的事情:

setTimeout(function(){
    var point = map.getCenter();
    point.Xa = point.Xa+1/1000;
    map.setCenter(new google.maps.LatLng(point.Xa,point.Ya));
},1000);

需要超时才能知道哪个窗口已经oppenen并移动到中心。

但是这种方法在某些情况下不能正常工作,并且使用超时并不是我理解的好解决方案。

有没有办法将marken放在一个地方,但将中心移到另一个地方?

0 个答案:

没有答案
相关问题