Skip to content

Commit

Permalink
not auto-centering clicked nodes / increase popper visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesmac committed Sep 29, 2023
1 parent 6a84546 commit 0455291
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const ModuleGraphNodeHover: React.FC<ModuleHoverProps> = ({ node }) => {
/>
{node ? (
<>
<ModuleHoverPopper address={address} element={currentEl} name={name} placement={'top'} open />
<ModuleHoverPopper address={address} element={currentEl} name={name} placement={'top'} open sx={{ zIndex: 2 }} />
</>
) : null}
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import { useModuleFromNode } from '@xyo-network/react-node'
import { NodeSingular } from 'cytoscape'
import { useEffect } from 'react'

import { useCytoscapeInstance } from '../../contexts'
import { useCytoscapeElements } from './useCytoscapeElements'

export const useNewElements = (selectedElement?: NodeSingular) => {
const { cy } = useCytoscapeInstance(true)
const { address: selectedAddress } = selectedElement?.data() ?? {}
const [module] = useModuleFromNode(selectedAddress)
const newElements = useCytoscapeElements(module)

useEffect(() => {
if (selectedAddress) {
const element = cy?.$(`node[id="${selectedAddress}"]`)
if (element?.length) cy?.center(element)
}
}, [cy, selectedAddress])

return newElements
}

0 comments on commit 0455291

Please sign in to comment.