- Building Web and Mobile ArcGIS Server Applications with JavaScript(Second Edition)
- Eric Pimpler Mark Lewin
- 293字
- 2021-07-02 15:49:01
Map navigation widgets and toolbars
The simplest way to provide map navigation control to your application is through the addition of various widgets and toolbars. By default, when you create a new map and add layers, a zoom slider is included with the map. This slider allows the user to zoom in and out of the map by clicking the plus or minus buttons respectively. The zoom slider is illustrated in the following screenshot. You don't have to write any code for the zoom slider to appear on your map. It is present by default:

However, you can remove the slider if your application doesn't need it by setting the slider option to false within the map options object you pass into the Map constructor:
{ slider: false }
By default, the ArcGIS API for JavaScript displays the small version of the slider. If you want to give your users more fine-grained control over the map's zoom level, you can use the large slider instead:
{ sliderStyle: "large" }

You can also add pan buttons that will pan the map in the direction that the arrow points when clicked. By default pan buttons will not appear on the map. You must specifically set the nav option to true when creating your Map object:
{ nav: true }
The result of this is the addition of little directional buttons in the corners of the map:

The ArcGIS API for JavaScript also gives you the ability to add several types of toolbars to your application, including a navigation toolbar that contains buttons for zooming in and out, panning, full extent, next extent and previous extent. The topic of toolbar creation is covered in detail in a later chapter, so we'll save that discussion for then:

- C語言程序設計案例教程(第2版)
- Python網絡爬蟲從入門到實踐(第2版)
- 軟件項目管理實用教程
- 小程序開發原理與實戰
- 表哥的Access入門:以Excel視角快速學習數據庫開發(第2版)
- 利用Python進行數據分析(原書第3版)
- 數據結構案例教程(C/C++版)
- Scratch3.0趣味編程動手玩:比賽訓練營
- Hands-On Nuxt.js Web Development
- ASP.NET Web API Security Essentials
- Puppet 5 Beginner's Guide(Third Edition)
- Programming MapReduce with Scalding
- Clojure High Performance Programming
- WebRTC Cookbook
- HTML 5與CSS 3權威指南(第3版·下冊)