如何在AMCHART5的地图图表上禁用Zoom和Pan5
我之前曾使用过Amchart4地图,并且刚刚切换到Amchart5地图。我知道有一个关于在Amchart4的地图图表上禁用Zoom和Pan,但我找不到有关Amchart5的任何内容。
因此,我尝试将相同的概念应用于Amchart5,并且仅适用于 Zoom
。我可以使用此代码禁用Amchart5中的地图Zoom:
var map = root.container.children.push(am5map.MapChart.new(root, {
panX: "none",
projection: am5map.geoMercator(),
maxZoomLevel: 1,
draggable: false,
resizeable: false
})
);
如上所述,我还添加了 draggable:false
and 可重复:false
,但没有工作。
是否有任何解决方案可以禁用可拖动和可重新固定的地图?感谢您的帮助。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我自己的问题,但是在我对上述代码进行了一些测试并找到了正确的解决方案之后,我想在答案中分享它。
问题的解决方案是通过添加
panx:无
是禁用水平拖动和pany:无
是禁用verticle拖动。draggable:false
和可重复:false
不再在amchart5中应用。It is my own question, but after I did some testing on the mentioned code above and found the right solution, so I would like to share it here in the answer.
The solution to the question is just by adding
So the
panX: none
is to disable the horizontal drag andpanY: none
is to disable the verticle drag. And thedraggable: false
andresizeable: false
are no longer applied in amChart5 anymore.