feat(overlay): forward mpv mouse button and wheel bindings (#279)

This commit is contained in:
2026-10-01 00:44:51 -07:00
committed by GitHub
parent 9fadbc8cdd
commit 9e79fa93c2
18 changed files with 500 additions and 76 deletions
+16
View File
@@ -6,6 +6,7 @@ import {
createMpvKeybindingRows,
keyboardEventToConfigKey,
mouseEventToConfigKey,
wheelEventToConfigKey,
} from './key-input';
test('keyboardEventToConfigKey formats Electron accelerators from learned input', () => {
@@ -93,6 +94,21 @@ test('mouseEventToConfigKey formats mpv mouse buttons from learned input', () =>
);
});
test('wheelEventToConfigKey formats mpv wheel keys only for mpv keybindings', () => {
const wheel = {
deltaX: 0,
deltaY: -120,
deltaMode: 0,
ctrlKey: true,
altKey: false,
shiftKey: false,
metaKey: false,
};
assert.equal(wheelEventToConfigKey(wheel, 'dom-code'), 'Ctrl+WHEEL_UP');
assert.equal(wheelEventToConfigKey({ ...wheel, deltaY: 0 }, 'dom-code'), null);
assert.equal(wheelEventToConfigKey(wheel, 'accelerator'), null);
});
test('MPV keybinding rows save default key moves as a disable plus replacement', () => {
const defaults: Keybinding[] = [{ key: 'Space', command: ['cycle', 'pause'] }];
const rows = createMpvKeybindingRows(defaults, []);