Stephen,I'm pretty sure the geometry of the map div affects how the extent is set when you call map.setExtent(extent, fit?). The API should center your extent in the available area of the map unless you're locking down scales or levels of detail. After setting the extent, I expect the map object's extent property to contain the actual extent, not necessarily the one specified. The maps we build here usually are not a fixed size, so our scripts confirm the initial map extent by setting it again after all the layers are loaded, because the map doesn't really finish loading until the first layer is added to the map. Just to be safe, after the initial extent is set, you could grab the current extent and store it to make sure if you still want to compare extents. After the layers are loaded and the initial extent confirmed, we set up the onExtentChange event handler, and it catches all extent changes after that. But we don't do any later comparisons, because we just cache the extents so the user can go back and forth in the extent history.I'm with you on the global variables. If you want to cut down on that, you can create one global object and store event handlers as members of that object. We wrote an EventHandler class to store layer event handlers on one array, map event handlers in another, and so on.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.