chore(modeling/ElementFactory): use is helper

This commit is contained in:
Nico Rehwaldt 2016-01-25 21:17:10 +01:00 committed by pedesen
parent 639e21a826
commit cc142d8fd5
1 changed files with 14 additions and 8 deletions

View File

@ -3,6 +3,8 @@
var assign = require('lodash/object/assign'),
inherits = require('inherits');
var is = require('../../util/ModelUtil').is;
var BaseElementFactory = require('diagram-js/lib/core/ElementFactory'),
LabelUtil = require('../../util/LabelUtil');
@ -73,7 +75,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
businessObject.di.isExpanded = attrs.isExpanded;
}
if (businessObject.$instanceOf('bpmn:ExclusiveGateway')) {
if (is(businessObject, 'bpmn:ExclusiveGateway')) {
businessObject.di.isMarkerVisible = true;
}
@ -115,7 +117,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
ElementFactory.prototype._getDefaultSize = function(semantic) {
if (semantic.$instanceOf('bpmn:SubProcess')) {
if (is(semantic, 'bpmn:SubProcess')) {
var isExpanded = semantic.di.isExpanded === true;
if (isExpanded) {
@ -125,30 +127,34 @@ ElementFactory.prototype._getDefaultSize = function(semantic) {
}
}
if (semantic.$instanceOf('bpmn:Task')) {
if (is(semantic, 'bpmn:Task')) {
return { width: 100, height: 80 };
}
if (semantic.$instanceOf('bpmn:Gateway')) {
if (is(semantic, 'bpmn:Gateway')) {
return { width: 50, height: 50 };
}
if (semantic.$instanceOf('bpmn:Event')) {
if (is(semantic, 'bpmn:Event')) {
return { width: 36, height: 36 };
}
if (semantic.$instanceOf('bpmn:Participant')) {
if (is(semantic, 'bpmn:Participant')) {
return { width: 600, height: 250 };
}
if (semantic.$instanceOf('bpmn:Lane')) {
if (is(semantic, 'bpmn:Lane')) {
return { width: 400, height: 100 };
}
if (semantic.$instanceOf('bpmn:DataObjectReference')) {
if (is(semantic, 'bpmn:DataObjectReference')) {
return { width: 36, height: 50 };
}
if (is(semantic, 'bpmn:DataStoreReference')) {
return { width: 50, height: 50 };
}
return { width: 100, height: 80 };
};