I want to add an add-on to my map that will allow the user pan the map by clicking on it. I am thinking something like the zoom toolbar where the user csn click on the +- buttons to zoom in/out. Any ideas?
1 Answer
What you are looking for is the nav property, which you can set in your options object when creating the map. See here in the constructor:
Displays pan buttons on map. When false, the pan arrows never display. The default is false.
It accepts a boolean, so all you have to do is set it to true when creating your map, such as here:
var map = new Map("mapDiv", {
basemap: "streets",
center: [-100, 32.52],
zoom: 7,
nav:true
});
Eight small arrows should now appear on your map, which can be used to pan when clicking on them. They're gray, so they are sometimes hard to see, depending on which basemap you use!
-
I have tried this, but it seems like it is not finding the images to download (arrows). I can see an error in the console when trying to fetch the image. Maybe its because of using angular js. Do you know where I could download the arrows pngs from ? Or is there any example that could help see the functionality implemeted and maybe download the images on my own?– SmalisCommented Feb 7, 2015 at 12:14
-
Have you installed the API locally or are you using the CDN? Commented Feb 7, 2015 at 12:27
-
If you have made a local copy of js.arcgis.com/3.12/esri/css/esri.css then you can get the images from here js.arcgis.com/3.12/esri/images/map/fixed-pan-sprite.png Commented Feb 9, 2015 at 4:52