diff --git a/src/atlasViewer/atlasViewer.template.html b/src/atlasViewer/atlasViewer.template.html index 04f4b488d98fe01ee01a4995318e2a49067c9e7c..85b14f2aff0545c8f5551cb6eb73fa4733dc5da0 100644 --- a/src/atlasViewer/atlasViewer.template.html +++ b/src/atlasViewer/atlasViewer.template.html @@ -174,7 +174,6 @@ </layout-floating-container> <div pluginFactoryDirective> - </div> </div> diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts index 9c8496ccf529ad10b7d7e5032df43a435febf9d4..095e983f26c8a38aec6e22eaf4916a8d90f501a4 100644 --- a/src/ui/nehubaContainer/nehubaContainer.component.ts +++ b/src/ui/nehubaContainer/nehubaContainer.component.ts @@ -349,7 +349,15 @@ export class NehubaContainer implements OnInit, OnDestroy{ /* order of subscription will determine the order of execution */ this.subscriptions.push( - this.newViewer$.subscribe((state)=>{ + this.newViewer$.pipe( + map(state => { + const deepCopiedState = JSON.parse(JSON.stringify(state)) + const navigation = deepCopiedState.templateSelected.nehubaConfig.dataset.initialNgState.navigation + navigation.zoomFactor = calculateSliceZoomFactor(navigation.zoomFactor) + deepCopiedState.templateSelected.nehubaConfig.dataset.initialNgState.navigation = navigation + return deepCopiedState + }) + ).subscribe((state)=>{ this.nehubaViewerSubscriptions.forEach(s=>s.unsubscribe()) @@ -652,6 +660,10 @@ export class NehubaContainer implements OnInit, OnDestroy{ private createNewNehuba(template:any){ + /** + * TODO if plugin subscribes to viewerHandle, and then new template is selected, changes willl not be be sent + * could be considered as a bug. + */ this.apiService.interactiveViewer.viewerHandle = null this.viewerLoaded = true @@ -1049,4 +1061,8 @@ export const userLmUnchanged = (oldlms, newlms) => { return oldlms.every(lm => singleLmUnchanged(lm, newmap as Map<string,[number,number,number]>)) && newlms.every(lm => singleLmUnchanged(lm, oldmap as Map<string, [number,number,number]>)) -} \ No newline at end of file +} + +export const calculateSliceZoomFactor = (originalZoom) => originalZoom + ? 700 * originalZoom / Math.min(window.innerHeight, window.innerWidth) + : 1e7 \ No newline at end of file