improve(resize): restrict resizable elements
related bpmn-io/bpmn-js#140
This commit is contained in:
parent
392dfaee41
commit
1e224370e2
|
@ -69,7 +69,8 @@ Modeler.prototype._modelingModules = [
|
|||
require('diagram-js/lib/features/resize'),
|
||||
require('./features/modeling'),
|
||||
require('./features/context-pad'),
|
||||
require('./features/palette')
|
||||
require('./features/palette'),
|
||||
require('./features/resize')
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"elements": [
|
||||
"bpmn:Task",
|
||||
"bpmn:SubProcess"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
|
||||
var resizableElements = require('./BpmnResizableElements.json').elements;
|
||||
|
||||
|
||||
function BpmnResizeHandler(eventBus, resize) {
|
||||
|
||||
var isResizeAllowed = function(element) {
|
||||
var isAllowed = _.contains(resizableElements, element.type);
|
||||
|
||||
if (isAllowed) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Register Handler
|
||||
eventBus.on('canvas.init', function() {
|
||||
resize.registerResizableHandler(isResizeAllowed);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = BpmnResizeHandler;
|
||||
|
||||
BpmnResizeHandler.$inject = [ 'eventBus', 'resize' ];
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
__depends__: [
|
||||
require('diagram-js/lib/features/resize')
|
||||
],
|
||||
__init__: [ 'bpmnResizeHandler' ],
|
||||
bpmnResizeHandler: [ 'type', require('./BpmnResizeHandler') ]
|
||||
};
|
Loading…
Reference in New Issue