问题:当我改变points
一个多边形的poly2
时候,它也改变了points
另一个多边形的poly
!
为什么改变一个也会改变另一个,我们如何将它们解耦?
console.log(poly.getPoints()[1].x); // 100
// Make a change to `poly2`
poly2.setPoints(poly.getPoints());
poly2.getPoints()[1].x=200
console.log(poly.getPoints()[1].x); // 200 (both poly and poly2 are affected!)
jsfiddle:http: //jsfiddle.net/8hFyv/