Fixed adding to an empty workspace

This commit is contained in:
Pünkösd Marcell 2020-12-04 22:55:33 +01:00
parent 89208e2d38
commit 6dd38c3c16

View File

@ -103,9 +103,13 @@ export default {
break;
}
const max_id = maxBy(this.diagram.nodes, 'id').id
if (this.diagram.nodes.length > 0) {
const max_id = maxBy(this.diagram.nodes, 'id').id
newNode.id = max_id + 1;
newNode.id = max_id + 1;
} else {
newNode.id = 0;
}
this.diagram.nodes.push(newNode)