Fix the issues with customized store and retrieve functions for hot keys and window/level presets

This commit is contained in:
Evren Ozkan 2017-12-13 19:41:47 -05:00
parent 6b8613017e
commit 51d6a64c45
2 changed files with 10 additions and 2 deletions

View File

@ -33,7 +33,7 @@ export class HotkeysManager {
const storageKey = `hotkeysDefinitions.${contextName}`;
return new Promise((resolve, reject) => {
if (this.storeFunction) {
this.storeFunction(contextName, definitions).then(resolve).catch(reject);
this.storeFunction.call(this, storageKey, definitions).then(resolve).catch(reject);
} else if (Meteor.userId()) {
OHIF.user.setData(storageKey, definitions).then(resolve).catch(reject);
} else {

View File

@ -50,6 +50,14 @@ class WindowLevelPresetsManager {
this.changeObserver = new Tracker.Dependency();
}
setRetrieveFunction(retrieveFunction) {
this.retrieveFunction = retrieveFunction;
}
setStoreFunction(storeFunction) {
this.storeFunction = storeFunction;
}
updateElementWLPresetData(element) {
const wlPresetData = cornerstone.getElementData(element, 'wlPreset');
const enabledElement = cornerstone.getEnabledElement(element);
@ -123,7 +131,7 @@ class WindowLevelPresetsManager {
store(wlPresets) {
return new Promise((resolve, reject) => {
if (this.storeFunction) {
this.storeFunction.call(this, wlPresets).then(resolve).catch(reject);
this.storeFunction.call(this, WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject);
} else if (Meteor.userId()) {
OHIF.user.setData(WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject);
} else {