Add Shift+Numpad0/1/2 zoom shortcut aliases (#2457) (#9063)

Signed-off-by: RenzoMXD <170978465+RenzoMXD@users.noreply.github.com>
This commit is contained in:
Renzo 2026-04-24 09:08:31 +02:00 committed by GitHub
parent 50bee5e176
commit 8aacda2249
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 5 deletions

View File

@ -46,7 +46,7 @@
- Add a search bar to filter colors in the color palette toolbar (by @eureka0928) [Github #7653](https://github.com/penpot/penpot/issues/7653)
- Allow customising the OIDC login button label (by @wdeveloper16) [Github #7027](https://github.com/penpot/penpot/issues/7027)
- Add page separators in Workspace [Taiga #13611](https://tree.taiga.io/project/penpot/us/13611?milestone=262806)
- Add Shift+Numpad0/1/2 as aliases to Shift+0/1/2 for zoom shortcuts [Github #2457](https://github.com/penpot/penpot/issues/2457)
### :bug: Bugs fixed

View File

@ -187,6 +187,14 @@ function _addEvent(object, type, callback) {
*/
function _characterFromEvent(e) {
// Numpad digits as "num0".."num9" — keeps them separate from main-row bindings across NumLock states and event types.
if (e.code && e.code.indexOf('Numpad') === 0) {
var suffix = e.code.substring(6);
if (suffix.length === 1 && suffix >= '0' && suffix <= '9') {
return 'num' + suffix;
}
}
// for keypress events we should return the character as is
if (e.type == 'keypress') {
var character = String.fromCharCode(e.which);

View File

@ -514,17 +514,17 @@
:fn #(st/emit! (dw/decrease-zoom))}
:reset-zoom {:tooltip (ds/shift "0")
:command "shift+0"
:command ["shift+0" "shift+num0"]
:subsections [:zoom-workspace]
:fn #(st/emit! dw/reset-zoom)}
:fit-all {:tooltip (ds/shift "1")
:command "shift+1"
:command ["shift+1" "shift+num1"]
:subsections [:zoom-workspace]
:fn #(st/emit! dw/zoom-to-fit-all)}
:zoom-selected {:tooltip (ds/shift "2")
:command ["shift+2" "@" "\""]
:command ["shift+2" "shift+num2" "@" "\""]
:subsections [:zoom-workspace]
:fn #(st/emit! dw/zoom-to-selected-shape)}
@ -626,7 +626,7 @@
(range 10)
(map (fn [n] [(keyword (str "opacity-" n))
{:tooltip (str n)
:command (str n)
:command [(str n) (str "num" n)]
:subsections [:modify-layers]
:fn #(emit-when-no-readonly (dwly/pressed-opacity n))}])))))