Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Tool Keybindings: allow for other keys than modifier keys or mouse keys #1632

Open
nagychris opened this issue Nov 28, 2024 · 2 comments

Comments

@nagychris
Copy link

What feature or change would you like to see made?

I would like to use other keybindings like SHIFT+A+leftclick to activate a tool.
However, to my current knowledge and what I saw in the docs / code of cornerstone3d (https://github.com/cornerstonejs/cornerstone3D/blob/bb71a514486a519a45468b1f474b5c2c0bb25575/packages/tools/src/enums/ToolBindings.ts), this is currently not possible as the ToolBindings only support mouse / modifier keys.

It would be amazing to have a flexible third parameter to pass to the ToolGroup.setToolActive (i.e., https://github.com/cornerstonejs/cornerstone3D/blob/bb71a514486a519a45468b1f474b5c2c0bb25575/packages/tools/src/store/ToolGroupManager/ToolGroup.ts#L346C10-L346C) so that it also supports to pass another flexible key (e.g. listening to the keydown event - see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)

Why should we prioritize this feature?

Would remove the need to implement this feature on my own, and makes the library tools more flexible to use.

Copy link
Member

sedghi commented Dec 2, 2024

It is possible see this example https://www.cornerstonejs.org/live-examples/modifierkeys

@nagychris
Copy link
Author

nagychris commented Dec 3, 2024

It is possible see this example https://www.cornerstonejs.org/live-examples/modifierkeys

@sedghi Correct me if I am wrong, but I can only see modifier keys and mouse keys there, but no letter keys like A or Z...

I already tried to implement the feature on my own, by just listening to keydown and keyup events, and setting the respective tool active / passive, so that I can use the tool as long as the buttons are pressed. But it doesn't work somehow, probably because cornerstone3D handles all the mouse events on the viewport and stops propagation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants