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