chore(enabled-element-hooks): Allow hooks to run when viewport is enabled
This commit is contained in:
parent
d28ec41893
commit
1e97a3eff7
@ -23,6 +23,9 @@ const allCornerstoneEvents = ['click', 'cornerstonetoolsmousedown', 'cornerstone
|
|||||||
|
|
||||||
const PLUGIN_CORNERSTONE = 'cornerstone';
|
const PLUGIN_CORNERSTONE = 'cornerstone';
|
||||||
|
|
||||||
|
// Create a way to add hooks to be executed every time a cornerstone element is enabled
|
||||||
|
OHIF.viewer.cornerstoneElementHooks = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function loads a study series into a viewport element.
|
* This function loads a study series into a viewport element.
|
||||||
*
|
*
|
||||||
@ -99,6 +102,13 @@ const loadDisplaySetIntoViewport = (data, templateData) => {
|
|||||||
};
|
};
|
||||||
cornerstone.enable(element, options);
|
cornerstone.enable(element, options);
|
||||||
|
|
||||||
|
// Call every defined hook
|
||||||
|
OHIF.viewer.cornerstoneElementHooks.forEach(hook => {
|
||||||
|
if (typeof hook === 'function') {
|
||||||
|
hook(element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Get the handler functions that will run when loading has finished or thrown
|
// Get the handler functions that will run when loading has finished or thrown
|
||||||
// an error. These are used to show/hide loading / error text boxes on each viewport.
|
// an error. These are used to show/hide loading / error text boxes on each viewport.
|
||||||
const endLoadingHandler = cornerstoneTools.loadHandlerManager.getEndLoadHandler();
|
const endLoadingHandler = cornerstoneTools.loadHandlerManager.getEndLoadHandler();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user