From 0dacbb52ca5ffdd3587c5fb6b46134ee7cb240f2 Mon Sep 17 00:00:00 2001
From: AndiMajore <andi.majore@googlemail.com>
Date: Wed, 12 Apr 2023 19:19:41 +0200
Subject: [PATCH] fixed full reset function to work with tissue overlay

---
 .../analysis-panel/analysis-panel.component.ts       |  2 ++
 src/app/components/network/network.component.ts      | 12 ++++++++++++
 .../pages/explorer-page/explorer-page.component.ts   |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/app/components/analysis-panel/analysis-panel.component.ts b/src/app/components/analysis-panel/analysis-panel.component.ts
index bf12f851..0fc23159 100644
--- a/src/app/components/analysis-panel/analysis-panel.component.ts
+++ b/src/app/components/analysis-panel/analysis-panel.component.ts
@@ -123,6 +123,8 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit
 
   public reset() {
     this.resetEmitter.emit(true);
+    this.networkHandler.activeNetwork.selectedTissue = null;
+    this.networkHandler.activeNetwork.expressionExpanded = false;
     this.close();
   }
 
diff --git a/src/app/components/network/network.component.ts b/src/app/components/network/network.component.ts
index 739d0ecb..47754e9e 100644
--- a/src/app/components/network/network.component.ts
+++ b/src/app/components/network/network.component.ts
@@ -116,6 +116,8 @@ export class NetworkComponent implements OnInit {
   @Output() resetEmitter: EventEmitter<boolean> = new EventEmitter();
 
   public reset() {
+    this.nodeGroupsWithExpression = new Set();
+    this.nodeRenderer = null;
     this.resetEmitter.emit(true);
   }
 
@@ -130,6 +132,16 @@ export class NetworkComponent implements OnInit {
     return {edges: this.inputNetwork.edges, nodes};
   }
 
+  resetInputNetwork(){
+    const nodes = this.inputNetwork.nodes;
+    nodes.forEach(n => {
+      if (n._group) {
+        n.group = n._group;
+        delete n._group;
+      }
+    });
+  }
+
   setLoading(bool: boolean): void {
     this.loading = bool;
   }
diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts
index c616916e..d6da6cf5 100644
--- a/src/app/pages/explorer-page/explorer-page.component.ts
+++ b/src/app/pages/explorer-page/explorer-page.component.ts
@@ -48,6 +48,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
 
 
   public reset() {
+    this.networkHandler.activeNetwork.selectTissue(null);
     this.config = this.config;
     this.network = this.network;
     this.groups = this.groups;
@@ -181,7 +182,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
   }
 
 
-
   public bind(f: (token: (string | null)) => void) {
     return f.bind(this);
   }
-- 
GitLab