OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.35k stars 3.37k forks source link

[Bug] Hotkeys rebinding by keyboard key fails to work correctly #4455

Open wayfarer3130 opened 1 week ago

wayfarer3130 commented 1 week ago

Describe the Bug

When rebinding a keyboard key to a new key, with a different action, the old binding can be removed, or can be left depending on ordering issues in the binding. As well, two keys cannot be bound to the same action.

Steps to Reproduce

Rebind the pageup key with: { commandName: 'incrementActiveViewport', label: 'Next Image Viewport', keys: 'pageup', isEditable: true, },

added as a new binding. This may or may not take affect depending on the keyboard binding setup.

The expected behaviour is that the pageup key binding gets replaced with the new command.

The current behavior

The binding may or may not occur depending on ordering

The expected behavior

The new binding should be updated correctly, and should allow binding to multiple keys.

OS

Windows 11

Node version

NA

Browser

Chrome

sedghi commented 1 week ago

You need to modify your configuration file. There are hotkeys there. Have you done that?
platform/app/public/config/default.js

hotkeys: [
    {
      commandName: 'incrementActiveViewport',
      label: 'Next Viewport',
      keys: ['right'],
    },
    {
      commandName: 'decrementActiveViewport',
      label: 'Previous Viewport',
      keys: ['left'],
    },
    { commandName: 'rotateViewportCW', label: 'Rotate Right', keys: ['r'] },
    { commandName: 'rotateViewportCCW', label: 'Rotate Left', keys: ['l'] },
    { commandName: 'invertViewport', label: 'Invert', keys: ['i'] },
    {
wayfarer3130 commented 1 week ago

It is ordering dependent, if you assign an existing assigned key to a new function, for example { commandName: 'rotateViewportCW', label: 'Rotate Right', keys: ['r'] }, { commandName: 'invertViewport, label: 'Rotate Right', keys: ['r'] }, { commandName: 'rotateViewportCW', label: 'Rotate Right', keys: ['right'] }, then the ordering will delete one of the commands.