🚧 Part cloning
This commit is contained in:
parent
9a60dc5756
commit
18cc30fe74
7 changed files with 90 additions and 3 deletions
|
@ -108,4 +108,12 @@ point.prototype.shiftOutwards = function(that, distance) {
|
|||
return this.shiftTowards(that, this.dist(that) + distance);
|
||||
};
|
||||
|
||||
/** Returns a deep copy of this */
|
||||
point.prototype.clone = function() {
|
||||
let clone = new point(this.x, this.y);
|
||||
clone.attributes = this.attributes.clone();
|
||||
|
||||
return clone;
|
||||
};
|
||||
|
||||
export default point;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue