From 78068bed4b994bca5a3e805828542b0ffe966caa Mon Sep 17 00:00:00 2001 From: dannyrb Date: Sat, 8 Jun 2019 15:25:39 -0400 Subject: [PATCH] push default hotkeys to a shared location --- public/config/default.js | 55 ++----------------------------- public/config/defaults/hotkeys.js | 52 +++++++++++++++++++++++++++++ public/config/netlify.js | 5 ++- 3 files changed, 59 insertions(+), 53 deletions(-) create mode 100644 public/config/defaults/hotkeys.js diff --git a/public/config/default.js b/public/config/default.js index c9e2bd5ab..e33e64e63 100644 --- a/public/config/default.js +++ b/public/config/default.js @@ -1,3 +1,5 @@ +import hotkeys from 'defaults/hotkeys.js'; + window.config = { // default: '/' routerBasename: '/', @@ -19,56 +21,5 @@ window.config = { }, ], }, - /** - * This maps registered commands to default hotkey values. - */ - hotkeys: [ - // ~ Global - { - commandName: 'incrementActiveViewport', - label: 'Next Image Viewport', - keys: ['right'], - }, - { - commandName: 'decrementActiveViewport', - label: 'Previous Image Viewport', - keys: ['left'], - }, - // Supported Keys: https://craig.is/killing/mice - // ~ Cornerstone Extension - { commandName: 'rotateViewportCW', label: 'Rotate Right', keys: ['r'] }, - { commandName: 'rotateViewportCCW', label: 'Rotate Left', keys: ['l'] }, - { commandName: 'invertViewport', label: 'Invert', keys: ['i'] }, - { - commandName: 'flipViewportVertical', - label: 'Flip Horizontally', - keys: ['h'], - }, - { - commandName: 'flipViewportHorizontal', - label: 'Flip Vertically', - keys: ['v'], - }, - { commandName: 'scaleUpViewport', label: 'Zoom In', keys: ['+'] }, - { commandName: 'scaleDownViewport', label: 'Zoom Out', keys: ['-'] }, - { commandName: 'fitViewportToWindow', label: 'Zoom to Fit', keys: ['='] }, - { commandName: 'resetViewport', label: 'Reset', keys: ['space'] }, - // clearAnnotations - // nextImage - // previousImage - // firstImage - // lastImage - { - commandName: 'nextViewportDisplaySet', - label: 'Previous Series', - keys: ['pagedown'], - }, - { - commandName: 'previousViewportDisplaySet', - label: 'Next Series', - keys: ['pageup'], - }, - // ~ Cornerstone Tools - { commandName: 'setZoomTool', label: 'Zoom', keys: ['z'] }, - ], + hotkeys, }; diff --git a/public/config/defaults/hotkeys.js b/public/config/defaults/hotkeys.js new file mode 100644 index 000000000..284ffbd86 --- /dev/null +++ b/public/config/defaults/hotkeys.js @@ -0,0 +1,52 @@ +/** + * This maps registered commands to default hotkey values. + */ +export default [ + // ~ Global + { + commandName: 'incrementActiveViewport', + label: 'Next Image Viewport', + keys: ['right'], + }, + { + commandName: 'decrementActiveViewport', + label: 'Previous Image Viewport', + keys: ['left'], + }, + // Supported Keys: https://craig.is/killing/mice + // ~ Cornerstone Extension + { commandName: 'rotateViewportCW', label: 'Rotate Right', keys: ['r'] }, + { commandName: 'rotateViewportCCW', label: 'Rotate Left', keys: ['l'] }, + { commandName: 'invertViewport', label: 'Invert', keys: ['i'] }, + { + commandName: 'flipViewportVertical', + label: 'Flip Horizontally', + keys: ['h'], + }, + { + commandName: 'flipViewportHorizontal', + label: 'Flip Vertically', + keys: ['v'], + }, + { commandName: 'scaleUpViewport', label: 'Zoom In', keys: ['+'] }, + { commandName: 'scaleDownViewport', label: 'Zoom Out', keys: ['-'] }, + { commandName: 'fitViewportToWindow', label: 'Zoom to Fit', keys: ['='] }, + { commandName: 'resetViewport', label: 'Reset', keys: ['space'] }, + // clearAnnotations + // nextImage + // previousImage + // firstImage + // lastImage + { + commandName: 'nextViewportDisplaySet', + label: 'Previous Series', + keys: ['pagedown'], + }, + { + commandName: 'previousViewportDisplaySet', + label: 'Next Series', + keys: ['pageup'], + }, + // ~ Cornerstone Tools + { commandName: 'setZoomTool', label: 'Zoom', keys: ['z'] }, +]; diff --git a/public/config/netlify.js b/public/config/netlify.js index 179130c9a..9f2669a25 100644 --- a/public/config/netlify.js +++ b/public/config/netlify.js @@ -1,3 +1,5 @@ +import hotkeys from 'defaults/hotkeys.js'; + window.config = { routerBasename: '/demo', servers: { @@ -16,4 +18,5 @@ window.config = { }, ], }, -} + hotkeys, +};