-
Notifications
You must be signed in to change notification settings - Fork 133
Keyboard zoom #293
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
base: main
Are you sure you want to change the base?
Keyboard zoom #293
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -712,26 +712,19 @@ export function init() { | |||
| ]); | ||||
| } | ||||
|
|
||||
| // zoom listener | ||||
| document.onkeydown = zoomQrCode; | ||||
|
|
||||
| /** | ||||
| * Listens to Alt + plus/minus keypresses to alter | ||||
| * QR code size. | ||||
| * | ||||
| * @function | ||||
| * @returns {void} | ||||
| */ | ||||
| function zoomQrCode(e) { | ||||
| var evtobj = window.event ? event : e; | ||||
| if (evtobj.keyCode == 61 && evtobj.altKey && qrLastSize < 440) { | ||||
| document.addEventListener('keydown', function(event) { | ||||
| if ((event.key == '=' || event.key == '+') && event.altKey && qrLastSize < 440) { | ||||
| setNewQrCodeSize(qrLastSize + 30, true); | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note
So yeah, I dunno whether my idea of remembering it additionally, was a good idea, but it seems okay'ish. |
||||
|
|
||||
| localStorage.setItem("lastSize", qrLastSize); | ||||
| } | ||||
| if (evtobj.keyCode == 173 && evtobj.altKey && qrLastSize > 50) { | ||||
| if (event.key == '-' && event.altKey && qrLastSize > 50) { | ||||
| setNewQrCodeSize(qrLastSize - 30, true); | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah and could you extract the
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for Just place the constants at the top, there should be some, already. 😉 |
||||
|
|
||||
| localStorage.setItem("lastSize", qrLastSize); | ||||
| } | ||||
| } | ||||
| }); | ||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,7 +125,3 @@ html, body { | |
| color: var(--white-100); | ||
| } | ||
| } | ||
|
|
||
| #zoomTooltip { | ||
| font-weight: 700; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naaaw, I would still keep the function
zoomQrCodeor so you had… You can just reference that here AFAIK.