Skip to content

Commit

Permalink
add label in order to have node name displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Oct 3, 2023
1 parent 9f6a078 commit 69373c4
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,20 +231,24 @@ export class GraphEventHandlerModel {

onCanvasDblClicked(): void {
const maxId: number = Math.max(
...this.graph._nodes.map(node => parseInt(node.id))
...this.graph.nodes().map(node => parseInt(node.id))
)
const newId = maxId + 1

// TODO: make label, properties EDITABLE in followup PR's
this.graph.addNodes([
new NodeModel(
newId.toString(),
[],
['Undefined'],
{ name: 'New Node' },
{ name: 'string' }
)
])
this.visualization.update({ updateNodes: true, updateRelationships: true })
this.visualization.update({
updateNodes: true,
updateRelationships: true,
restartSimulation: true
})

// this will persist node to Neo4J DB...
this.onGraphInteraction(NODE_ON_CANVAS_CREATE)
Expand Down

0 comments on commit 69373c4

Please sign in to comment.