[OpenLayers-Dev] Shouldn't getCenter return a clone?

Joao Duarte joao.c.duarte at co.sapo.pt
Wed Jan 14 10:44:06 EST 2009



While I was developing my application, I got a strange behavior while using
map.getCenter() and map.getExtent().


I was calling map.getCenter() and modifying the value I got in return. Then
the map.getExtent() returned a strange bounding box.


After looking at the getCenter method of OpenLayers.Map, I found that what’s
being returned is this.center directly, instead of a clone.


Shouldn’t getCenter return a clone to prevent modifications on the return
value from the user, like for example getSize?


Best regards,


João Duarte

 <http://maps.sapo.pt> http://maps.sapo.pt


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20090114/f43065d4/attachment.html

More information about the Dev mailing list