admin管理员组文章数量:1397065
I have discovered how to remove the controls for panning and zooming. I also found the property to stop zooming in on mouse clicks. How can I prevent the user from panning the map with the mouse?
I have discovered how to remove the controls for panning and zooming. I also found the property to stop zooming in on mouse clicks. How can I prevent the user from panning the map with the mouse?
Share Improve this question edited May 12, 2014 at 21:24 Timigen asked May 12, 2014 at 21:13 TimigenTimigen 1,0261 gold badge17 silver badges33 bronze badges 1- 1 How do you remove the controls for panning and zooming? – TheoretiCAL Commented Oct 21, 2015 at 19:55
2 Answers
Reset to default 7You should set map.dragMap = false;
Here is an example of map instantiation expanded with all options related to the functionality mentioned in the question, both the ones already found and the one OP asked for. The option that answers the question is "dragMap": false
:
var map = AmCharts.makeChart("chartdiv", {
"type": "map",
"theme": "light",
"dataProvider": {
"map": "worldLow",
"getAreasFromMap": true
},
"dragMap": false, // disables map dragging/panning
"zoomOnDoubleClick": false, // disables zoom on double click
"zoomControl": {
"zoomControlEnabled": false, // disables +/- zoom control
"panControlEnabled": false // disables pan controls (default)
},
"areasSettings": {
"autoZoom": false, // disables zoom when click on area
"selectable": true // determines whether an area is selectable - i.e. clicking on an area/country changes its color
}
});
本文标签: javascriptdisable panning on map with mouseStack Overflow
版权声明:本文标题:javascript - disable panning on map with mouse - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744104638a2591009.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论