mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
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>
15 lines
413 B
JavaScript
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);
|
|
|
|
});
|
|
}
|
|
}
|