Change HotkeyDefinition to include label

This commit is contained in:
dannyrb 2019-06-05 21:29:50 -04:00
parent 347680fdf5
commit 49fe195089
2 changed files with 46 additions and 41 deletions

View File

@ -19,44 +19,56 @@ window.config = {
},
],
},
//
userPreferences: [
{
order: 0,
title: 'preference page title',
items: [
{
order: 0,
label: 'Scale Viewport Up',
command: 'scaleUpViewport',
},
],
},
],
//
hotkeys: {
/**
* This maps registered commands to default hotkey values.
*/
hotkeys: [
// ~ Global
incrementActiveViewport: ['right'],
decrementActiveViewport: ['left'],
{
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
rotateViewportCW: ['r'],
rotateViewportCCW: ['l'],
invertViewport: ['i'],
flipViewportVertical: ['h'],
flipViewportHorizontal: ['v'],
scaleUpViewport: ['+'],
scaleDownViewport: ['-'],
fitViewportToWindow: ['='],
resetViewport: ['space'],
{ 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
nextViewportDisplaySet: ['pageup'],
previousViewportDisplaySet: ['pagedown'],
{
commandName: 'nextViewportDisplaySet',
label: 'Previous Series',
keys: ['pagedown'],
},
{
commandName: 'previousViewportDisplaySet',
label: 'Next Series',
keys: ['pageup'],
},
// ~ Cornerstone Tools
setZoomTool: ['z'],
},
{ commandName: 'setZoomTool', label: 'Zoom', keys: ['z'] },
],
};

View File

@ -40,16 +40,9 @@ const _commandsManager = new CommandsManager(commandsManagerConfig);
const _hotkeysManager = new HotkeysManager(_commandsManager);
// TODO: Should be done in extensions w/ commandsModule
// ADD COMMANDS
// ~~ ADD COMMANDS
appCommands.init(_commandsManager);
// window.config.userPreferences
Object.keys(window.config.hotkeys).forEach(commandName => {
const keys = window.config.hotkeys[commandName];
// HotkeysManager.set();
console.log(`registering hotkey: ${commandName} to binding: ${keys}`);
_hotkeysManager.registerHotkeys(commandName, keys);
});
_hotkeysManager.setHotkeys(window.config.hotkeys, true);
// Force active contexts for now. These should be set in Viewer/ActiveViewer
store.dispatch({
@ -61,7 +54,7 @@ store.dispatch({
item: 'VIEWER::CORNERSTONE',
});
// ~~~~ END EPP SETUP
// ~~~~ END APP SETUP
setupTools(store);