navToolbar.zoomToFullExtent.toString()
"function () { var map = this.map; map.setExtent(map.getLayer(map.layerIds[0]).initialExtent); }"
navToolar.zoomToFullExtent = function() { var map = this.map; map.setExtent(appFullExtent); }
You can take a look at the code for zoomToFullExtent by typing this in firebug or chrome dev tools console: navToolbar.zoomToFullExtent.toString() That will print: "function () { var map = this.map; map.setExtent(map.getLayer(map.layerIds[0]).initialExtent); }" The easiest way to change this is to re-define zoomToFullExtent for your toolbar. After you create your toolbar, do something like this: navToolar.zoomToFullExtent = function() { var map = this.map; map.setExtent(appFullExtent); } Where appFullExtent is a global that represents your app's full extent.
navToolbar = new Navigation(map); on(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler); registry.byId("zoomin").on("click", function(){ navToolbar.activate(Navigation.ZOOM_IN); }); registry.byId("zoomout").on("click", function(){ navToolbar.activate(Navigation.ZOOM_OUT); }); registry.byId("zoomfullext").on("click", function(){ navToolbar.zoomToFullExtent(); }); registry.byId("zoomprev").on("click", function(){ navToolbar.zoomToPrevExtent(); }); registry.byId("zoomnext").on("click", function(){ navToolbar.zoomToNextExtent(); }); registry.byId("pan").on("click", function(){ navToolbar.activate(Navigation.PAN); }); registry.byId("deactivate").on("click", function(){ navToolbar.deactivate(); }); function extentHistoryChangeHandler(){ registry.byId("zoomprev").disabled = navToolbar.isFirstExtent(); registry.byId("zoomnext").disabled = navToolbar.isLastExtent(); } });
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.