diff --git a/src/ol/geom/multipolygon.js b/src/ol/geom/multipolygon.js index c06abed26f..41e047c692 100644 --- a/src/ol/geom/multipolygon.js +++ b/src/ol/geom/multipolygon.js @@ -122,7 +122,7 @@ ol.geom.MultiPolygon.prototype.clone = function() { var len = this.endss_.length; var newEndss = new Array(len); for (var i = 0; i < len; ++i) { - newEndss[i] = this.endss_.slice(); + newEndss[i] = this.endss_[i].slice(); } multiPolygon.setFlatCoordinates( diff --git a/test/spec/ol/geom/multipolygon.test.js b/test/spec/ol/geom/multipolygon.test.js index 606b411c45..aa91d56db8 100644 --- a/test/spec/ol/geom/multipolygon.test.js +++ b/test/spec/ol/geom/multipolygon.test.js @@ -88,6 +88,15 @@ describe('ol.geom.MultiPolygon', function() { [[[3, 0], [4, 1], [5, 2], [5, 0]]]); }); + describe('#clone()', function() { + + it('has the expected endss_', function() { + var clone = multiPolygon.clone(); + expect(multiPolygon.endss_).to.eql(clone.endss_); + }); + + }); + describe('#getCoordinates()', function() { var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];