wip(lab): More Xray work
This commit is contained in:
parent
7ae2c4b1eb
commit
e62a862559
8 changed files with 166 additions and 105 deletions
|
@ -1,6 +1,29 @@
|
|||
import Text from '../text'
|
||||
import Circle from '../circle'
|
||||
|
||||
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.xray.reveal[props.partName].points).indexOf(props.pointName)%10
|
||||
const classes = `stroke-sm stroke-color-${i} stroke-dashed`
|
||||
return (
|
||||
<g>
|
||||
<circle
|
||||
cx={x}
|
||||
cy={y}
|
||||
r={r}
|
||||
className={classes}
|
||||
/>
|
||||
<path d={`
|
||||
M ${x} ${topLeft.y} L ${x} ${y - r}
|
||||
m 0 ${2*r} L ${x} ${bottomRight.y}
|
||||
M ${topLeft.x} ${y} L ${x - r} ${y}
|
||||
m ${2*r} 0 L ${bottomRight.x} ${y}`} className={classes} />
|
||||
</g>
|
||||
)
|
||||
}
|
||||
|
||||
const XrayPoint = props => (
|
||||
<g>
|
||||
<circle
|
||||
|
@ -23,9 +46,11 @@ const XrayPoint = props => (
|
|||
|
||||
|
||||
const Point = props => {
|
||||
const { point, pointName } = props
|
||||
const { point, pointName, partName, gist } = props
|
||||
const output = []
|
||||
if (props.gist.xray) output.push(<XrayPoint {...props} key={'xp-' + pointName} />)
|
||||
if (gist.xray) output.push(<XrayPoint {...props} key={'xp-' + pointName} />)
|
||||
if (gist.xray?.reveal?.[partName]?.points?.[pointName])
|
||||
output.push(<RevealPoint {...props} key={'rp-' + pointName} />)
|
||||
if (point.attributes && point.attributes.get('data-text'))
|
||||
output.push(<Text {...props} key={'point-' + pointName} />)
|
||||
if (point.attributes && point.attributes.get('data-circle'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue