Going back to the topic of this post, could you please give me some samples of source code to add this type of buttons, panels, etc:
Anytime you see "dojo.something", it generally means that is non-AMD.In the index file is the following code: dojo.require("utilities.App"); dojo.require("templateConfig.commonConfig"); var i18n; dojo.ready(function(){ ... This indicates a non-AMD style application.I am speaking with you, as an employee of ESRI, attempting to help 😃http://www.esri.com/careers/students/summer-internships/intern-profiles/intern-profile-web-design-developmentYou said you had the Basic Viewer in AMD style and I wanted to see your code, because the viewer you linked is in legacy style, so buttons are added in a different way (it matters).
dojo.require("utilities.App"); dojo.require("templateConfig.commonConfig"); var i18n; dojo.ready(function(){ ...
This is the AMDified version of the Esri's JavaScript Basic Viewer:http://www.arcgis.com/apps/OnePane/basicviewer/index.htmlThe code I added follows the existing code in the "layout.js" file, but if you take a look to the index.htm or other .js files they follow the AMD style.For a detailed explanation of why it was coded this way, please contact Esri directly.Regards
I am modifying the Basic viewer, and the code exported is already in AMD format:http://www.arcgis.com/apps/OnePane/basicviewer/index.html
dojo.require("esri.dijit.HomeButton");
#HomeButton { position: absolute; top: 95px; left: 20px; z-index: 50; }
<div id="HomeButton"></div>
<!-- Map Section --> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='region:"center"' dir="ltr"> <div id="HomeButton" class="HomeButton"></div> <div id="logo" class="logo" style="display:none;"> <!--If a logo is specified in config section then the logo will be added to the map--> </div> <!--Floating window that contains the measure dijit--> <div id="floater"> <div id="measureDiv"></div> </div> <!--Floating window contains the time slider--> <div id="timeFloater" style='display:none;'> </div> </div>
dojo.require("esri.dijit.HomeButton"); var homeButton; �?� dojo.connect(dijit.byId('map'), 'resize', resizeMap); adjustPopupSize(); var layers = response.itemInfo.itemData.operationalLayers; //constrain the extent if (configOptions.constrainmapextent) { var basemapExtent = map.getLayer(map.layerIds[0]).fullExtent.expand(1.5); //create a graphic with a hole over the web map's extent. This hole will allow //the web map to appear and hides the rest of the map to limit the visible extent to the webmap. var clipPoly = new esri.geometry.Polygon(map.spatialReference); clipPoly.addRing([ [basemapExtent.xmin, basemapExtent.ymin], [basemapExtent.xmin, basemapExtent.ymax], [basemapExtent.xmax, basemapExtent.ymax], [basemapExtent.xmax, basemapExtent.ymin], [basemapExtent.xmin, basemapExtent.ymin] ]); //counter-clockwise to add a hole clipPoly.addRing([ [webmapExtent.xmin, webmapExtent.ymin], [webmapExtent.xmax, webmapExtent.ymin], [webmapExtent.xmax, webmapExtent.ymax], [webmapExtent.xmin, webmapExtent.ymax], [webmapExtent.xmin, webmapExtent.ymin] ]); var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(), new dojo.Color("white")); var maxExtentGraphic = new esri.Graphic(clipPoly, symbol); map.graphics.add(maxExtentGraphic); } // Add Home button homeButton = new esri.dijit.HomeButton({ map: map, id: 'HomeButton' }, 'HomeButton'); homeButton.startup(); �?�.
<script type="text/javascript" src="javascript/map.js"></script>
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.