From 189dfc931f18de7aad24b65f2b9a7c0970f80f99 Mon Sep 17 00:00:00 2001
From: Maximilian Giller <m.giller@tu-bs.de>
Date: Mon, 29 Aug 2022 23:41:32 +0200
Subject: [PATCH] Adjusted rendering of labels

---
 src/editor/js/components/editor.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/editor/js/components/editor.tsx b/src/editor/js/components/editor.tsx
index f66cdf4..dc8f961 100644
--- a/src/editor/js/components/editor.tsx
+++ b/src/editor/js/components/editor.tsx
@@ -305,7 +305,12 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
         }
 
         // Draw label
-        if (this.state.visibleLabels) {
+        const isNodeRelatedToSelection: boolean =
+            this.state.selectedNode === undefined ||
+            this.isHighlighted(node) ||
+            this.state.selectedNode.neighbors.includes(node);
+
+        if (this.state.visibleLabels && isNodeRelatedToSelection) {
             const label = node.label;
             const fontSize = 11 / globalScale;
             ctx.font = `${fontSize}px Sans-Serif`;
-- 
GitLab