Monday 25 January 2016

cartography - Zoom out grayed out in ArcGIS API for JavaScript?


I'm using ArcGIS API for JavaScript 3.13


The zoom out slide button is grayed out, however it works when clicked. Does anybody know how to make it not grayed out?


enter image description here


My map initialization code looks like this:


esri.config.defaults.map.zoomDuration = 0;  
esri.config.defaults.map.zoomRate = 0;
_map = new Map("myMap", {
center: [-100, 48],
zoom: 3,

basemap: "streets",
minZoom: 3,
navigationMode: "classic",
logo: false
});

jsfiddle here: https://jsfiddle.net/xnqt6z37/7/


I figured out that it is the "minZoom" attribute that's making the zoomOut button grayed out. minZoom is set to be the same as initial zoom, so initially map cannot be zoomed out further.


Also,


esri.config.defaults.map.zoomDuration = 0; 

esri.config.defaults.map.zoomRate = 0;

is causing the problem, I added these to remove zoom animation due to a bug in chrome, and zooming with ESRI arcgis: Zoom hangs ArcGIS API for JavaScript application?


I cannot find a setMinZoom() method in map, even though there is a getMinZoom().


I have this as a hacky workaround: https://jsfiddle.net/xnqt6z37/13/ it sets the initial zoom to be smaller than minZoom, then set zoom back to the desired initial zoom, which is the same as minZoom in this case.


Any better ways?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...