Skip to content

Commit

Permalink
Merge pull request #21 from qnmn/neighbor-dragging
Browse files Browse the repository at this point in the history
Neighbor highlighting ignore drags
  • Loading branch information
JohnCoene committed Jan 29, 2021
2 parents a42d147 + 29149c9 commit a470c80
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion inst/htmlwidgets/sigmajs.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ HTMLWidgets.widget({
return;
}
if (on == "clickStage") {
if (e.data.captor.isDragging) {
return; // ignore clicks while dragging
}
nodeHasBeenClicked = false; // stop locking of highlighting
}
s.graph.nodes().forEach(function (n) {
Expand Down Expand Up @@ -602,6 +605,9 @@ HTMLWidgets.widget({
case "edges":
return_value = e.data.edges;
break;
case "captor":
return_value = e.data.captor;
break;
default:
return_value = what_to_return;
}
Expand Down Expand Up @@ -638,7 +644,7 @@ HTMLWidgets.widget({
bindEvent("clickNodes", "_click_nodes", "nodes");
bindEvent("clickEdge", "_click_edge", "edge");
bindEvent("clickEdges", "_click_edges", "edges");
bindEvent("clickStage", "_click_stage", "clickStage", "event");
bindEvent("clickStage", "_click_stage", "captor", "event");
bindEvent("doubleClickNode", "_double_click_node", "node");
bindEvent("doubleClickNodes", "_double_click_nodes", "nodes");
bindEvent("doubleClickEdge", "_double_click_edge", "edge");
Expand Down Expand Up @@ -1411,6 +1417,9 @@ if (HTMLWidgets.shinyMode) {
return;
}
if (on == "clickStage") {
if (e.data.captor.isDragging) {
return; // ignore clicks while dragging
}
nodeHasBeenClicked = false; // stop locking of highlighting
}
s.graph.nodes().forEach(function (n) {
Expand Down

0 comments on commit a470c80

Please sign in to comment.