Fixing issues with hotkeys and presets
This commit is contained in:
parent
29a8a3db8f
commit
e93c18c28f
@ -80,7 +80,8 @@ export class HotkeysManager {
|
||||
return new Promise((resolve, reject) => {
|
||||
const context = this.getContext(contextName);
|
||||
if (!context) return;
|
||||
this.retrieve(contextName).then(definitions => {
|
||||
this.retrieve(contextName).then(defs => {
|
||||
const definitions = defs || this.defaults[contextName];
|
||||
if (!definitions) {
|
||||
this.changeObserver.changed();
|
||||
return reject();
|
||||
|
||||
@ -121,24 +121,22 @@ class WindowLevelPresetsManager {
|
||||
}
|
||||
|
||||
store(wlPresets) {
|
||||
const self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
if (self.storeFunction) {
|
||||
self.storeFunction(wlPresets).then(resolve).catch(reject);
|
||||
if (this.storeFunction) {
|
||||
this.storeFunction.call(this, wlPresets).then(resolve).catch(reject);
|
||||
} else if (Meteor.userId()) {
|
||||
OHIF.user.setData(WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject);
|
||||
} else {
|
||||
Session.setPersistent(WL_STORAGE_KEY, wlPresets);
|
||||
resolve();
|
||||
}
|
||||
}).then(() => self.setOHIFWLPresets(wlPresets));
|
||||
}).then(() => this.setOHIFWLPresets.call(this, wlPresets));
|
||||
}
|
||||
|
||||
retrieve() {
|
||||
const self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
if (self.retrieveFunction) {
|
||||
self.retrieveFunction().then(resolve).catch(reject);
|
||||
if (this.retrieveFunction) {
|
||||
this.retrieveFunction.call(this).then(resolve).catch(reject);
|
||||
} else if (OHIF.user) {
|
||||
try {
|
||||
resolve(OHIF.user.getData(WL_STORAGE_KEY));
|
||||
@ -152,15 +150,14 @@ class WindowLevelPresetsManager {
|
||||
}
|
||||
|
||||
load() {
|
||||
const self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.retrieve().then(wlPresets => {
|
||||
this.retrieve().then(wlPresets => {
|
||||
if (wlPresets) {
|
||||
self.setOHIFWLPresets(wlPresets);
|
||||
this.setOHIFWLPresets.call(this, wlPresets);
|
||||
} else {
|
||||
self.loadDefaults();
|
||||
this.loadDefaults.call(this);
|
||||
}
|
||||
}).catch(self.loadDefaults);
|
||||
}).catch(() => this.loadDefaults.call(this));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user