bpmn-js/lib/features/keyboard/BpmnKeyBindings.js

69 lines
1.3 KiB
JavaScript
Raw Normal View History

/**
* BPMN 2.0 specific key bindings.
*
* @param {Keyboard} keyboard
* @param {EditorActions} editorActions
*/
export default function BpmnKeyBindings(keyboard, editorActions) {
keyboard.addListener(function(key, modifiers) {
// ctrl + a -> select all elements
if (key === 65 && keyboard.isCmd(modifiers)) {
editorActions.trigger('selectElements');
return true;
}
// ctrl + f -> search labels
if (key === 70 && keyboard.isCmd(modifiers)) {
editorActions.trigger('find');
return true;
}
if (keyboard.hasModifier(modifiers)) {
return;
}
2015-05-26 12:06:16 +00:00
// s -> activate space tool
if (key === 83) {
editorActions.trigger('spaceTool');
return true;
}
2015-05-26 12:06:16 +00:00
// l -> activate lasso tool
if (key === 76) {
editorActions.trigger('lassoTool');
return true;
}
// h -> activate hand tool
if (key === 72) {
editorActions.trigger('handTool');
return true;
}
// c -> activate global connect tool
if (key === 67) {
editorActions.trigger('globalConnectTool');
return true;
}
2015-05-26 12:06:16 +00:00
// e -> activate direct editing
if (key === 69) {
editorActions.trigger('directEditing');
return true;
}
});
}
BpmnKeyBindings.$inject = [
'keyboard',
'editorActions'
];