import { Text } from './text.mjs'
import { Circle } from './circle.mjs'
import { Tr, KeyTd, ValTd, Attributes, pointCoords } from './path.mjs'
import { withinPartBounds } from './utils.mjs'
const RevealPoint = ({ point, pointName, scale, part, partName, ui }) => {
const r = 15 * scale
const { x, y } = point
const { topLeft, bottomRight } = part
const i = Object.keys(ui.xray.reveal[partName].points).indexOf(pointName) % 10
const classes = `stroke-sm stroke-color-${i} stroke-dashed`
return (
)
}
const pointInfo = ({ point, pointName, partName }) =>
point ? (
Point info
Coordinates
{pointCoords(point)}
Name
{pointName}
Part
{partName}
Attributes
) : null
const XrayPoint = ({ point, pointName, partName, scale, showInfo }) => (
showInfo(evt, pointInfo({ point, pointName, partName }))}
/>
)
export const Point = ({ point, pointName, partName, settings, part, ui, showInfo }) => {
// Don't include parts outside the part bounding box
if (!withinPartBounds(point, part)) return null
const output = []
if (ui.xray?.enabled) {
// Xray for points
output.push(
)
// Reveal (based on clicking the seach icon in sidebar
if (ui.xray?.reveal?.[partName]?.points?.[pointName])
output.push()
}
// Render text
if (point.attributes && point.attributes.get('data-text'))
output.push(
)
// Render circle
if (point.attributes && point.attributes.get('data-circle'))
output.push()
return output.length < 1 ? null : output
}