added functions to return the node/cable clicked on all the way up to the parent
This commit is contained in:
parent
0701be2539
commit
f4d1167e4d
5 changed files with 113 additions and 165 deletions
|
|
@ -10,16 +10,29 @@ interface Props {
|
|||
nodeData: NodeData[]
|
||||
bin: Bin
|
||||
binCenter: Vector3
|
||||
onNodeClick?: (node: NodeData, cable: CableData) => void
|
||||
}
|
||||
|
||||
export default function BinCables(props: Props){
|
||||
const {bin, binCenter, cableData, nodeData} = props
|
||||
const {bin, binCenter, cableData, nodeData, onNodeClick} = props
|
||||
return (
|
||||
<React.Fragment>
|
||||
{cableData.map((cable, i) => {
|
||||
const cableNodes = nodeData.filter(n => n.cableIndex === cable.cableIndex);
|
||||
|
||||
return (
|
||||
<GrainCable key={"cable " + i} cable={cable} nodes={cableNodes} bin={bin} binCenter={binCenter}/>
|
||||
<GrainCable
|
||||
key={"cable " + i}
|
||||
cable={cable}
|
||||
nodes={cableNodes}
|
||||
bin={bin}
|
||||
binCenter={binCenter}
|
||||
onNodeClick={(node) => {
|
||||
if(onNodeClick){
|
||||
onNodeClick(node, cable)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue