From 05ad8dc90a7f5774d26ff98fe2cae6bd6a145a84 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Thu, 21 Oct 2021 10:34:27 +0200
Subject: [PATCH] WIP

---
 src/util/pipes/combineFn.pipe.ts                   | 13 +++++++++++++
 src/util/pureConstant.service.ts                   |  2 +-
 src/util/util.module.ts                            |  3 +++
 src/viewerModule/viewerCmp/viewerCmp.component.ts  |  7 +++++--
 src/viewerModule/viewerCmp/viewerCmp.template.html | 11 +++++++++++
 5 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 src/util/pipes/combineFn.pipe.ts

diff --git a/src/util/pipes/combineFn.pipe.ts b/src/util/pipes/combineFn.pipe.ts
new file mode 100644
index 000000000..f3291cc2a
--- /dev/null
+++ b/src/util/pipes/combineFn.pipe.ts
@@ -0,0 +1,13 @@
+import { Pipe, PipeTransform } from "@angular/core";
+
+@Pipe({
+  name: 'combineFn',
+  pure: true
+})
+export class CombineFnPipe implements PipeTransform{
+  public transform(fns: Function[]): Function{
+    return () => {
+      for (const fn of fns) fn()
+    }
+  }
+}
diff --git a/src/util/pureConstant.service.ts b/src/util/pureConstant.service.ts
index 3bc26cba9..47a83a47d 100644
--- a/src/util/pureConstant.service.ts
+++ b/src/util/pureConstant.service.ts
@@ -750,7 +750,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
               const precomputedArr = tmpl._dataset_specs.filter(src => src['@type'] === 'fzj/tmp/volume_type/v0.0.1' && src.volume_type === 'neuroglancer/precomputed') as TVolumeSrc<'neuroglancer/precomputed'>[]
               let visible = true
               let tmplNgId: string
-              let templateImages: TTemplateImage[] = []
+              const templateImages: TTemplateImage[] = []
               for (const precomputedItem of precomputedArr) {
                 const ngIdKey = MultiDimMap.GetKey(precomputedItem["@id"])
                 initialLayers[ngIdKey] = {
diff --git a/src/util/util.module.ts b/src/util/util.module.ts
index 4d817736e..649508a28 100644
--- a/src/util/util.module.ts
+++ b/src/util/util.module.ts
@@ -20,6 +20,7 @@ import { GetPropertyPipe } from "./pipes/getProperty.pipe";
 import { FilterArrayPipe } from "./pipes/filterArray.pipe";
 import { DoiParserPipe } from "./pipes/doiPipe.pipe";
 import { GetFilenamePipe } from "./pipes/getFilename.pipe";
+import { CombineFnPipe } from "./pipes/combineFn.pipe";
 
 @NgModule({
   imports:[
@@ -45,6 +46,7 @@ import { GetFilenamePipe } from "./pipes/getFilename.pipe";
     FilterArrayPipe,
     DoiParserPipe,
     GetFilenamePipe,
+    CombineFnPipe,
   ],
   exports: [
     FilterRowsByVisbilityPipe,
@@ -66,6 +68,7 @@ import { GetFilenamePipe } from "./pipes/getFilename.pipe";
     FilterArrayPipe,
     DoiParserPipe,
     GetFilenamePipe,
+    CombineFnPipe,
   ]
 })
 
diff --git a/src/viewerModule/viewerCmp/viewerCmp.component.ts b/src/viewerModule/viewerCmp/viewerCmp.component.ts
index 3134f6e03..e494f5244 100644
--- a/src/viewerModule/viewerCmp/viewerCmp.component.ts
+++ b/src/viewerModule/viewerCmp/viewerCmp.component.ts
@@ -195,9 +195,12 @@ export class ViewerCmp implements OnDestroy {
     this.selectedRegions$,
     this.pliVol$.pipe(
       startWith([])
-    )
+    ),
+    this.viewerMode$.pipe(
+      startWith(null as string)
+    ),
   ]).pipe(
-    map(([ regions, layers ]) => regions.length === 0 && layers.length === 0)
+    map(([ regions, layers, viewerMode ]) => regions.length === 0 && layers.length === 0 && !viewerMode)
   )
 
   @ViewChild('viewerStatusCtxMenu', { read: TemplateRef })
diff --git a/src/viewerModule/viewerCmp/viewerCmp.template.html b/src/viewerModule/viewerCmp/viewerCmp.template.html
index 27b714034..c07c20bde 100644
--- a/src/viewerModule/viewerCmp/viewerCmp.template.html
+++ b/src/viewerModule/viewerCmp/viewerCmp.template.html
@@ -313,6 +313,17 @@
           #toolPanel="annoToolsPanel">
         </annotating-tools-panel>
       </ng-template>
+
+      <ng-template [ngSwitchCase]="ARIA_LABELS.VIEWER_MODE_KEYFRAME">
+
+        <ng-container *ngTemplateOutlet="tabTmpl_defaultTmpl; context: {
+          matColor: 'primary',
+          fontIcon: 'fa-play',
+          tooltip: 'Annotation list',
+          click: toggleMatDrawer
+        }">
+        </ng-container>
+      </ng-template>
     </ng-container>
   </div>
 </ng-template>
-- 
GitLab