improve(resize): restrict resizable elements

related bpmn-io/bpmn-js#140
This commit is contained in:
jdotzki 2014-10-14 09:12:03 +02:00
parent 392dfaee41
commit 1e224370e2
4 changed files with 43 additions and 1 deletions

View File

@ -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')
];

View File

@ -0,0 +1,6 @@
{
"elements": [
"bpmn:Task",
"bpmn:SubProcess"
]
}

View File

@ -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' ];

View File

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