2022-01-25 11:22:09 +01:00
|
|
|
import TextOnPath from '../text-on-path'
|
|
|
|
import { getProps } from '../utils'
|
|
|
|
|
2022-01-29 10:50:02 +01:00
|
|
|
const XrayPath = props => (
|
|
|
|
<g>
|
|
|
|
<path
|
|
|
|
d={props.path.asPathstring()}
|
|
|
|
{...getProps(props.path)}
|
2022-01-30 15:14:44 +01:00
|
|
|
className="opacity-0 stroke-3xl stroke-contrast hover:opacity-25 hover:cursor-pointer"
|
2022-01-29 10:50:02 +01:00
|
|
|
onClick={() => props.updateGist(
|
|
|
|
['xray', 'parts', props.partName, 'paths', props.pathName],
|
2022-01-30 15:14:44 +01:00
|
|
|
1
|
2022-01-29 10:50:02 +01:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</g>
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-01-28 19:55:32 +01:00
|
|
|
const Path = props => {
|
2022-01-29 10:50:02 +01:00
|
|
|
const { path, partName, pathName } = props
|
2022-01-28 19:55:32 +01:00
|
|
|
if (!path.render) return null
|
2022-01-25 11:22:09 +01:00
|
|
|
const output = []
|
2022-01-29 10:50:02 +01:00
|
|
|
const pathId = 'path-' + partName + '-' + pathName
|
2022-01-25 11:22:09 +01:00
|
|
|
output.push(
|
2022-01-28 19:55:32 +01:00
|
|
|
<path id={pathId} key={pathId} d={path.asPathstring()} {...getProps(path)} />
|
2022-01-25 11:22:09 +01:00
|
|
|
)
|
2022-01-28 19:55:32 +01:00
|
|
|
if (path.attributes.get('data-text'))
|
|
|
|
output.push(<TextOnPath key={'text-on-path-' + name} pathId={pathId} {...props} />)
|
2022-01-29 10:50:02 +01:00
|
|
|
if (props.gist.xray) output.push(<XrayPath {...props} key={'xpath'+pathId} />)
|
2022-01-25 11:22:09 +01:00
|
|
|
|
|
|
|
return output
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Path
|