From fe35f3dff7710127f5331f25bed40b5ca8cc1ecb Mon Sep 17 00:00:00 2001 From: be5invis Date: Sat, 31 Jul 2021 13:38:15 -0700 Subject: [PATCH] Avoid in-place modifications when expanding contours --- font-src/support/geometry/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/font-src/support/geometry/index.js b/font-src/support/geometry/index.js index 811e87ab0..ff68ce07e 100644 --- a/font-src/support/geometry/index.js +++ b/font-src/support/geometry/index.js @@ -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";