jsketcher/web/app/sketcher/shortkeys.js
NetzerRosenfeld a26240d632
Bug fix in keysmap and short keys. (#169)
ctrl +s , ctrl+o and open terminal command now working, F1 and ctrl + n are not working.
There was problem of case sensitive.

Co-authored-by: Val Erastov <xibyte@gmail.com>
2022-08-19 18:56:41 -07:00

15 lines
413 B
JavaScript

import {keymap} from './keymaps/default'
import Mousetrap from 'mousetrap';
import {getSketcherActionIndex} from "./actions";
export function initShortkeys(ctx) {
for (const action of Object.keys(keymap)) {
Mousetrap.bind(keymap[action], e =>{
e.preventDefault();//prevent the browser to execute it's keyboard handlers.
getSketcherActionIndex()[action].invoke(ctx,e);
});
}
}