2015-05-06 15:36:46 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
2015-05-06 16:09:13 +00:00
|
|
|
function BpmnKeyBindings(keyboard, spaceTool, lassoTool, directEditing, selection) {
|
2015-05-06 15:36:46 +00:00
|
|
|
|
|
|
|
keyboard.addListener(function(key, modifiers) {
|
|
|
|
|
|
|
|
if (keyboard.hasModifier(modifiers)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// S -> activate space tool
|
|
|
|
if (key === 83) {
|
|
|
|
spaceTool.activateSelection();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// M -> activate multi select tool
|
|
|
|
if (key === 77) {
|
|
|
|
lassoTool.activateSelection();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-05-06 16:09:13 +00:00
|
|
|
|
|
|
|
var currentSelection = selection.get();
|
|
|
|
|
|
|
|
// E -> activate direct editing
|
|
|
|
if (key === 69) {
|
|
|
|
if (currentSelection.length) {
|
|
|
|
directEditing.activate(currentSelection[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-05-06 15:36:46 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-05-06 16:09:13 +00:00
|
|
|
BpmnKeyBindings.$inject = [ 'keyboard', 'spaceTool', 'lassoTool', 'directEditing', 'selection' ];
|
2015-05-06 15:36:46 +00:00
|
|
|
|
|
|
|
module.exports = BpmnKeyBindings;
|