Fix stanek leaking classes

This commit is contained in:
Olivier Gagnon 2022-05-19 01:34:36 -04:00
parent 8f3fc22ae6
commit fda3f02d73
2 changed files with 2 additions and 14 deletions

@ -68,13 +68,7 @@ export class ActiveFragment {
}
copy(): ActiveFragment {
// We have to do a round trip because the constructor.
const fragment = FragmentById(this.id);
if (fragment === null) throw new Error("ActiveFragment id refers to unknown Fragment.");
const c = new ActiveFragment({ x: this.x, y: this.y, rotation: this.rotation, fragment: fragment });
c.highestCharge = this.highestCharge;
c.numCharge = this.numCharge;
return c;
return Object.assign({}, this);
}
/**

@ -76,13 +76,7 @@ export class Fragment {
}
copy(): Fragment {
return new Fragment(
this.id,
this.shape.map((a) => a.slice()),
this.type,
this.power,
this.limit,
);
return Object.assign({}, this);
}
}