Why does extent-change fire 3 times when map is loading?

2239
1
04-01-2016 07:56 AM
PLadd
by
Occasional Contributor III


I'm using the Tax Parcel Viewer and am trying to get the initial extent to fall where I want it when the map loads.  To help me figure out what's going on I'm using the following listener:

var mapExtentChange = map.on("extent-change", changeHandler);

And

function changeHandler(evt) {

    var extent = evt.extent,

      zoomed = evt.levelChange;

    alert('you moved');

}

This event fires 3 times while map is loading.  When I use previous extent button, I can see what the previous extents were and it makes no sense. 

How can I figure out what is making the extent-change fire three times when the map is initially loading?  All this loading seems like a poor use of resources.  Thanks.

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Patrick,

  Have you looked in the code for anything that is setting the maps extent like map.setExtent(xyz); You may have better luck posting an issue to the gitHub repo for this template. That way one of the template developer can respond.

0 Kudos