From fddcc746d922221d31f154b69513e89f8a45b100 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Sat, 8 Jun 2019 21:23:00 -0400 Subject: [PATCH] No ESM in vanilla modules --- public/config/default.js | 54 +++++++++++++++++++++++++++++-- public/config/defaults/hotkeys.js | 52 ----------------------------- public/config/netlify.js | 52 +++++++++++++++++++++++++++-- 3 files changed, 100 insertions(+), 58 deletions(-) delete mode 100644 public/config/defaults/hotkeys.js diff --git a/public/config/default.js b/public/config/default.js index e33e64e63..2c7c92018 100644 --- a/public/config/default.js +++ b/public/config/default.js @@ -1,5 +1,3 @@ -import hotkeys from 'defaults/hotkeys.js'; - window.config = { // default: '/' routerBasename: '/', @@ -21,5 +19,55 @@ window.config = { }, ], }, - hotkeys, + // Extensions should be able to suggest default values for these? + // Or we can require that these be explicitly set + 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'] }, + ], }; diff --git a/public/config/defaults/hotkeys.js b/public/config/defaults/hotkeys.js deleted file mode 100644 index 284ffbd86..000000000 --- a/public/config/defaults/hotkeys.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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 9f2669a25..49cd1e7e4 100644 --- a/public/config/netlify.js +++ b/public/config/netlify.js @@ -1,5 +1,3 @@ -import hotkeys from 'defaults/hotkeys.js'; - window.config = { routerBasename: '/demo', servers: { @@ -18,5 +16,53 @@ window.config = { }, ], }, - hotkeys, + 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'] }, + ], };