diff --git a/packages/tldraw/src/lib/shapes/shared/polygon-helpers.ts b/packages/tldraw/src/lib/shapes/shared/polygon-helpers.ts index f77424d2d..41c9d5e07 100644 --- a/packages/tldraw/src/lib/shapes/shared/polygon-helpers.ts +++ b/packages/tldraw/src/lib/shapes/shared/polygon-helpers.ts @@ -83,7 +83,6 @@ export function getRoundedPolygonPoints( /** @public */ export function getDrawLinePathData(id: string, outline: VecLike[], strokeWidth: number) { let innerPathData = `M ${precise(outline[0])}L` - let outerPathData1 = `M ${precise(outline[0])}L` let outerPathData2 = `M ${precise(outline[0])}L` const offset = strokeWidth / 3 @@ -99,8 +98,8 @@ export function getDrawLinePathData(id: string, outline: VecLike[], strokeWidth: const len = outline.length for (let i = 0, n = len - 1; i < n; i++) { - p1 = Vec2d.AddXY(outline[i + 1], random() * offset, random() * offset) - s1 = Vec2d.AddXY(outline[i + 1], random(), random() * offset) + p1 = outline[i + 1] + s1 = Vec2d.AddXY(outline[i + 1], random() * offset, random() * offset) const delta = Vec2d.Sub(p1, p0) const distance = Vec2d.Len(delta) @@ -118,11 +117,9 @@ export function getDrawLinePathData(id: string, outline: VecLike[], strokeWidth: if (i === n - 1) { innerPathData += `${precise(q0)}L ${precise(p1)}` - outerPathData1 += `${precise(q0)}L ${precise(p1)}` outerPathData2 += `${precise(sq0)}L ${precise(s1)}` } else { innerPathData += `${precise(q0)}L ${precise(q1)}Q ${precise(p1)}` - outerPathData1 += `${precise(q0)}L ${precise(q1)}Q ${precise(p1)}` outerPathData2 += `${precise(sq0)}L ${precise(sq1)}Q ${precise(s1)}` p0 = p1 @@ -130,5 +127,5 @@ export function getDrawLinePathData(id: string, outline: VecLike[], strokeWidth: } } - return [innerPathData, outerPathData1 + outerPathData2] + return [innerPathData, innerPathData + outerPathData2] }