From ee911b8833f241b1278fcdde0a376f583f14600d Mon Sep 17 00:00:00 2001 From: Max <m.giller.dev@gmail.com> Date: Tue, 9 Nov 2021 21:05:37 +0100 Subject: [PATCH] Fixed missing color when adding new node and link --- editor/js/graph.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/js/graph.js b/editor/js/graph.js index 7c447e9..665a9e5 100644 --- a/editor/js/graph.js +++ b/editor/js/graph.js @@ -75,7 +75,7 @@ export class Graph extends ManagedData { // Deactivate physics after a short delay this.physicsStopTimeoutId = setTimeout(() => { this.stopPhysics(); - this.storeCurrentData("Physics stopped"); + this.storeCurrentData("Physics stopped", false); this.physicsStopTimeoutId = undefined; }, this.physicsDelay); } @@ -116,6 +116,10 @@ export class Graph extends ManagedData { getTypeColor(typeClass) { var classIndex = this.nodeTypes.indexOf(typeClass); + if (classIndex <= -1) { + return 'black'; + } + return COLOR_PALETTE[classIndex % COLOR_PALETTE.length]; } -- GitLab