MAPQuest 禁用双击行为
MAPQuest Disabling DoubleClick Behaviour
我正在使用现有的 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指南linkAPI Guide LINK
创建一个选项对象,设置您想要的值,然后将其传递给
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);
我正在使用现有的 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指南linkAPI Guide LINK
创建一个选项对象,设置您想要的值,然后将其传递给
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);