<commit_before>function selectEdgeOnClickHandler(adj, e) {
  
  if (Mconsole.busy) return;
  
  //editing overrides everything else
  if (e.altKey) {
    //in select-edit-delete-nodes-and-edges.js
    editEdge(adj, e);
    return;
  }

  var showDesc = adj.getData("showDesc");
  if (showDesc && e.shiftKey) {
    //deselecting an edge with shift
    deselectEdge(adj);
  } else if (!showDesc && e.shiftKey) {
    //selecting an edge with shift
    selectEdge(adj);
  } else if (showDesc && !e.shiftKey) {
    //deselecting an edge without shift - unselect all
    deselectAllEdges();
  } else if (!showDesc && !e.shiftKey) {
    //selecting an edge without shift - unselect all but new one
    deselectAllEdges();
    selectEdge(adj);
  }

  Mconsole.plot();
}//selectEdgeOnClickHandler

function nodeDoubleClickHandler(node, e) {
  node.setData('onCanvas', true);
  node.setData('inCommons', false);
  console.log("Here's the node you clicked:");
  console.log(node);
  //if ($('.maps.onMap').length > 0 && node.getData('mappingid')) {
  //  //TODO
  //  var mappingId = createAMapping(alert('unimp'));
  //  node.setData('mappingid', mappingId);
  //}
}//doubleClickNodeHandler

function nodeWasDoubleClicked() {
   //grab the timestamp of the click 
   var storedTime = MetamapsModel.lastNodeClick;
   var now = Date.now(); //not compatible with IE8 FYI 
   MetamapsModel.lastNodeClick = now;
 
   if (now - storedTime < MetamapsModel.DOUBLE_CLICK_TOLERANCE) { 
     return true;
   } else {
     return false;
   }
}//nodeWasDoubleClicked;

function selectNodeOnClickHandler(node, e) {
  if (Mconsole.busy) return;

  if (nodeWasDoubleClicked()) {
    nodeDoubleClickHandler(node, e);
    return;
  }
  
  if (gType != "centered") {
      //set final styles
      if (!e.shiftKey) {
          Mconsole.graph.eachNode(function (n) {
            if (n.id != node.id) {
                delete n.selected;
                n.setData('onCanvas',false);
            }
      
            n.setData('dim', 25, 'current');
            n.eachAdjacency(function (adj) {
              deselectEdge(adj);
            });
          });
      }
      if (!node.selected) {
        node.selected = true;
        node.setData('dim', 30, 'current');
        node.setData('onCanvas',true);
        node.eachAdjacency(function (adj) {
          selectEdge(adj);
        });
        Mconsole.plot();
      } else {
        node.setData('dim', 25, 'current');
        delete node.selected;
        node.setData('onCanvas',false);
      }
      //trigger animation to final styles
      Mconsole.fx.animate({
        modes: ['edge-property:lineWidth:color:alpha'],
        duration: 500
      });
      Mconsole.plot();
  }
}//selectNodeOnClickHandler

function canvasDoubleClickHandler(canvasLoc,e) { 
   //grab the location and timestamp of the click <commit_msg>added selectNode and deselectNode functions<commit_after>function selectEdgeOnClickHandler(adj, e) {
  
  if (Mconsole.busy) return;
  
  //editing overrides everything else
  if (e.altKey) {
    //in select-edit-delete-nodes-and-edges.js
    editEdge(adj, e);
    return;
  }

  var showDesc = adj.getData("showDesc");
  if (showDesc && e.shiftKey) {
    //deselecting an edge with shift
    deselectEdge(adj);
  } else if (!showDesc && e.shiftKey) {
    //selecting an edge with shift
    selectEdge(adj);
  } else if (showDesc && !e.shiftKey) {
    //deselecting an edge without shift - unselect all
    deselectAllEdges();
  } else if (!showDesc && !e.shiftKey) {
    //selecting an edge without shift - unselect all but new one
    deselectAllEdges();
    selectEdge(adj);
  }

  Mconsole.plot();
}//selectEdgeOnClickHandler

function nodeDoubleClickHandler(node, e) {
  node.setData('onCanvas', true);
  node.setData('inCommons', false);
  console.log("Here's the node you clicked:");
  console.log(node);
  //if ($('.maps.onMap').length > 0 && node.getData('mappingid')) {
  //  //TODO
  //  var mappingId = createAMapping(alert('unimp'));
  //  node.setData('mappingid', mappingId);
  //}
}//doubleClickNodeHandler

function nodeWasDoubleClicked() {
   //grab the timestamp of the click 
   var storedTime = MetamapsModel.lastNodeClick;
   var now = Date.now(); //not compatible with IE8 FYI 
   MetamapsModel.lastNodeClick = now;
 
   if (now - storedTime < MetamapsModel.DOUBLE_CLICK_TOLERANCE) { 
     return true;
   } else {
     return false;
   }
}//nodeWasDoubleClicked;

function selectNode(node) {
  node.selected = true;
  node.setData('dim', 30, 'current');
  node.setData('onCanvas',true);
  node.eachAdjacency(function (adj) {
    selectEdge(adj);
  });
}

function deselectNode(node) {
  delete node.selected;
  node.setData('onCanvas', false);
  node.eachAdjacency(function(adj) {
    deselectEdge(adj);
  });
  node.setData('dim', 25, 'current');
}

function selectNodeOnClickHandler(node, e) {
  if (Mconsole.busy) return;

  if (nodeWasDoubleClicked()) {
    nodeDoubleClickHandler(node, e);
    return;
  }
  
  if (gType != "centered") {
      //set final styles
      if (!e.shiftKey) {
          Mconsole.graph.eachNode(function (n) {
            if (n.id != node.id) {
              deselectNode(n);
            }
          });
      }
      if (node.selected) {
        deselectNode(node);
      } else {
        selectNode(node);
      }
      //trigger animation to final styles
      Mconsole.fx.animate({
        modes: ['edge-property:lineWidth:color:alpha'],
        duration: 500
      });
      Mconsole.plot();
  }
}//selectNodeOnClickHandler

function canvasDoubleClickHandler(canvasLoc,e) { 
   //grab the location and timestamp of the click 
{'fraction_non_alphanumeric': 0.13796164772727273, 'fraction_numerical': 0.0035511363636363635, 'mean_word_length': 2.7206076618229855, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '934220', 'n_tokens_mistral': 1857, 'n_tokens_neox': 1812, 'n_words': 400}