feat(plugins): Add pluginData to viewportData so that plugins can manage their own data

This commit is contained in:
Erik Ziegler committed 2018-08-09 10:45:58 +02:00
1 parent f6b82baae3
commit ddbe8b38aa
3 files changed
+11 -6

No files matched your search

@@ -64,7 +64,6 @@ export class ViewportPlugin extends OHIFPlugin {
const viewportData = layoutManager.viewportData[viewportIndex];
if (viewportData.plugin === this.name) {
OHIF.log.info(`setViewportToPlugin: Viewport ${viewportIndex} already set to plugin ${this.name}`);
return;
}
viewportData.plugin = this.name;
@@ -102,16 +101,18 @@ export class ViewportPlugin extends OHIFPlugin {
// Retrieve the list of all viewports, so we can figure out the viewport details
const allViewports = Array.from(document.querySelectorAll('.viewportContainer'));
const { layoutManager } = OHIF.viewerbase;
emptyPluginDivs.forEach(div => {
// Identify the Viewport index, and any display set that is currently
// hung in the viewport
const viewportIndex = allViewports.indexOf(div.parentNode);
const viewportDetails = { viewportIndex };
const viewportData = layoutManager.viewportData[viewportIndex];
const displaySet = ViewportPlugin.getDisplaySet(viewportIndex);
// Use the plugin's setupViewport function to render the contents
// of this viewport.
this.setupViewport(div, viewportDetails, displaySet);
this.setupViewport(div, viewportData, displaySet);
});
}