Fix zoom-in accelerators
Template tests / tests (push) Successful in 1m53s

This commit is contained in:
2026-07-07 12:45:49 -05:00
parent 058cdc20ab
commit 9e13ea9c40
2 changed files with 8 additions and 3 deletions
+5 -3
View File
@@ -409,13 +409,15 @@ function createWindow() {
function registerHotkeys() { function registerHotkeys() {
globalShortcut.unregisterAll(); globalShortcut.unregisterAll();
const zoomBindings = [ const zoomBindings = [
['CommandOrControl+=', 'in'], ['CommandOrControl+Plus', 'in'],
['CommandOrControl+Shift+=', 'in'], ['CommandOrControl+Shift+=', 'in'],
['CommandOrControl+Add', 'in'], ['CommandOrControl+=', 'in'],
['CommandOrControl+numadd', 'in'],
['CommandOrControl+-', 'out'], ['CommandOrControl+-', 'out'],
['CommandOrControl+Minus', 'out'], ['CommandOrControl+Minus', 'out'],
['CommandOrControl+Subtract', 'out'], ['CommandOrControl+numsub', 'out'],
['CommandOrControl+0', 'fit'], ['CommandOrControl+0', 'fit'],
['CommandOrControl+num0', 'fit'],
]; ];
for (const [accel, kind] of zoomBindings) { for (const [accel, kind] of zoomBindings) {
try { try {
+3
View File
@@ -11,6 +11,7 @@ const {
test('zoom shortcut helper recognizes zoom in, out, and fit across event shapes', () => { test('zoom shortcut helper recognizes zoom in, out, and fit across event shapes', () => {
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '=', code: 'Equal' }), 'in'); assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '=', code: 'Equal' }), 'in');
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '+', code: 'NumpadAdd' }), 'in'); assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '+', code: 'NumpadAdd' }), 'in');
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: 'Plus', code: 'Equal' }), 'in');
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '-', code: 'Minus' }), 'out'); assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '-', code: 'Minus' }), 'out');
assert.equal(zoomShortcutFromKeyboardEvent({ metaKey: true, key: '0', code: 'Digit0' }), 'fit'); assert.equal(zoomShortcutFromKeyboardEvent({ metaKey: true, key: '0', code: 'Digit0' }), 'fit');
assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '=', code: 'Equal', shiftKey: true }), 'in'); assert.equal(zoomShortcutFromKeyboardEvent({ ctrlKey: true, key: '=', code: 'Equal', shiftKey: true }), 'in');
@@ -18,6 +19,8 @@ test('zoom shortcut helper recognizes zoom in, out, and fit across event shapes'
test('zoom shortcut helper recognizes Electron before-input-event payloads', () => { test('zoom shortcut helper recognizes Electron before-input-event payloads', () => {
assert.equal(zoomShortcutFromInputEvent({ control: true, key: '=', code: 'Equal' }), 'in'); assert.equal(zoomShortcutFromInputEvent({ control: true, key: '=', code: 'Equal' }), 'in');
assert.equal(zoomShortcutFromInputEvent({ control: true, key: '=', code: 'Equal', shift: true }), 'in');
assert.equal(zoomShortcutFromInputEvent({ control: true, key: 'Plus', code: 'Equal', shift: true }), 'in');
assert.equal(zoomShortcutFromInputEvent({ control: true, key: '-', code: 'Minus' }), 'out'); assert.equal(zoomShortcutFromInputEvent({ control: true, key: '-', code: 'Minus' }), 'out');
assert.equal(zoomShortcutFromInputEvent({ meta: true, key: '0', code: 'Digit0' }), 'fit'); assert.equal(zoomShortcutFromInputEvent({ meta: true, key: '0', code: 'Digit0' }), 'fit');
}); });