diff --git a/src/boardDomain.test.ts b/src/boardDomain.test.ts index 411be41..e3cd2f9 100644 --- a/src/boardDomain.test.ts +++ b/src/boardDomain.test.ts @@ -55,6 +55,7 @@ describe('red thread geometry', () => { it('draws a short foreground thread segment into the eyelet from the visual left', () => { const leftToRight = threadTagLeadIn({ x: 0, y: 0 }, { x: 200, y: 0 }, 100, 50) expect(leftToRight.start.x).toBeLessThan(leftToRight.end.x) + expect(leftToRight.end.x - leftToRight.start.x).toBeCloseTo(54) expect(leftToRight.end).toEqual({ x: 100, y: 0 }) expect(leftToRight.path).toMatch(/^M .* C .* 100 0$/) diff --git a/src/boardDomain.ts b/src/boardDomain.ts index 88e0b22..233834a 100644 --- a/src/boardDomain.ts +++ b/src/boardDomain.ts @@ -99,7 +99,7 @@ export function threadTagLeadIn(from: BoardPoint, to: BoardPoint, tightness = 65 const tagT = position / 100 const tangent = cubicTangent(from, c1, c2, to, tagT) const speed = Math.max(1, Math.hypot(tangent.x, tangent.y)) - const leadLength = Math.max(.035, Math.min(.18, 42 / speed)) + const leadLength = Math.max(.0525, Math.min(.27, 63 / speed)) const entryT = Math.max(0, Math.min(1, tagT + (tangent.x < 0 ? leadLength : -leadLength))) const [start, leadC1, leadC2] = cubicSegment([from, c1, c2, to], entryT, tagT) const end = cubicPoint(from, c1, c2, to, tagT)