draw(showOnlySelected) {
    if (!this.graph_) {
      console.log(
          'SelectableGraph not yet constructed. Parse error or slow response?');
      return;
    }
    this.graphView_ = new graphView.GraphView(
        this.graph_, this.graphElement_, showOnlySelected);

    this.graphView_.setHoverOnNodeCallback((nodeId, hoverOn) => {
      if (hoverOn) {
        this.highlightNode(nodeId);
      } else {
        this.unhighlightNode(nodeId);
      }
    });
    this.graphView_.setHoverOnEdgeCallback((edgeId, hoverOn) => {
      if (hoverOn) {
        this.highlightEdge(edgeId);
      } else {
        this.unhighlightEdge(edgeId);
      }
    });
    this.graphView_.setClickCallback((nodeId, ctrlPressed) => {
      if (nodeId) {
        if (ctrlPressed) {
          // Scroll the node into view in the IR text window.
          document.getElementById(`ir-node-def-${nodeId}`).scrollIntoView();
        } else {
          // Toggle the selection state.
          this.selectNode(nodeId, !this.graph_.isNodeSelected(nodeId));
        }
      } else {
        // Clicking on the graph outside of a node (nodeId == null) clears the
        // selection state.
        this.applyChange_(this.graph_.selectOnlyNodes([]));
      }
    });
  }
/**
   * Creates and renders a graph of the IR using Cytoscape. This should only be
   * called after the IR has been successfully parsed and the SelectionGraph
   * constructed.
   * @param {boolean} showOnlySelected Whether to include only selected and
   *     frontier nodes and edges in the graph.
   */
Creates and renders a graph of the IR using Cytoscape. This should only be
called after the IR has been successfully parsed and the SelectionGraph
constructed.
@param {boolean} showOnlySelected Whether to include only selected and
frontier nodes and edges in the graph.
Creates and renders a graph of the IR using Cytoscape . This should only be called after the IR has been successfully parsed and the SelectionGraph constructed . @param { boolean } showOnlySelected Whether to include only selected and frontier nodes and edges in the graph .
draw(showOnlySelected) {
    if (!this.graph_) {
      console.log(
          'SelectableGraph not yet constructed. Parse error or slow response?');
      return;
    }
    this.graphView_ = new graphView.GraphView(
        this.graph_, this.graphElement_, showOnlySelected);
    this.graphView_.setHoverOnNodeCallback((nodeId, hoverOn) => {
      if (hoverOn) {
        this.highlightNode(nodeId);
      } else {
        this.unhighlightNode(nodeId);
      }
    });
    this.graphView_.setHoverOnEdgeCallback((edgeId, hoverOn) => {
      if (hoverOn) {
        this.highlightEdge(edgeId);
      } else {
        this.unhighlightEdge(edgeId);
      }
    });
    this.graphView_.setClickCallback((nodeId, ctrlPressed) => {
      if (nodeId) {
        if (ctrlPressed) {
          document.getElementById(`ir-node-def-${nodeId}`).scrollIntoView();
        } else {
          this.selectNode(nodeId, !this.graph_.isNodeSelected(nodeId));
        }
      } else {
        this.applyChange_(this.graph_.selectOnlyNodes([]));
      }
    });
  }
draw ( showOnlySelected ) { if ( ! this . graph_ ) { console . log ( 'SelectableGraph not yet constructed. Parse error or slow response?' ) ; return ; } this . graphView_ = new graphView . GraphView ( this . graph_ , this . graphElement_ , showOnlySelected ) ; this . graphView_ . setHoverOnNodeCallback ( ( nodeId , hoverOn ) => { if ( hoverOn ) { this . highlightNode ( nodeId ) ; } else { this . unhighlightNode ( nodeId ) ; } } ) ; this . graphView_ . setHoverOnEdgeCallback ( ( edgeId , hoverOn ) => { if ( hoverOn ) { this . highlightEdge ( edgeId ) ; } else { this . unhighlightEdge ( edgeId ) ; } } ) ; this . graphView_ . setClickCallback ( ( nodeId , ctrlPressed ) => { if ( nodeId ) { if ( ctrlPressed ) { document . getElementById ( ` ${ nodeId } ` ) . scrollIntoView ( ) ; } else { this . selectNode ( nodeId , ! this . graph_ . isNodeSelected ( nodeId ) ) ; } } else { this . applyChange_ ( this . graph_ . selectOnlyNodes ( [ ] ) ) ; } } ) ; }
Creates and renders a graph of the IR using Cytoscape.
Creates and renders a graph of the IR using Cytoscape .
// Scroll the node into view in the IR text window. // Toggle the selection state. // Clicking on the graph outside of a node (nodeId == null) clears the // selection state.