Fix getDataExtent() (vector) manipulates feature: patch from vmx, tests by me,

r=me.  (Closes #1822) 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@8349 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-11-13 12:12:58 +00:00
parent e547d61472
commit 07ff407da5
2 changed files with 18 additions and 3 deletions

View File

@@ -736,9 +736,10 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
*/
getDataExtent: function () {
var maxExtent = null;
if( this.features && (this.features.length > 0)){
var maxExtent = this.features[0].geometry.getBounds();
for(var i=0, len=this.features.length; i<len; i++){
if(this.features && (this.features.length > 0)) {
maxExtent = new OpenLayers.Bounds();
for(var i=0, len=this.features.length; i<len; i++) {
maxExtent.extend(this.features[i].geometry.getBounds());
}
}