1
0
Fork 0
freesewing/packages/react/components/Xray/point.mjs
2024-12-10 18:03:03 +01:00

29 lines
876 B
JavaScript

import React from 'react'
import {
withinPartBounds,
defaultComponents as patternComponents,
} from '@freesewing/react/components/Pattern'
export const PointXray = ({ stackName, pointName, part, point, settings, components, t }) => {
// Don't include parts outside the part bounding box
if (!withinPartBounds(point, part)) return null
/*
* We use the Point component from Pattern here
* If we would extract Point from the components passed down,
* we'd create a recursion loop as the Point we call below
* would be this very PointXray component.
*/
const { Point } = patternComponents
return (
<>
<Point {...{ stackName, pointName, part, point, settings, components, t }} />
<circle
cx={point.x}
cy={point.y}
r={1.5 * (settings.scale || 1)}
className="stroke-md opacity-70"
/>
</>
)
}