我正在处理现有的MapQuest映射,我必须实现这样的功能,即限制用户双击和缩放地图,从API文档中我可以看到只能禁用的选项,但没有代码片段。
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: false}
下面是API指南链接API指南链接
发布于 2016-05-24 18:46:09
创建options对象,设置所需的值,然后将其传入
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);https://stackoverflow.com/questions/37348593
复制相似问题