Skip to content

Commit

Permalink
(hack) select node when parent edge is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
georgefst committed Mar 22, 2023
1 parent dcde712 commit ec4a88b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/TreeReactFlow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ const makePrimerNode = async (
target: child.id,
style: { cursor: "default" },
focusable: false,
interactionWidth: 0,
...(child.type != "primer-def-name" &&
!flavorClasses(child.data.flavor).includes(commonHoverClasses) && {
interactionWidth: 0,
}),
zIndex,
});
switch (node.body.tag) {
Expand Down Expand Up @@ -507,7 +510,6 @@ export const TreeReactFlow = (p: TreeReactFlowProps) => {
className: "stroke-grey-tertiary stroke-[0.25rem]",
style: { strokeDasharray: 4, cursor: "default" },
focusable: false,
interactionWidth: 0,
zIndex: 0,
},
],
Expand Down Expand Up @@ -658,6 +660,10 @@ export const ReactFlowSafe = <N extends RFNode>(
<ReactFlow
{...{
...p,
onEdgeClick: (e, edge) => {
"onNodeClick" in p &&
p.onNodeClick(e, p.nodes.find((n) => n.id == edge.target) as N);
},
onNodeClick: (e, n) => {
"onNodeClick" in p &&
p.onNodeClick(
Expand Down

0 comments on commit ec4a88b

Please sign in to comment.