[OpenLayers-Trac] [OpenLayers] #3114: setting layers and center in
options causes moveTo to be called too often
OpenLayers
trac-20090302 at openlayers.org
Fri Feb 25 06:14:56 EST 2011
#3114: setting layers and center in options causes moveTo to be called too often
---------------------+------------------------------------------------------
Reporter: tschaub | Owner:
Type: bug | Status: new
Priority: minor | Milestone: 2.11 Release
Component: Map | Version: 2.10
Keywords: | State:
---------------------+------------------------------------------------------
If you construct a map like this:
{{{
var map = new OpenLayers.Map({
// other options here
layers: [myLayer],
center: myCenter
});
}}}
then the moveTo method will be called twice on your layer - the first time
with bad bounds. We can handle this case by deleting {{{map.center}}}
before calling {{{addLayers}}}.
The case that is '''not''' treated by this ticket is the following:
{{{
var map = new OpenLayers.Map({
// other options here
center: myCenter
});
map.addLayer(myCenter);
}}}
I think it would make sense to delete {{{map.center}}} in this case as
well, but there was a message on the mailing list about people relying on
it being available after map construction (even though you can't call
{{{addLayer}}} at this point).
--
Ticket URL: <http://trac.openlayers.org/ticket/3114>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list