Show connected nodes on hover, even when not matched

This commit is contained in:
David Kaltschmidt
2016-05-10 17:47:21 +02:00
parent 0573a20f07
commit 9984777a5b
2 changed files with 9 additions and 5 deletions

View File

@@ -16,10 +16,13 @@ class NodesChartEdges extends React.Component {
{layoutEdges.toIndexedSeq().map(edge => {
const sourceSelected = selectedNodeId === edge.get('source');
const targetSelected = selectedNodeId === edge.get('target');
const blurred = hasSelectedNode && !sourceSelected && !targetSelected
|| searchQuery && !(searchNodeMatches.has(edge.get('source'))
&& searchNodeMatches.has(edge.get('target')));
const highlighted = highlightedEdgeIds.has(edge.get('id'));
const focused = hasSelectedNode && (sourceSelected || targetSelected);
const blurred = !focused
&& !highlighted
&& (!searchQuery
|| !(searchNodeMatches.has(edge.get('source'))
&& searchNodeMatches.has(edge.get('target'))));
return (
<EdgeContainer
@@ -31,7 +34,7 @@ class NodesChartEdges extends React.Component {
blurred={blurred}
focused={focused}
layoutPrecision={layoutPrecision}
highlighted={highlightedEdgeIds.has(edge.get('id'))}
highlighted={highlighted}
/>
);
})}

View File

@@ -22,7 +22,8 @@ class NodesChartNodes extends React.Component {
|| (adjacentNodes && adjacentNodes.includes(node.get('id')))));
const setBlurred = node => node.set('blurred',
selectedNodeId && !node.get('focused')
|| searchQuery && !searchNodeMatches.has(node.get('id')));
|| searchQuery && !searchNodeMatches.has(node.get('id'))
&& !node.get('highlighted'));
// make sure blurred nodes are in the background
const sortNodes = node => {