Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 149x 149x 149x 149x 149x | import { KeyboardBindings as kb } from '../../enums';
/**
* Gets the mouse modifier key from a mouse event.
* Supports Shift, Ctrl, Alt, in singly and in combinations of 2
* Supports Meta singly.
*/
const getMouseModifierKey = (evt) => {
// The logic is a hard coded key mapping
Iif (evt.shiftKey) {
if (evt.ctrlKey) return kb.ShiftCtrl;
if (evt.altKey) return kb.ShiftAlt;
if (evt.metaKey) return kb.ShiftMeta;
return kb.Shift;
}
Iif (evt.ctrlKey) {
if (evt.altKey) return kb.CtrlAlt;
if (evt.metaKey) return kb.CtrlMeta;
return kb.Ctrl;
}
Iif (evt.altKey) {
return (evt.metaKey && kb.AltMeta) || kb.Alt;
}
Iif (evt.metaKey) {
kb.Meta;
}
return undefined;
};
export default getMouseModifierKey;
|