AnsweredAssumed Answered

How do I synchronize multiple map events?

Question asked by guriguri1576 on Jul 13, 2017
Latest reply on Jul 13, 2017 by dblanchardesri-ca-esridist

I want to sync four map screens.

However, binding an event to a map object as follows behaves abnormally.

How do I sync all of my maps?

 

var map1 = new esri.Map("div1","basemapId");

var map2 = new esri.Map("div2","basemapId");

var map3 = new esri.Map("div3","basemapId");

var map4 = new esri.Map("div4","basemapId");

 

var obj1 = map1.on('extent-change',initExtent);

var obj2 = map2.on('extent-change',initExtent);

var obj3 = map3.on('extent-change',initExtent);

var obj4 = map4.on('extent-change',initExtent);

 

function initExtent(e){

   if(e.target.id ==='div1'){

      map2.setExtent(e.extent);

      map3.setExtent(e.extent);

      map4.setExtent(e.extent);

   }

   else{

      map1.setExtent(e.extent);

  }

}

Outcomes