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:
parent
2ef5342571
commit
d54ee97aa1
|
@ -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'),
|
||||
|
|
|
@ -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;
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/keyboard')
|
||||
],
|
||||
__init__: [ 'bpmnKeyBindings' ],
|
||||
bpmnKeyBindings: [ 'type', require('./BpmnKeyBindings') ]
|
||||
};
|
Loading…
Reference in New Issue