With my Vis.js network I've got an even listener to catch double click on a node.
PROBLEM: once I double click a node, it starts being dragged. Somehow node drag starts and node is glued to the mouse coursor until mouse click. How can this be prevented?
On double click I get the id of clicked node, next I get adjacent nodes and for each one I call a function to add them to an Array.
Then I call nodes.update() - and all works great. Except for the dragging that I have no idea where is it coming from.
// initialize the network!
network = new vis.Network(container, data, getOptions(networkLayout));
network.fit();
// add event listener for double click on node
network.on("doubleClick", function (params) {
// get the id of the clicked node
var clickedNodeId = params.nodes[0];
var nodesToUpdate = [];
// get the adjacent nodes of the clicked node
var adjacentNodes = network.getConnectedNodes(clickedNodeId);
adjacentNodes.forEach(addAdjacentNodesToUpdate);
function addAdjacentNodesToUpdate(nodeId, index) {
nodesToUpdate.push({id: nodeId, hidden: false, physics: true});
}
nodes.update(nodesToUpdate);
showHideEdges(nodesToUpdate);
});
It seems to have been some kind of browser glitch. It worked fine on another machine, so I went back to the first one and did the usual: tried a different browser, tried private mode, cleared cache - it's working fine now, the issue is gone. Just made me lose some time.