Avoid in-place modifications when expanding contours
This commit is contained in:
parent
1bd83fe9ca
commit
fe35f3dff7
1 changed files with 5 additions and 3 deletions
|
@ -128,13 +128,15 @@ class DiSpiroGeometry extends GeometryBase {
|
|||
|
||||
asContours() {
|
||||
if (this.m_cachedContours) return this.m_cachedContours;
|
||||
const { lhs, rhs } = this.expand();
|
||||
const expandResult = this.expand();
|
||||
const lhs = [...expandResult.lhs];
|
||||
const rhs = [...expandResult.rhs];
|
||||
|
||||
let rawGeometry;
|
||||
if (this.m_closed) {
|
||||
rawGeometry = new CombineGeometry([
|
||||
new SpiroGeometry(Transform.Id(), this.m_closed, lhs.slice(0, -1)),
|
||||
new SpiroGeometry(Transform.Id(), this.m_closed, rhs.reverse().slice(0, -1))
|
||||
new SpiroGeometry(Transform.Id(), true, lhs.slice(0, -1)),
|
||||
new SpiroGeometry(Transform.Id(), true, rhs.reverse().slice(0, -1))
|
||||
]);
|
||||
} else {
|
||||
lhs[0].type = lhs[lhs.length - 1].type = "corner";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue