@@ -5,6 +5,8 @@ import { Cluster, hierarchy } from '@visx/hierarchy';
5
5
import { LinkVertical } from '@visx/shape' ;
6
6
import { LinearGradient } from '@visx/gradient' ;
7
7
import { StateRouteProps } from './StateRoute'
8
+ import { onHover } from '../actions/actions'
9
+ import { useStoreContext } from '../store'
8
10
import Legend from './AtomsRelationshipLegend'
9
11
10
12
export const blue = '#acdbdf' ;
@@ -39,7 +41,7 @@ interface selectorsCache {
39
41
40
42
41
43
const clusterData : clusterShape = { } ;
42
- const selectorsCache :selectorsCache = { }
44
+ const selectorsCache :selectorsCache = { } ;
43
45
44
46
let initialFire = false
45
47
function clusterDataPopulate ( props :StateRouteProps ) {
@@ -122,6 +124,7 @@ function reorganizedCompObj(props) {
122
124
}
123
125
124
126
function Node ( { node } ) {
127
+ const [ dispatch ] = useStoreContext ( ) ;
125
128
const selector = node . depth === 1 && node . height === 2
126
129
const isRoot = node . depth === 0 ;
127
130
const isParent = ! ! node . children ;
@@ -136,9 +139,14 @@ function Node({ node }) {
136
139
r = { 12 }
137
140
fill = { isParent ? orange : blue }
138
141
stroke = { isParent ? orange : blue }
139
- // onClick={() => {
140
- // alert(`clicked: ${JSON.stringify(node.data.name)}`);
141
- // }}
142
+ onMouseEnter = { ( ) => {
143
+ console . log ( 'hi' )
144
+ // if(Object.keys(node.data.recoilDomNode).length > 0){
145
+ // dispatch(onHover(node.data.recoilDomNode[node.data.name]))
146
+ // } else {
147
+ // dispatch(onHover(node.data.rtid))
148
+ // }
149
+ } }
142
150
/>
143
151
) }
144
152
< text
@@ -191,16 +199,23 @@ function RootNode({ node }) {
191
199
}
192
200
193
201
function SelectorNode ( { node } ) {
202
+ const [ dispatch ] = useStoreContext ( ) ;
194
203
return (
195
204
< Group top = { node . y } left = { node . x } >
196
205
{ node . depth !== 0 && (
197
206
< circle
198
207
r = { 12 }
199
208
fill = { selectWhite }
200
209
stroke = { selectWhite }
201
- // onClick={() => {
202
- // alert(`clicked: ${JSON.stringify(node.data.name)}`);
203
- // }}
210
+ onMouseEnter = { ( ) => {
211
+
212
+ console . log ( 'hi' )
213
+ // if(Object.keys(node.data.recoilDomNode).length > 0){
214
+ // dispatch(onHover(node.data.recoilDomNode[node.data.name]))
215
+ // } else {
216
+ // dispatch(onHover(node.data.rtid))
217
+ // }
218
+ } }
204
219
/>
205
220
) }
206
221
< text
@@ -262,11 +277,12 @@ export default function Example({
262
277
stroke = { merlinsbeard }
263
278
strokeWidth = "1"
264
279
strokeOpacity = { 0.2 }
265
- fill = "none"
280
+ fill = "none"
266
281
/>
267
282
) ) }
268
283
{ cluster . descendants ( ) . map ( ( node , i ) => (
269
- < Node key = { `cluster-node-${ i } ` } node = { node } />
284
+ < Node key = { `cluster-node-${ i } ` }
285
+ node = { node } />
270
286
) ) }
271
287
</ Group >
272
288
) }
0 commit comments