1

I have a VisJs network where the edges leaving the nodes are handled programatically. So, the user should not be able to change the node from where a edge comes from. However, the user is free to point the edge to any other node. More specifically, in the VisJs edit edge mode, I'd like to allow the user to edit just the to connection. How can I do this?

I'm starting the edit mode through the API.

network.editEdgeMode();
amccampos
  • 171
  • 6

1 Answers1

2

try to use this definition in the manipulation section:

editEdge: function (data, callback) {
              var orgigEdge = edges.get(data.id);

              if (data.from !== orgigEdge.from) {
                alert('you cannot change the source of the edge');
                callback(null);
              }
              else {
                callback(data);
              }
          },

see if this example feets your requirements (just click on the edge).

https://plnkr.co/edit/EakgOk9HeNTJGpRkSy9q?p=preview

TERMIN
  • 824
  • 8
  • 18