Playing with a hotkeys + commands setup and config
This commit is contained in:
parent
d29f996e61
commit
b0706e5544
11
src/App.js
11
src/App.js
@ -23,8 +23,19 @@ import WhiteLabellingContext from './WhiteLabellingContext';
|
||||
import setupTools from './setupTools';
|
||||
import store from './store';
|
||||
|
||||
// Register all of our commands and hotkeys
|
||||
import commands from './commands';
|
||||
|
||||
const { ExtensionManager } = OHIF.extensions;
|
||||
|
||||
commands.init();
|
||||
// window.config.userPreferences
|
||||
Object.keys(window.config.hotkeys).forEach(commandName => {
|
||||
const keys = window.config.hotkeys[commandName];
|
||||
// OHIF.HotkeysManager.set();
|
||||
OHIF.HotkeysManager.registerHotkeys(commandName, keys);
|
||||
});
|
||||
|
||||
setupTools(store);
|
||||
|
||||
const children = {
|
||||
|
||||
@ -1,38 +1,38 @@
|
||||
import { HotkeysManager } from 'ohif-core';
|
||||
import store from './store';
|
||||
// import { HotkeysManager } from 'ohif-core';
|
||||
// import store from './store';
|
||||
|
||||
function initialize() {
|
||||
// binding, method,
|
||||
const numHotkeys = hotkeyConfig.length;
|
||||
for (let i = 0; i < numHotkeys; i++) {
|
||||
const { keys, actionName, actionContexts, options } = hotkeyConfig[i];
|
||||
const action = actions[actionName];
|
||||
// function initialize() {
|
||||
// // binding, method,
|
||||
// const numHotkeys = hotkeyConfig.length;
|
||||
// for (let i = 0; i < numHotkeys; i++) {
|
||||
// const { keys, actionName, actionContexts, options } = hotkeyConfig[i];
|
||||
// const action = actions[actionName];
|
||||
|
||||
Mousetrap.bind(keys, () => {
|
||||
let actionParams = options;
|
||||
actionContexts.forEach(context => {
|
||||
actionParams[context] = store.getState()[context];
|
||||
});
|
||||
action(actionParams);
|
||||
});
|
||||
}
|
||||
// Mousetrap.bind(keys, () => {
|
||||
// let actionParams = options;
|
||||
// actionContexts.forEach(context => {
|
||||
// actionParams[context] = store.getState()[context];
|
||||
// });
|
||||
// action(actionParams);
|
||||
// });
|
||||
// }
|
||||
|
||||
const hotkeysPreferences = store.getState().preferences;
|
||||
const hotkeysViewerContext = hotkeysPreferences.viewer;
|
||||
const hotkeysData = hotkeysViewerContext.hotkeysData;
|
||||
// const hotkeysPreferences = store.getState().preferences;
|
||||
// const hotkeysViewerContext = hotkeysPreferences.viewer;
|
||||
// const hotkeysData = hotkeysViewerContext.hotkeysData;
|
||||
|
||||
Object.keys(hotkeysData).forEach(hotkeyName => {
|
||||
// context,
|
||||
const hotkeyCommandName = hotkeysData[hotkeyName];
|
||||
HotkeysManager.register();
|
||||
});
|
||||
}
|
||||
// Object.keys(hotkeysData).forEach(hotkeyName => {
|
||||
// // context,
|
||||
// const hotkeyCommandName = hotkeysData[hotkeyName];
|
||||
// HotkeysManager.register();
|
||||
// });
|
||||
// }
|
||||
|
||||
function clear() {
|
||||
HotkeysManager.clear();
|
||||
}
|
||||
// function clear() {
|
||||
// HotkeysManager.clear();
|
||||
// }
|
||||
|
||||
export default {
|
||||
clear,
|
||||
initialize,
|
||||
};
|
||||
// export default {
|
||||
// clear,
|
||||
// initialize,
|
||||
// };
|
||||
|
||||
Loading…
Reference in New Issue
Block a user