improve(elementfactory): changed default size for SubProcesses

- expanded: with enough space for a small process
- collapsed: same size as Tasks
This commit is contained in:
jdotzki 2014-10-07 11:54:21 +02:00
parent 0ffdbb7fbb
commit 5633dc0b78
1 changed files with 12 additions and 2 deletions

View File

@ -38,8 +38,6 @@ ElementFactory.prototype.createWithBpmn = function(elementType, attrs) {
businessObject = this._bpmnFactory.create(attrs.type);
}
size = this._getDefaultSize(businessObject);
if (!businessObject.di) {
if (elementType === 'connection') {
businessObject.di = this._bpmnFactory.createDiEdge(businessObject, [], {
@ -56,6 +54,8 @@ ElementFactory.prototype.createWithBpmn = function(elementType, attrs) {
businessObject.di.isExpanded = attrs.isExpanded;
}
size = this._getDefaultSize(businessObject);
attrs = _.extend({
businessObject: businessObject,
id: businessObject.id
@ -82,6 +82,16 @@ ElementFactory.prototype.createConnection = function(attrs) {
ElementFactory.prototype._getDefaultSize = function(semantic) {
if (semantic.$instanceOf('bpmn:SubProcess')) {
var isExpanded = semantic.di.isExpanded === true;
if (isExpanded) {
return { width: 350, height: 200 };
} else {
return { width: 100, height: 80 };
}
}
if (semantic.$instanceOf('bpmn:Task')) {
return { width: 100, height: 80 };
}