From b9b9a0f00dfc1dccf6fee905974538e15963c318 Mon Sep 17 00:00:00 2001 From: Aysel Afsar Date: Sat, 7 Oct 2017 11:57:22 -0400 Subject: [PATCH] OHIF-177: Show thumbnail progress bar in the StandaloneViewer --- .../standaloneViewerMain.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.js b/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.js index 672b029db..c0a5c653a 100644 --- a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.js +++ b/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.js @@ -25,15 +25,23 @@ Template.standaloneViewerMain.onRendered(() => { const studies = instance.data.studies; const parentElement = instance.$('#layoutManagerTarget').get(0); + const studyPrefetcher = OHIF.viewerbase.StudyPrefetcher.getInstance(); + instance.studyPrefetcher = studyPrefetcher; + + instance.studyLoadingListener = OHIF.viewerbase.StudyLoadingListener.getInstance(); + instance.studyLoadingListener.clear(); + instance.studyLoadingListener.addStudies(studies); + OHIF.viewerbase.layoutManager = new OHIF.viewerbase.LayoutManager(parentElement, studies); OHIF.viewerbase.layoutManager.updateViewports(); + studyPrefetcher.setStudies(studies); + // Enable hotkeys OHIF.viewerbase.hotkeyUtils.enableHotkeys(); }); Template.standaloneViewerMain.onDestroyed(() => { - // Remove the Window resize listener window.removeEventListener('resize', window.ResizeViewportManager.getResizeHandler()); @@ -41,4 +49,13 @@ Template.standaloneViewerMain.onDestroyed(() => { OHIF.viewer.updateImageSynchronizer.destroy(); delete OHIF.viewerbase.layoutManager; + + // Stop prefetching when we close the viewer + instance.studyPrefetcher.destroy(); + + // Destroy stack loading listeners when we close the viewer + instance.studyLoadingListener.clear(); + + // Clear references to all stacks in the StackManager + OHIF.viewerbase.stackManager.clearStacks(); });