kblincoe / VisualGit_SE701_2019_1

1 stars 0 forks source link

[WIKI] User Guide Page for Dragging Nodes #320

Open rmberriman opened 5 years ago

rmberriman commented 5 years ago

Description As discussed in #298 when a user clicks and drags the nodes on the graph, they can be dragged freely but snap back to its original position with a slight offset. This was initially presumed to be a bug when it is in fact a feature that allows for merging and prevents any issues in the graph. A page on the Wiki in the User Guide should be created detailing this functionality to prevent user confusion.

Acceptance criteria

Related issues

298

SamuelZheng11 commented 5 years ago

Approved

liamtbrand commented 5 years ago

The current code snippet in question is in file graphSetup.ts.

network.on('dragStart', function(callback) {
  startP = callback.pointer.canvas;
});

network.on('dragEnd', function(cb) {
  fromNode = cb.nodes[0];
  network.moveNode(fromNode, startP.x, startP.y);
  secP = cb.pointer.DOM;
}, false);

network.on('animationFinished', function() {
  if (fromNode !== null && secP !== null) {
    const toNode = network.getNodeAt(secP);

    if (fromNode !== toNode && (nodes.get(fromNode)['shape'] === 'box') && (nodes.get(toNode)['shape'] === 'box')) {
      mergeCommits(nodes.get(fromNode)['title']);
    }
  }
  fromNode = null;
  secP = null;
});

The issue is that the network.on('animationFinished', ... function never seems to be called. I will try to get this working and if I can then we can update the docs and fix it. Otherwise it may be best to fix the nodes like @SamuelZheng11 recommended in #298.

hhagenson28 commented 5 years ago

Approved!

liamtbrand commented 5 years ago

Approved. We should fix the functionality in #323 before the wiki page is added so that users do not think they can already do this when it is currently not working properly.