Custom shape doesnot have there properties in xml file, like this:
<omgdc:Bounds />
normal:
<omgdc:Bounds x=“582” y=“82” width=“36” height=“36” />
I checked the object and find they have different businessObject structure.
normal element’s bussinessObject:
{
“$type”: “bpmn:BusinessRuleTask”,
“id”: “BusinessRuleTask_2”,
“name”: “审核失败”,
“di”: {
“$type”: “bpmndi:BPMNShape”,
“bounds”: {
“$type”: “dc:Bounds”,
“x”: 350,
“y”: 260,
“width”: 100,
“height”: 80
},
“id”: “BusinessRuleTask_2_di”,
“x”: 350
}
}
custom element’s bussnessObject is:
{
“type”: “custom:button”,
“id”: “Flow_00c7khr-CustomButton”,
“x”: 450,
“y”: 300,
“width”: 30,
“height”: 30,
“name”: “+”,
“di”: {
“$type”: “bpmndi:BPMNShape”,
“bounds”: {
“$type”: “dc:Bounds”
},
“id”: “Flow_00c7khr-CustomButton_di”,
}
}
addCustomShape:
CustomModeler.prototype.addCustomShape = function(customElement) {
this.customElements.push(customElement);
const canvas = this.get('canvas');
const elementFactory = this.get('elementFactory');
const customAttrs = assign({businessObject: customElement}, customElement);
const customShape = elementFactory.create('shape', customAttrs);
return canvas.addShape(customShape);
};
how to fixed this?