Lugaxx
Lugaxx

Reputation: 331

Via dynamic user interaction can a node be created and/or linked in cytoscape.js?

Is it possible to implement the following usability concept in cytoscape.js?

  1. Users can add new nodes to the grid by left-clicking on an empty spot.
  2. Users can connect two nodes A and B by pressing the left mouse button over A and releasing the left button mouse button over B. (While users are holding the left mouse button a "preview edge" appears between A and the current mouse position.)

Upvotes: 0

Views: 475

Answers (1)

maxkfranz
maxkfranz

Reputation: 12242

For (1), you could use cy.on('tap', ...) and determine the grid row/col based on the model co-ordinates of the event.

As of 2016-08-19, there are two existing extensions for helping with grid alignment UI:

Generally, extensions have a demo.html so you can explore their features. There is a list in the docs, and new ones are being added all the time (both first party and third party).

You may also be interested in the grid layout.

For (2), there are extensions that do exactly what you mention, each with different extra features and options:

Upvotes: 1

Related Questions