Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

[WIKI] User Guide Page for Dragging Nodes #320

Open
rmberriman opened this issue Apr 12, 2019 · 4 comments
Open

[WIKI] User Guide Page for Dragging Nodes #320

rmberriman opened this issue Apr 12, 2019 · 4 comments
Labels
Approved very small Wiki For issues related to wiki content

Comments

@rmberriman
Copy link
Collaborator

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

  • Page created in the User Guide section of the Wiki detailing the dragging nodes functionality on the graph

Related issues
#298

@rmberriman rmberriman added very small Wiki For issues related to wiki content labels Apr 12, 2019
@SamuelZheng11
Copy link
Collaborator

Approved

@liamtbrand
Copy link
Collaborator

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
Copy link
Collaborator

Approved!

@liamtbrand
Copy link
Collaborator

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Approved very small Wiki For issues related to wiki content
Projects
None yet
Development

No branches or pull requests

4 participants