[OpenLayers-Dev] 'changelayer' event + map zoom

Grzegorz Kurzejamski grzegorz.kurzejamski at lingaro.com
Thu Jan 12 10:10:19 EST 2012


Hi, 

I've been wondering, how is that, that after firing that piece of code:

map.events.register('changelayer', null, function(evt)
{
  if(evt.layer.visibility==true)
  {
   map.zoomToMaxExtent()
  }
}
);

...zoom doesn't affect the view.
I've got few layers in my map, with standard layer switcher. Those are
completely different graphs, so when I change layer, I want to zoom it to
maximum extent. When I put some alert(); just after zoom function i can see,
that when the alert is fired - layer is already changed and certainly zoomed
to "MaxExtent" . After alert closure, layer pans to bounding box before
layer switching.

After few hours of net digging, I decided to post here.
Hope someone can help :).

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/changelayer-event-map-zoom-tp7180553p7180553.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.


More information about the Dev mailing list