src/components/graph/graph.builder.js
function _getNodeOpacity(node, highlightedNode, highlightedLink, config) {
    const highlight =
        node.highlighted ||
        node.id === (highlightedLink && highlightedLink.source) ||
        node.id === (highlightedLink && highlightedLink.target);
    const someNodeHighlighted = !!(
        highlightedNode ||
        (highlightedLink && highlightedLink.source && highlightedLink.target)
    );
    let opacity;

    if (someNodeHighlighted && config.highlightDegree === 0) {
        opacity = highlight ? config.node.opacity : config.highlightOpacity;
    } else if (someNodeHighlighted) {
        opacity = highlight ? config.node.opacity : config.highlightOpacity;
    } else {
        opacity = node.opacity || config.node.opacity;
    }

    return opacity;
}
function _getNodeOpacity(node, highlightedNode, highlightedLink, config) {
    const highlight =
        node.highlighted ||
        node.id === (highlightedLink && highlightedLink.source) ||
        node.id === (highlightedLink && highlightedLink.target);
    const someNodeHighlighted = !!(
        highlightedNode ||
        (highlightedLink && highlightedLink.source && highlightedLink.target)
    );
    let opacity;

    if (someNodeHighlighted && config.highlightDegree === 0) {
        opacity = highlight ? config.node.opacity : config.highlightOpacity;
    } else if (someNodeHighlighted) {
        opacity = highlight ? config.node.opacity : config.highlightOpacity;
    } else {
        opacity = node.opacity || config.node.opacity;
    }

    return opacity;
}
function _getNodeOpacity ( node , highlightedNode , highlightedLink , config ) { const highlight = node . highlighted || node . id === ( highlightedLink && highlightedLink . source ) || node . id === ( highlightedLink && highlightedLink . target ) ; const someNodeHighlighted = ! ! ( highlightedNode || ( highlightedLink && highlightedLink . source && highlightedLink . target ) ) ; let opacity ; if ( someNodeHighlighted && config . highlightDegree === 0 ) { opacity = highlight ? config . node . opacity : config . highlightOpacity ; } else if ( someNodeHighlighted ) { opacity = highlight ? config . node . opacity : config . highlightOpacity ; } else { opacity = node . opacity || config . node . opacity ; } return opacity ; }
Get the correct node opacity in order to properly make decisions based on context such as currently highlighted node.
@param  {Object} node - the node object for whom we will generate properties.
@param  {string} highlightedNode - same as {@link #graphrenderer|highlightedNode in renderGraph}.
@param  {Object} highlightedLink - same as {@link #graphrenderer|highlightedLink in renderGraph}.
@param  {Object} config - same as {@link #graphrenderer|config in renderGraph}.
@returns {number} the opacity value for the given node.
@memberof Graph/builder
Get the correct node opacity in order to properly make decisions based on context such as currently highlighted node .