Skip to content
New issue

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

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

Already on GitHub? # to your account

Updated Keyboard Inputs #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jdpj518
Copy link

@jdpj518 jdpj518 commented Feb 21, 2025

Enhanced the code to use the new KeyboardEvent.key property to determine what key is pressed. Primary reason was to enable the Numeric Keypad + and - keys to work just like the main keyboard + and -. Maintained previous properties for backwards compatibility with older browsers.

Enhanced the code to use the new KeyboardEvent.key property to determine what key is pressed.  Primary reason was to enable the Numeric Keypad + and - keys to work just like the main keyboard + and -.  Maintained previous properties for backwards compatibility with older browsers.
@jdpj518
Copy link
Author

jdpj518 commented Feb 21, 2025

Big fan of your library here! I've used it in an image viewing site for several years now. This week I added a custom button to the footer toolbar, and also updated the package to the latest version. While testing, I found that the + and - keys on the numeric keypad were not registering for the associated image action, so I updated that block of the JS and also made the KeyboardEvent.key property the default value, since keyCode is now depreciated. Using "key" also solved the issue of which "+" key was pressed.

This is the first time I've forked a public repo and raised a possible change, so please let me know if I screwed the process up at all. :-)

Thanks!

John

@nzbin
Copy link
Owner

nzbin commented Feb 22, 2025

Please don't modify the dist files, you should modify the src/js/core.js

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

Successfully merging this pull request may close these issues.

2 participants