import { forwardRef } from 'react'
import { Point } from './point.mjs'
import { Snippet } from './snippet.mjs'
import { getProps } from './utils.mjs'
import { round } from 'shared/utils.mjs'
import { Path, Tr, KeyTd, ValTd, Attributes, pointCoords } from './path.mjs'
const partInfo = (props) => (
Part info
Name
{props.partName}
Width
{round(props.part.width, 2)}mm
Height
{round(props.part.height, 2)}mm
Top Left
{pointCoords(props.part.topLeft)}
Bottom Right
{pointCoords(props.part.bottomRight)}
Attributes
{props.gist?.only && props.gist.only.length > 0 ? (
) : (
)}
)
const XrayPart = (props) => {
const { topLeft, bottomRight } = props.part
return (
{
evt.stopPropagation()
props.showInfo(partInfo(props))
}}
/>
)
}
export const PartInner = forwardRef((props, ref) => {
const { partName, part, gist, skipGrid } = props
const Grid =
gist.paperless && !skipGrid ? (
) : null
return (
{Grid}
{gist._state?.xray?.enabled && }
{Object.keys(part.paths).map((pathName) => (
))}
{Object.keys(props.part.points).map((pointName) => (
))}
{Object.keys(props.part.snippets).map((snippetName) => (
))}
)
})
PartInner.displayName = 'PartInner'
export const Part = (props) => {
const { partName, part } = props
return (
)
}