Allowing W/L Presets customization
This commit is contained in:
1 parent
4d9300f6c4
commit
e6b5a21ae2
14 files changed
+303
-173
No files matched your search
@@ -6,13 +6,13 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
import { HotkeysContext } from 'meteor/ohif:hotkeys/client/classes/HotkeysContext';
|
||||
|
||||
export class HotkeysManager {
|
||||
constructor(retrieveFunction, storeFunction) {
|
||||
constructor() {
|
||||
this.contexts = {};
|
||||
this.defaults = {};
|
||||
this.currentContextName = null;
|
||||
this.enabled = new ReactiveVar(true);
|
||||
this.retrieveFunction = retrieveFunction;
|
||||
this.storeFunction = storeFunction;
|
||||
this.retrieveFunction = null;
|
||||
this.storeFunction = null;
|
||||
this.changeObserver = new Tracker.Dependency();
|
||||
|
||||
Tracker.autorun(() => {
|
||||
@@ -21,6 +21,14 @@ export class HotkeysManager {
|
||||
});
|
||||
}
|
||||
|
||||
setRetrieveFunction(retrieveFunction) {
|
||||
this.retrieveFunction = retrieveFunction;
|
||||
}
|
||||
|
||||
setStoreFunction(storeFunction) {
|
||||
this.storeFunction = storeFunction;
|
||||
}
|
||||
|
||||
store(contextName, definitions) {
|
||||
const storageKey = `hotkeysDefinitions.${contextName}`;
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -73,7 +81,11 @@ export class HotkeysManager {
|
||||
const context = this.getContext(contextName);
|
||||
if (!context) return;
|
||||
this.retrieve(contextName).then(definitions => {
|
||||
if (!definitions) return reject();
|
||||
if (!definitions) {
|
||||
this.changeObserver.changed();
|
||||
return reject();
|
||||
}
|
||||
|
||||
context.extend(definitions);
|
||||
this.changeObserver.changed();
|
||||
resolve(definitions);
|
||||
|
||||
Reference in new issue
Block a user