仅在完全缩小时,如何才能在AmCharts地图中禁用平移(拖动)。我尝试使用,chart.seriesContainer.draggable = false;但是它完全禁用了平移,但是我想在放大时能够拖动地图。
1 回答

万千封印
TA贡献1891条经验 获得超3个赞
您可以通过属性调整地图互动行为,并通过事件监视地图何时更改,例如:MapChart.panBehaviorzoomLevel"zoomlevelchanged"
chart.panBehavior = "none";
chart.events.on("zoomlevelchanged", function(){
// queue event loop so a final zoomlevelchanged can be "cauight"
setTimeout(
function() {
if (chart.zoomLevel <= 1) {
chart.panBehavior = "none";
} else if (chart.zoomLevel > 1) {
chart.panBehavior = "move";
}
}, 0);
});
这是一个演示:
https://codepen.io/team/amcharts/pen/8d767bd62c8cb238ecb633e2123317ed
添加回答
举报
0/150
提交
取消