From 582e5d0e490c6b18b1050bff84764d7ca94a4058 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Thu, 12 May 2022 14:47:36 +0200 Subject: [PATCH] bugfix: annotation color --- deploy/csp/index.js | 1 + src/viewerModule/nehuba/annotation/service.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/csp/index.js b/deploy/csp/index.js index cfc8cb82b..51a3cf159 100644 --- a/deploy/csp/index.js +++ b/deploy/csp/index.js @@ -108,6 +108,7 @@ module.exports = { "'self'", ...userScriptSrc, 'unpkg.com/kg-dataset-previewer@1.2.0/', // preview component + 'cdnjs.cloudflare.com/ajax/libs/d3/', // required for preview component 'cdnjs.cloudflare.com/ajax/libs/mathjax/', // math jax 'https://unpkg.com/three-surfer@0.0.11/dist/bundle.js', // for threeSurfer (freesurfer support in browser) 'https://unpkg.com/ng-layer-tune@0.0.5/dist/ng-layer-tune/', // needed for ng layer control diff --git a/src/viewerModule/nehuba/annotation/service.ts b/src/viewerModule/nehuba/annotation/service.ts index 0bfd9f926..fcc109e8f 100644 --- a/src/viewerModule/nehuba/annotation/service.ts +++ b/src/viewerModule/nehuba/annotation/service.ts @@ -23,7 +23,8 @@ export class NgAnnotationService implements OnDestroy { static GET_ANN_LAYER(ann: annotation.UnionAnnotation): AnnotationLayer { const color = ann.color || annotation.AnnotationColor.WHITE - const layerName = `${NgAnnotationService.ANNOTATION_LAYER_NAME}-${annotation.AnnotationColor[color]}` + const layerEnum = annotation.AnnotationColor[color] || annotation.AnnotationColor.WHITE + const layerName = `${NgAnnotationService.ANNOTATION_LAYER_NAME}-${layerEnum}` const annLayer = AnnotationLayer.Get(layerName, NgAnnotationService.COLOR_MAP.get(color) || "#ffffff") NgAnnotationService.INIT_LAYERS.add(layerName) @@ -35,6 +36,7 @@ export class NgAnnotationService implements OnDestroy { const layer = AnnotationLayer.Get(layername, '#ffffff') layer.dispose() }) + NgAnnotationService.INIT_LAYERS.clear() while(this.subs.length) this.subs.pop().unsubscribe() } -- GitLab