Skip to content
Snippets Groups Projects
Commit 98a6689d authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Improved handling of addings new nodes

parent 60bbd301
No related branches found
Tags v1.0rc0
1 merge request!2Implemented editor in the react framework
Pipeline #56703 passed
......@@ -171,6 +171,21 @@ export class Graph extends ManagedData {
node.id = this.nextNodeId;
this.nextNodeId += 1;
// Is valid node?
if (node.label == undefined) {
node.label = "Unnamed";
}
if (node.type == undefined) {
if (this.types.length > 0) {
// Just give first type in list
node.type = this.types[0];
} else {
// Give empty type
// TODO: Properly add new type, with proper ID. Implemented this.addType(..);
node.type = new NodeType(this);
}
}
this.data.nodes.push(node);
this.triggerOnChange();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment