2015-05-06 15:36:46 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-21 13:18:29 +00:00
|
|
|
/**
|
|
|
|
* BPMN 2.0 specific key bindings.
|
|
|
|
*
|
|
|
|
* @param {Keyboard} keyboard
|
|
|
|
* @param {EditorActions} editorActions
|
|
|
|
*/
|
|
|
|
function BpmnKeyBindings(keyboard, editorActions) {
|
2015-10-19 06:09:58 +00:00
|
|
|
|
|
|
|
keyboard.addListener(function(key, modifiers) {
|
|
|
|
|
|
|
|
// ctrl + a -> select all elements
|
|
|
|
if (key === 65 && keyboard.isCmd(modifiers)) {
|
|
|
|
editorActions.trigger('selectElements');
|
2015-07-22 16:08:53 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-03-27 14:04:07 +00:00
|
|
|
// ctrl + f -> search labels
|
|
|
|
if (key === 70 && keyboard.isCmd(modifiers)) {
|
|
|
|
editorActions.trigger('find');
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-05-06 15:36:46 +00:00
|
|
|
if (keyboard.hasModifier(modifiers)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-05-26 12:06:16 +00:00
|
|
|
// s -> activate space tool
|
2015-05-06 15:36:46 +00:00
|
|
|
if (key === 83) {
|
2015-10-19 06:09:58 +00:00
|
|
|
editorActions.trigger('spaceTool');
|
2015-05-06 15:36:46 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-05-26 12:06:16 +00:00
|
|
|
// l -> activate lasso tool
|
|
|
|
if (key === 76) {
|
2015-10-19 06:09:58 +00:00
|
|
|
editorActions.trigger('lassoTool');
|
2015-05-06 15:36:46 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-05-06 16:09:13 +00:00
|
|
|
|
2016-01-25 13:26:26 +00:00
|
|
|
// h -> activate hand tool
|
|
|
|
if (key === 72) {
|
|
|
|
editorActions.trigger('handTool');
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-13 10:36:19 +00:00
|
|
|
// 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
|
2015-05-06 16:09:13 +00:00
|
|
|
if (key === 69) {
|
2015-10-19 06:09:58 +00:00
|
|
|
editorActions.trigger('directEditing');
|
2015-05-06 16:09:13 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-05-06 15:36:46 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-07-22 16:08:53 +00:00
|
|
|
BpmnKeyBindings.$inject = [
|
|
|
|
'keyboard',
|
2015-10-19 06:09:58 +00:00
|
|
|
'editorActions'
|
2015-07-22 16:08:53 +00:00
|
|
|
];
|
2015-05-06 15:36:46 +00:00
|
|
|
|
2016-06-21 13:18:29 +00:00
|
|
|
module.exports = BpmnKeyBindings;
|