feat(keyboard): add tooling specific key bindings

* space tool -> [s]
* multi select -> [m]

related to bpmn-io/bpmn-js#244
This commit is contained in:
Nico Rehwaldt 2015-05-06 17:36:46 +02:00
parent 2ef5342571
commit d54ee97aa1
3 changed files with 38 additions and 1 deletions

View File

@ -129,12 +129,12 @@ Modeler.prototype._interactionModules = [
Modeler.prototype._modelingModules = [
// modeling components
require('diagram-js/lib/features/keyboard'),
require('diagram-js/lib/features/move'),
require('diagram-js/lib/features/bendpoints'),
require('diagram-js/lib/features/resize'),
require('diagram-js/lib/features/space-tool'),
require('diagram-js/lib/features/lasso-tool'),
require('./features/keyboard'),
require('./features/snapping'),
require('./features/modeling'),
require('./features/context-pad'),

View File

@ -0,0 +1,30 @@
'use strict';
function BpmnKeyBindings(keyboard, spaceTool, lassoTool) {
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;
}
});
}
BpmnKeyBindings.$inject = [ 'keyboard', 'spaceTool', 'lassoTool' ];
module.exports = BpmnKeyBindings;

View File

@ -0,0 +1,7 @@
module.exports = {
__depends__: [
require('diagram-js/lib/features/keyboard')
],
__init__: [ 'bpmnKeyBindings' ],
bpmnKeyBindings: [ 'type', require('./BpmnKeyBindings') ]
};