Is it possible to detect left click on a path/link. I am wondering how to detect it inside mousedown. I see this link how-to-distinguish-between-left-and-right-mouse-click-with-jquery but might be the possible solution.
As you can see in the code. I apply true to the variable isLeftClick in the contextmenu so that when I am clicking on the mousedown the value of the isLeftClick is false. But the problem is that the mousedown will go first.
isLeftClick = false;
path.enter().append('svg:path')
.attr('class', 'link')
.classed('selected', function(d) { return d === selected_link; 
})
.on('mousedown', function(d) {
  // detect if it is right or left click
  if(isLeftClick == true){ 
     //if left click do something
    isDraggingLink = true;
  } 
  restart();
}).on('contextmenu', function(d){
    isLeftClick = true;
    // Open a context menu for link/path
    console.log("link contextmenu");
});
 
     
    