Javascript 谷歌地图&x27;无法禁用信息窗口自动平移

Javascript 谷歌地图&x27;无法禁用信息窗口自动平移,javascript,google-maps,Javascript,Google Maps,我有一个按钮,可以在谷歌地图上添加一个信息窗口,但是disableAutoPan属性似乎被忽略了 var map; function initialiseMap() { map = new google.maps.Map(document.getElementById('mapCanvas'), { zoom: 9 }); var currentIndicator = new google.maps.InfoWindow({ map: m

我有一个按钮,可以在谷歌地图上添加一个信息窗口,但是
disableAutoPan
属性似乎被忽略了

var map;
function initialiseMap() {
    map = new google.maps.Map(document.getElementById('mapCanvas'), {
        zoom: 9
    });

    var currentIndicator = new google.maps.InfoWindow({
        map: map,
        position: new google.maps.LatLng(53.8526, -2.7454),
        content: "Start location"
    });
    map.setCenter(currentIndicator.position);
}

function plotMyLocation() {
    var pos = new google.maps.LatLng(53.05, -1.25);
    new google.maps.InfoWindow({
        map: map,
        position: pos,
        content: "My Location",
        disableAutoPan: true
    });
}

google.maps.event.addDomListener(window, 'load', initialiseMap);
调用
plotMyLocation
函数时,无论
disableAutoPan
属性的值如何,贴图始终平移以显示新添加的信息窗口的位置

上的示例演示了这个问题


我做错了什么,阻止了自动平移功能的禁用?

您可以使用选项列表而不使用
map
并调用函数
open(map)

来自谷歌文档:除非禁用自动平移,否则信息窗口将平移地图,使其在打开时可见。构建信息窗口后,必须调用open以在地图上显示它


您在选项列表中提供了map属性,但没有文档记录。

Crackin'stuff!干杯,伙计!
function plotMyLocation() {
    var pos = new google.maps.LatLng(53.05, -1.25);
    var infowindow = new google.maps.InfoWindow({
        //map: map,
        position: pos,
        content: "My Location",
        disableAutoPan: true
    });

    infowindow.open(map);
}