我可以使用setZoomAround,但是如何取消onZoom事件中的默认操作?
如果查看传单代码,您将看到无法禁用缩放事件。但是您可以尝试设置一个标志。
zoomaround = false;
function example(){
zoomaround = true;
map.setZoomAround(latlng,zoom,options);
zoomaround = false; //You have to test if this works, because I think the event calling is async and then this line will not work.
}
map.on('zoomstart',function(e){
if(!zoomaround){
//default code
}
});
map.on('zoomend',function(e){
if(!zoomaround){
//default code
}
zoomaround = false; //Use this line if the line above not working.
});