I would like to programmatically change a link’s points to that of the points stored in an array; however, I am not sure how to do this. I have looked at computePoints with link.clearPoints
and then looping through and adding points using link.addPoint()
to add the new points. Additionally, I have tried to set the points using link.points = pointsArray
but that results in the error Cannot read property 'freeze' of null
. I am at a loss. The reason for doing this is that I want the changes in points from one user to replace the points on a link for another user.
Setting the points property on the Link should work if the List or Array is properly constructed.
Okay. I got it working with the following code:
var points = [];
data.points.forEach(function(point) {
points.push(point.F);
points.push(point.G);
});
link.points = points
What are those “F” and “G” properties? I hope you aren’t depending on the minified names of any properties!
Yes, I have fixed this to use point.x and point.y. Thank you!