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) => {
|
return new Promise((resolve, reject) => {
|
||||||
const context = this.getContext(contextName);
|
const context = this.getContext(contextName);
|
||||||
if (!context) return;
|
if (!context) return;
|
||||||
this.retrieve(contextName).then(definitions => {
|
this.retrieve(contextName).then(defs => {
|
||||||
|
const definitions = defs || this.defaults[contextName];
|
||||||
if (!definitions) {
|
if (!definitions) {
|
||||||
this.changeObserver.changed();
|
this.changeObserver.changed();
|
||||||
return reject();
|
return reject();
|
||||||
|
|||||||
@ -121,24 +121,22 @@ class WindowLevelPresetsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
store(wlPresets) {
|
store(wlPresets) {
|
||||||
const self = this;
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (self.storeFunction) {
|
if (this.storeFunction) {
|
||||||
self.storeFunction(wlPresets).then(resolve).catch(reject);
|
this.storeFunction.call(this, wlPresets).then(resolve).catch(reject);
|
||||||
} else if (Meteor.userId()) {
|
} else if (Meteor.userId()) {
|
||||||
OHIF.user.setData(WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject);
|
OHIF.user.setData(WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject);
|
||||||
} else {
|
} else {
|
||||||
Session.setPersistent(WL_STORAGE_KEY, wlPresets);
|
Session.setPersistent(WL_STORAGE_KEY, wlPresets);
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
}).then(() => self.setOHIFWLPresets(wlPresets));
|
}).then(() => this.setOHIFWLPresets.call(this, wlPresets));
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieve() {
|
retrieve() {
|
||||||
const self = this;
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (self.retrieveFunction) {
|
if (this.retrieveFunction) {
|
||||||
self.retrieveFunction().then(resolve).catch(reject);
|
this.retrieveFunction.call(this).then(resolve).catch(reject);
|
||||||
} else if (OHIF.user) {
|
} else if (OHIF.user) {
|
||||||
try {
|
try {
|
||||||
resolve(OHIF.user.getData(WL_STORAGE_KEY));
|
resolve(OHIF.user.getData(WL_STORAGE_KEY));
|
||||||
@ -152,15 +150,14 @@ class WindowLevelPresetsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
load() {
|
load() {
|
||||||
const self = this;
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.retrieve().then(wlPresets => {
|
this.retrieve().then(wlPresets => {
|
||||||
if (wlPresets) {
|
if (wlPresets) {
|
||||||
self.setOHIFWLPresets(wlPresets);
|
this.setOHIFWLPresets.call(this, wlPresets);
|
||||||
} else {
|
} else {
|
||||||
self.loadDefaults();
|
this.loadDefaults.call(this);
|
||||||
}
|
}
|
||||||
}).catch(self.loadDefaults);
|
}).catch(() => this.loadDefaults.call(this));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user