Reticle (improved)

This commit is contained in:
Eric van der Vlist 2022-10-09 11:29:43 +02:00
parent 27305c4b21
commit 0762a4da7a
1 changed files with 16 additions and 8 deletions

View File

@ -69,7 +69,7 @@ const Reticle: React.FC<{}> = () => {
<circle <circle
cx={center.x} cx={center.x}
cy={center.y} cy={center.y}
r={radius} r={unitPxStep * nbUnits}
fill='transparent' fill='transparent'
stroke='black' stroke='black'
strokeWidth={1} strokeWidth={1}
@ -86,7 +86,9 @@ const Reticle: React.FC<{}> = () => {
strokeWidth={0.5} strokeWidth={0.5}
/> />
<g id='reticle-east'> <g id='reticle-east'>
<path stroke='red' className='reticle' <path
stroke='red'
className='reticle'
strokeWidth={0.5} strokeWidth={0.5}
d={_.range(1, nbSubUnits + 1) d={_.range(1, nbSubUnits + 1)
.map( .map(
@ -94,27 +96,33 @@ const Reticle: React.FC<{}> = () => {
) )
.join(' ')} .join(' ')}
/> />
<path stroke='red' className='reticle' <path
stroke='red'
className='reticle'
d={_.range(1, nbUnits + 1) d={_.range(1, nbUnits + 1)
.map((i) => `M ${center.x + i * unitPxStep},${center.y - 20} v 40`) .map((i) => `M ${center.x + i * unitPxStep},${center.y - 20} v 40`)
.join(' ')} .join(' ')}
strokeWidth={0.5} strokeWidth={0.5}
/> />
</g> </g>
<use stroke='red' className='reticle' <use
stroke='red'
className='reticle'
href='#reticle-east' href='#reticle-east'
transform={`rotate(90, ${center.x}, ${center.y})`} transform={`rotate(90, ${center.x}, ${center.y})`}
/> />
<use className='reticle' <use
className='reticle'
href='#reticle-east' href='#reticle-east'
transform={`rotate(180, ${center.x}, ${center.y})`} transform={`rotate(180, ${center.x}, ${center.y})`}
/> />
<use className='reticle' <use
className='reticle'
href='#reticle-east' href='#reticle-east'
transform={`rotate(-90, ${center.x}, ${center.y})`} transform={`rotate(-90, ${center.x}, ${center.y})`}
/> />
<text x={center.x + unitPxStep - 15} y={center.y - 20}> <text x={center.x + unitPxStep * nbUnits - 15} y={center.y - 20}>
{`${radiusUnitValue} ${radiusUnit}`} {`${radiusUnitValue * nbUnits} ${radiusUnit}`}
</text> </text>
</g> </g>
); );