【OpenLayers】ol3设置地图可拖动、禁止拖动


let pan = getPan();
pan.setActive(false);//false:当前地图不可拖动。true:可拖动

function getFun() {
    let pan;
    map.getInteractions().forEach(function(element, index, array) {
        if(element instanceof ol.interaction.DragPan) {
            pan = element;
        }
    })
    return pan;
}

转载自:https://blog.csdn.net/IT429/article/details/74727153

You may also like...