2016-05-20 76 views
0

我正在使用現有的MapQuest地圖,並且必須實現我必須限制用戶雙擊並縮放地圖的功能,從API文檔我可以看到的選項僅用於禁用,但沒有代碼片段。MAPQuest禁用DoubleClick行爲

window.map = new MQA.TileMap(document.getElementById('map'), 2, null, 'map'); 

,這是以前的實現, 我已經編輯並添加以下選項,它不工作,

window.map = new MQA.TileMap(document.getElementById('map'), 2, null, 'map', {zoomOnDoubleClick: false}); 

低於行我已經加入,, {zoomOnDoubleClick:假}``

這裏是API指南鏈接API Guide LINK

回答

1

創建一個選項對象,設置你想要的值,然後通過

var options = { 
    elt: document.getElementById('map'),  // ID of map element on page 
    zoom: 10,         // initial zoom level of the map 
    latLng: { lat: 39.7439, lng: -105.0200 }, // center of map in latitude/longitude 
    mtype: 'map',        // map type (map, sat, hyb); defaults to map 
    bestFitMargin: 0,       // margin offset from map viewport when applying a bestfit on shapes 
    zoomOnDoubleClick: false     // disable map from zooming in when double-clicking 
}; 

// construct an instance of MQA.TileMap with the options object 
window.map = new MQA.TileMap(options); 
+0

謝謝.. @Anthony ..兩天前MapQuest的支持確實給我提供了這個解決方案。 – DareDevil