feat: drag relation tags along threads
This commit is contained in:
@@ -11,7 +11,10 @@ import {
|
||||
normalizeCase,
|
||||
panViewport,
|
||||
relationPosition,
|
||||
projectThreadTag,
|
||||
threadCurve,
|
||||
threadTagLateralLimit,
|
||||
threadTagPlacement,
|
||||
timelinePositionPercent,
|
||||
timelineRange,
|
||||
zoomFromWheel,
|
||||
@@ -31,6 +34,18 @@ describe('red thread geometry', () => {
|
||||
it('clamps tightness to its normalized percentage range', () => {
|
||||
expect(threadCurve({ x: 0, y: 0 }, { x: 100, y: 0 }, 200)).toEqual(threadCurve({ x: 0, y: 0 }, { x: 100, y: 0 }, 100))
|
||||
})
|
||||
|
||||
it('places and projects tags by percentage along the curve', () => {
|
||||
const from = { x: 0, y: 0 }, to = { x: 200, y: 0 }
|
||||
expect(threadTagPlacement(from, to, 100, 25, 0)).toMatchObject({ x: 50, y: 0, positionPercent: 25 })
|
||||
expect(projectThreadTag(from, to, 100, { x: 150, y: 8 })).toMatchObject({ positionPercent: 75, lateralOffset: 8 })
|
||||
})
|
||||
|
||||
it('reduces lateral tag travel as the thread becomes taut', () => {
|
||||
expect(threadTagLateralLimit(0)).toBe(70)
|
||||
expect(threadTagLateralLimit(100)).toBe(10)
|
||||
expect(threadTagPlacement({ x: 0, y: 0 }, { x: 200, y: 0 }, 100, 50, 100).lateralOffset).toBe(10)
|
||||
})
|
||||
})
|
||||
|
||||
const folder: Evidence = {
|
||||
|
||||
Reference in New Issue
Block a user