diff --git a/src/App.js b/src/App.js index 6215a8a99..9c50f99ec 100644 --- a/src/App.js +++ b/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 = { diff --git a/src/hotkeys/index.js b/src/hotkeys/index.js index 31add2027..ca4e8366d 100644 --- a/src/hotkeys/index.js +++ b/src/hotkeys/index.js @@ -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, +// };